summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilhelm Schuster2021-02-22 11:45:38 +0100
committerWilhelm Schuster2021-02-22 11:45:38 +0100
commitc19c72027ad77427d3da8d208e71b53e6f6b2fc8 (patch)
tree6698a2e365075a65abc6240ff5f6790f80ab9c5d
downloadaur-c19c72027ad77427d3da8d208e71b53e6f6b2fc8.tar.gz
Initial import
-rw-r--r--.SRCINFO21
-rw-r--r--PKGBUILD50
-rw-r--r--mainsail-klipper.cfg53
-rw-r--r--mainsail-nginx.conf64
4 files changed, 188 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 00000000000..69e0eae41da
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = mainsail-git
+ pkgdesc = Klipper web frontend
+ pkgver = r499.c00da9b
+ pkgrel = 1
+ url = https://github.com/meteyou/mainsail
+ arch = any
+ license = GPLv3
+ makedepends = npm
+ optdepends = nginx: serve via HTTP
+ optdepends = ustreamer: webcam streaming support
+ provides = mainsail
+ conflicts = mainsail
+ source = git+https://github.com/meteyou/mainsail.git#branch=master
+ source = mainsail-klipper.cfg
+ source = mainsail-nginx.conf
+ sha256sums = SKIP
+ sha256sums = 3ab90887f056957d983aa4c00aa92d0a29f8aad07e410b18751a26a6e73539de
+ sha256sums = 7c86d687ac7b1fb84fc04d1ffcd468a05767a9c9d880ad6d666b2527523495ec
+
+pkgname = mainsail-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..a6ec9834fb1
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,50 @@
+# Maintainer: Wilhelm Schuster <aur [aT] rot13 dot io>
+pkgname=mainsail-git
+_pkgname="${pkgname%-git}"
+pkgver=r499.c00da9b
+pkgrel=1
+pkgdesc="Klipper web frontend"
+arch=(any)
+url="https://github.com/meteyou/mainsail"
+license=('GPLv3')
+depends=()
+makedepends=('npm')
+optdepends=('nginx: serve via HTTP'
+ 'ustreamer: webcam streaming support')
+provides=("$_pkgname")
+conflicts=("$_pkgname")
+source=('git+https://github.com/meteyou/mainsail.git#branch=master' 'mainsail-klipper.cfg' 'mainsail-nginx.conf')
+sha256sums=('SKIP'
+ '3ab90887f056957d983aa4c00aa92d0a29f8aad07e410b18751a26a6e73539de'
+ '7c86d687ac7b1fb84fc04d1ffcd468a05767a9c9d880ad6d666b2527523495ec')
+
+pkgver() {
+ cd "$srcdir/$_pkgname"
+
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+}
+
+build() {
+ cd "$srcdir/$_pkgname"
+
+ npm install --no-update-notifier --no-audit --cache "${srcdir}/npm-cache"
+ ./node_modules/.bin/vue-cli-service build
+}
+
+package() {
+ cd "$srcdir/$_pkgname"
+
+ install -dm755 "${pkgdir}/usr/share/webapps"
+ cp -r dist "$pkgdir/usr/share/webapps/${_pkgname}"
+
+ # Non-deterministic race in npm gives 777 permissions to random directories.
+ # See https://github.com/npm/cli/issues/1103 for details.
+ find "${pkgdir}/usr" -type d -exec chmod 755 {} +
+
+ # npm gives ownership of ALL FILES to build user
+ # https://bugs.archlinux.org/task/63396
+ chown -R root:root "${pkgdir}"
+
+ install -Dm644 "${srcdir}/mainsail-klipper.cfg" "${pkgdir}/usr/share/doc/${_pkgname}/mainsail-klipper.cfg"
+ install -Dm644 "${srcdir}/mainsail-nginx.conf" "${pkgdir}/usr/share/doc/${_pkgname}/mainsail-nginx.conf"
+}
diff --git a/mainsail-klipper.cfg b/mainsail-klipper.cfg
new file mode 100644
index 00000000000..04182c29422
--- /dev/null
+++ b/mainsail-klipper.cfg
@@ -0,0 +1,53 @@
+[virtual_sdcard]
+#path: /opt/klipper/gcode_files
+
+[pause_resume]
+
+[display_status]
+
+[gcode_macro CANCEL_PRINT]
+rename_existing: BASE_CANCEL_PRINT
+gcode:
+ TURN_OFF_HEATERS
+ CLEAR_PAUSE
+ SDCARD_RESET_FILE
+ BASE_CANCEL_PRINT
+
+[gcode_macro PAUSE]
+rename_existing: BASE_PAUSE
+# change this if you need more or less extrusion
+variable_extrude: 1.0
+gcode:
+ ##### read E from pause macro #####
+ {% set E = printer["gcode_macro PAUSE"].extrude|float %}
+ ##### set park positon for x and y #####
+ # default is your max posion from your printer.cfg
+ {% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
+ {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
+ ##### calculate save lift position #####
+ {% set max_z = printer.toolhead.axis_maximum.z|float %}
+ {% set act_z = printer.toolhead.position.z|float %}
+ {% if act_z < (max_z - 2.0) %}
+ {% set z_safe = 2.0 %}
+ {% else %}
+ {% set z_safe = max_z - act_z %}
+ {% endif %}
+ ##### end of definitions #####
+ SAVE_GCODE_STATE NAME=PAUSE_state
+ BASE_PAUSE
+ G91
+ G1 E-{E} F2100
+ G1 Z{z_safe} F900
+ G90
+ G1 X{x_park} Y{y_park} F6000
+
+[gcode_macro RESUME]
+rename_existing: BASE_RESUME
+gcode:
+ ##### read E from pause macro #####
+ {% set E = printer["gcode_macro PAUSE"].extrude|float %}
+ ##### end of definitions #####
+ G91
+ G1 E{E} F2100
+ RESTORE_GCODE_STATE NAME=PAUSE_state
+ BASE_RESUME
diff --git a/mainsail-nginx.conf b/mainsail-nginx.conf
new file mode 100644
index 00000000000..f8c3562d090
--- /dev/null
+++ b/mainsail-nginx.conf
@@ -0,0 +1,64 @@
+map $http_upgrade $connection_upgrade {
+ default upgrade;
+ '' close;
+}
+
+# moonraker
+upstream apiserver {
+ ip_hash;
+ server 127.0.0.1:7125;
+}
+
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+
+ access_log /var/log/nginx/mainsail-access.log;
+ error_log /var/log/nginx/mainsail-error.log;
+
+ #disable this section on smaller hardware like a pi zero
+ gzip on;
+ gzip_vary on;
+ gzip_proxied any;
+ gzip_proxied expired no-cache no-store private auth;
+ gzip_comp_level 4;
+ gzip_buffers 16 8k;
+ gzip_http_version 1.1;
+ gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml;
+
+ #web_path from mainsail static files
+ root /usr/share/webapps/mainsail;
+
+ index index.html;
+ server_name _;
+
+ #disable max upload size
+ client_max_body_size 0;
+
+ location / {
+ try_files $uri $uri/ /index.html;
+ }
+
+ location = /index.html {
+ add_header Cache-Control "no-store, no-cache, must-revalidate";
+ }
+
+ location /websocket {
+ proxy_pass http://apiserver/websocket;
+ proxy_http_version 1.1;
+ proxy_set_header Upgrade $http_upgrade;
+ proxy_set_header Connection $connection_upgrade;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_read_timeout 86400;
+ }
+
+ location ~ ^/(printer|api|access|machine|server)/ {
+ proxy_pass http://apiserver$request_uri;
+ proxy_set_header Host $http_host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Scheme $scheme;
+ }
+}