Nginx now uses HTTPS, changed plugin menu, fixed video menu
Nginx now uses an HTTPS cert that is generated on first boot. TouchUI is now a recommended plugin, Themeify is now a suggested plugin Video menu will now exit if there are no video devices detected
This commit is contained in:
parent
c3043a6003
commit
4550badacd
8 changed files with 36 additions and 22 deletions
5
TODO.md
5
TODO.md
|
@ -3,9 +3,7 @@
|
|||
## First time/Octo-Config
|
||||
- Add network configuration (replace nmtui)
|
||||
- Add hostname configuration (replace nmtui)
|
||||
|
||||
## Frontend
|
||||
- Add on screen keyboard to Openbox autostart
|
||||
- Timezone selection
|
||||
|
||||
## Misc
|
||||
- 64 bit builds
|
||||
|
@ -14,3 +12,4 @@
|
|||
## Things to consider
|
||||
- Wayland using labwc/waybox
|
||||
- Python 3
|
||||
- Detect if frontend did not load correctly (probably not easy)
|
||||
|
|
|
@ -20,9 +20,10 @@ done
|
|||
|
||||
######
|
||||
## Opens browser
|
||||
# -t | Disables strict TLS check
|
||||
# -F | Fullscreen
|
||||
# -g | Disable giving away geolocation
|
||||
# -K | Enable kiosk mode (doesn't seem to do anything?)
|
||||
# -n | Disable web inspector
|
||||
# -p | Disable plugins
|
||||
surf -F -g -K -n -p "$ADDRESS"
|
||||
surf -t -F -g -K -n -p "https://$ADDRESS"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
install -m 644 files/octoprint.service ${ROOTFS_DIR}/etc/systemd/system/octoprint.service
|
||||
|
||||
install -m 644 files/nginx.conf ${ROOTFS_DIR}/etc/nginx/nginx.conf
|
||||
echo -e "listen 80;" > ${ROOTFS_DIR}/etc/nginx/listen.conf
|
||||
echo -e "listen 443;" > ${ROOTFS_DIR}/etc/nginx/listen.conf
|
||||
|
||||
on_chroot << EOF
|
||||
# If OctoPrint already exists, skip this (for debugging)
|
||||
|
|
|
@ -25,11 +25,14 @@
|
|||
|
||||
server {
|
||||
include /etc/nginx/listen.conf;
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/certs/nginx-octoprint.crt;
|
||||
ssl_certificate_key /etc/ssl/private/nginx-octoprint.key;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
proxy_pass http://octoprint/;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[Unit]
|
||||
Description=OctoPrint Daemon
|
||||
Wants=nginx.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
[Unit]
|
||||
Description=MJPG-Streamer Daemon
|
||||
Wants=nginx.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
|
|
@ -22,12 +22,12 @@ error_install () {
|
|||
|
||||
recommended_menu () {
|
||||
local RECOMMEND_MENU=$(dialog --nocancel --title "Plugin Manager | Recommended Plugins" --checklist "Check plugins that you wish to install" 0 0 0 \
|
||||
"OctoPrint-Dashboard" "Adds a nice dashboard to OctoPrint" ON \
|
||||
"ExcludeRegion" "Select regions of the bed where you don't want to print" ON \
|
||||
"NavbarTemp" "Shows the temperature of the Pi, extruder(s) and bed in the navigation bar" ON \
|
||||
"PrintTimeGenius" "Provides more accurate print time estimates" ON \
|
||||
"HeaterTimeout" "Turns off the hotend and bed after a set amount of time" ON \
|
||||
"Themeify" "Adds theming supports and a few themes to OctoPrint" ON 3>&1 1>&2 2>&3)
|
||||
"OctoPrint-Dashboard" "Adds a nice dashboard to OctoPrint." ON \
|
||||
"ExcludeRegion" "Select regions of the bed where you don't want to print." ON \
|
||||
"NavbarTemp" "Shows the temperature of the Pi, extruder(s) and bed in the navigation bar." ON \
|
||||
"PrintTimeGenius" "Provides more accurate print time estimates." ON \
|
||||
"HeaterTimeout" "Turns off the hotend and bed after a set amount of time." ON \
|
||||
"TouchUI" "Makes the UI easier to use on touchscreens. Also adds a virtual keyboard." ON 3>&1 1>&2 2>&3)
|
||||
|
||||
RECOMMEND_MENU=($RECOMMEND_MENU)
|
||||
|
||||
|
@ -39,24 +39,24 @@ recommended_menu () {
|
|||
"NavbarTemp") install_package "https://github.com/imrahil/OctoPrint-NavbarTemp/archive/master.zip" || error_install "NavbarTemp";;
|
||||
"PrintTimeGenius") install_package "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip" || error_install "PrintTimeGenius";;
|
||||
"HeaterTimeout") install_package "https://github.com/google/OctoPrint-HeaterTimeout/archive/master.zip" || error_install "HeaterTimeout";;
|
||||
"Themeify") install_package "https://github.com/birkbjo/OctoPrint-Themeify/archive/master.zip" || error_install "Themeify";;
|
||||
"TouchUI") install_package "https://github.com/BillyBlaze/OctoPrint-TouchUI/archive/master.zip" || error_install "TouchUI";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
suggested_menu () {
|
||||
local SUGGEST_MENU=$(dialog --nocancel --title "Plugin Manager | Suggested Plugins" --checklist "Check plugins that you wish to install" 0 0 0 \
|
||||
"TouchUI" "Makes the UI easier to use on touchscreens" OFF \
|
||||
"Preheat" "Adds a preheat button to preheat the bed and extruder to the temperature set in the selected gcode file" OFF \
|
||||
"ConsolidatedTabs" "Allows you to combine several tabs into one larger tab with draggable and resizable panels" OFF \
|
||||
"DetailedProgress" "Sends commands to your printer to display current printing progress" OFF 3>&1 1>&2 2>&3)
|
||||
"Themeify" "Adds theming supports and a few themes to OctoPrint." OFF \
|
||||
"Preheat" "Adds a preheat button to preheat the bed and extruder to the temperature set in the selected gcode file." OFF \
|
||||
"ConsolidatedTabs" "Allows you to combine several tabs into one larger tab with draggable and resizable panels." OFF \
|
||||
"DetailedProgress" "Sends commands to your printer to display current printing progress." OFF 3>&1 1>&2 2>&3)
|
||||
|
||||
SUGGEST_MENU=($SUGGEST_MENU)
|
||||
|
||||
for ((i = 0; i < ${#SUGGEST_MENU[@]}; i++)); do
|
||||
echo $(( $i * 100 / ${#SUGGEST_MENU[@]} )) | dialog --title "Plugin Manager" --gauge "Installing ${SUGGEST_MENU[$i]}" 10 50
|
||||
case ${SUGGEST_MENU[$i]} in
|
||||
"TouchUI") install_package "https://github.com/BillyBlaze/OctoPrint-TouchUI/archive/master.zip" || error_install "TouchUI";;
|
||||
"Themeify") install_package "https://github.com/birkbjo/OctoPrint-Themeify/archive/master.zip" || error_install "Themeify";;
|
||||
"Preheat") install_package "https://github.com/marian42/octoprint-preheat/archive/master.zip" || error_install "Preheat";;
|
||||
"ConsolidatedTabs") install_package "https://github.com/jneilliii/OctoPrint-ConsolidatedTabs/archive/master.zip" || error_install "ConsolidatedTabs";;
|
||||
"DetailedProgress") install_package "https://github.com/tpmullan/OctoPrint-DetailedProgress/archive/master.zip" || error_install "DetailedProgress";;
|
||||
|
@ -77,8 +77,11 @@ service_select
|
|||
|
||||
screen_timeout
|
||||
|
||||
# If OctoPrint is running locally, ask if the user wants to change the default listening port/IP (optional)
|
||||
if [[ -f /etc/systemd/system/multi-user.target.wants/octoprint.service ]] && dialog --title "Nginx Config" --yesno "Do you wish to change the default OctoPrint listening address and/or port?" 10 60; then
|
||||
# Makes a certificate and key for Nginx HTTPS
|
||||
openssl req -x509 -nodes -days 36500 -newkey rsa:4096 -subj "/C=/ST=/L=/O=/OU=/CN=*/emailAddress=" -out /etc/ssl/certs/nginx-octoprint.crt -keyout /etc/ssl/private/nginx-octoprint.key
|
||||
|
||||
# If OctoPrint/MJPG Streamer is running locally, ask if the user wants to change the default listening port/IP (optional)
|
||||
if ( [[ -f /etc/systemd/system/multi-user.target.wants/octoprint.service ]] || [[ -f /etc/systemd/system/multi-user.target.wants/mjpg-streamer.service ]] ) && dialog --title "Nginx Config" --yesno "Do you wish to change the default Nginx listening address and/or port?" 10 60; then
|
||||
nginx_config
|
||||
fi
|
||||
|
||||
|
|
|
@ -104,16 +104,22 @@ nginx_config () {
|
|||
if [[ -f /etc/nginx/listen.conf ]]; then
|
||||
LISTEN=$(grep -i listen /etc/nginx/listen.conf | awk '{gsub(";",""); print $2}')
|
||||
else
|
||||
LISTEN="80"
|
||||
LISTEN="443"
|
||||
fi
|
||||
|
||||
LISTEN=$(dialog --title "Nginx Config" --nocancel --inputbox "Configure what port and IP Nginx should listen on.\nTo listen on all IPs, just enter the port.\nDefault: 80" 11 50 "$LISTEN" 3>&1 1>&2 2>&3)
|
||||
LISTEN=$(dialog --title "Nginx Config" --nocancel --inputbox "Configure what port and IP Nginx should listen on.\nTo listen on all IPs, just enter the port.\nDefault: 443" 11 50 "$LISTEN" 3>&1 1>&2 2>&3)
|
||||
|
||||
# Write new value to nginx
|
||||
echo "listen $LISTEN;" > /etc/nginx/listen.conf
|
||||
}
|
||||
|
||||
video_config () {
|
||||
# In the unlikely event that there are no video devices, don't continue
|
||||
if ! ls /dev/video* 2>&1 >/dev/null; then
|
||||
dialog --title "Error" --msgbox "No video devices detected!" 10 50
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Grab all video devices
|
||||
local DEVICES=($(ls /dev/video*))
|
||||
|
||||
|
|
Loading…
Reference in a new issue