diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8ff48c56f..97def2749 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,7 @@ version: 2 updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: "10:00" - open-pull-requests-limit: 15 - labels: - - dependencies + # Check for updates to GitHub Actions every week + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/approve-and-merge-dependency-updates.yaml b/.github/workflows/approve-and-merge-dependency-updates.yaml index 794c5c664..857f6adad 100644 --- a/.github/workflows/approve-and-merge-dependency-updates.yaml +++ b/.github/workflows/approve-and-merge-dependency-updates.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Auto Approve - uses: hmarr/auto-approve-action@v2 + uses: hmarr/auto-approve-action@v3 if: github.actor == 'dependabot[bot]' with: github-token: '${{ secrets.GITHUB_TOKEN }}' @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Auto Merge - uses: pascalgn/automerge-action@v0.13.1 + uses: pascalgn/automerge-action@v0.16.0 if: github.actor == 'dependabot[bot]' env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f2e4cdd06..cfb8bfe01 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,7 +14,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache node modules uses: actions/cache@v2 env: @@ -25,7 +25,7 @@ jobs: restore-keys: | octodash-build-${{ env.cache-name }}- - name: Use Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: '14' - name: Install latest npm @@ -40,7 +40,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache node modules uses: actions/cache@v2 env: @@ -51,7 +51,7 @@ jobs: restore-keys: | octodash-build-${{ env.cache-name }}- - name: Use Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: '14' - name: Install latest npm diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index b6be125dd..44a254003 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -9,9 +9,9 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Cache node modules - uses: actions/cache@v2 + uses: actions/cache@v3 env: cache-name: octodash-node-modules with: @@ -20,16 +20,20 @@ jobs: restore-keys: | ${{ runner.os }}-build-${{ env.cache-name }}- - name: Use Node.js - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: - node-version: '16' + node-version: '14' + - name: Install latest npm + run: sudo npm install -g npm@latest - name: Installing Dependencies run: npm ci - name: Building Application run: npm run build:prod - name: Packaging Application run: npm run electron:pack + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} - name: Upload Artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: path: package/octodash*.deb diff --git a/main.js b/main.js index f717fc61a..e63d0a88b 100644 --- a/main.js +++ b/main.js @@ -61,7 +61,9 @@ function createWindow() { if (dev) { url = 'http://localhost:4200'; - window.webContents.openDevTools(); + let devtools = new BrowserWindow(); + window.webContents.setDevToolsWebContents(devtools.webContents); + window.webContents.openDevTools({ mode: 'detach' }); } else { url = `file://${__dirname}/dist/${locale}/index.html`; window.setFullScreen(true); diff --git a/scripts/install.sh b/scripts/install.sh index 14d3c4078..2406b5731 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -668,13 +668,13 @@ text_input() { -arch=$(uname -m) -if [[ $arch == x86_64 ]]; then - releaseURL=$(curl -s "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | grep "browser_download_url.*amd64.deb" | cut -d '"' -f 4) -elif [[ $arch == aarch64 ]]; then - releaseURL=$(curl -s "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | grep "browser_download_url.*arm64.deb" | cut -d '"' -f 4) -elif [[ $arch == arm* ]]; then +arch=$(dpkg --print-architecture) +if [[ $arch == armhf ]]; then releaseURL=$(curl -s "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | grep "browser_download_url.*armv7l.deb" | cut -d '"' -f 4) +elif [[ $arch == arm64 ]]; then + releaseURL=$(curl -s "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | grep "browser_download_url.*arm64.deb" | cut -d '"' -f 4) +elif [[ $arch == amd64 ]]; then + releaseURL=$(curl -s "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | grep "browser_download_url.*amd64.deb" | cut -d '"' -f 4) fi dependencies="libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libappindicator3-1 libsecret-1-0 xserver-xorg ratpoison x11-xserver-utils xinit libgtk-3-0 bc desktop-file-utils libavahi-compat-libdnssd1 libpam0g-dev libx11-dev" IFS='/' read -ra version <<< "$releaseURL" @@ -695,12 +695,12 @@ echo "Installing Dependencies ..." exit -1 } -if [ -d "/home/pi/OctoPrint/venv" ]; then - DIRECTORY="/home/pi/OctoPrint/venv" -elif [ -d "/home/pi/oprint" ]; then - DIRECTORY="/home/pi/oprint" +if [ -d "$HOME/OctoPrint/venv" ]; then + DIRECTORY="$HOME/OctoPrint/venv" +elif [ -d "$HOME/oprint" ]; then + DIRECTORY="$HOME/oprint" else - echo "Neither /home/pi/OctoPrint/venv nor /home/pi/oprint can be found." + echo "Neither $HOME/OctoPrint/venv nor $HOME/oprint can be found." echo "If your OctoPrint instance is running on a different machine just type - in the following prompt." text_input "Please specify OctoPrints full virtualenv path manually (no trailing slash)." DIRECTORY fi; @@ -834,7 +834,7 @@ EOF sudo chmod +x ~/scripts/update-octodash sudo bash -c 'cat >> /etc/sudoers.d/update-octodash' <
+ + + + OctoDash Companion + + (); @Output() enclosurePluginChange = new EventEmitter(); @@ -29,4 +30,5 @@ export class PluginsComponent { @Output() tpLinkSmartPlugPluginChange = new EventEmitter(); @Output() tasmotaPluginChange = new EventEmitter(); @Output() tasmotaMqttPluginChange = new EventEmitter(); + @Output() companionPluginChange = new EventEmitter(); } diff --git a/src/app/model/octoprint/index.ts b/src/app/model/octoprint/index.ts index 24edd4f29..843c47497 100644 --- a/src/app/model/octoprint/index.ts +++ b/src/app/model/octoprint/index.ts @@ -6,6 +6,7 @@ export * from './printer-commands.model'; export * from './printer-profile.model'; export * from './socket.model'; +export * from './plugins/companion.model'; export * from './plugins/display-layer-progress.model'; export * from './plugins/enclosure.model'; export * from './plugins/filament-manager.model'; diff --git a/src/app/model/octoprint/plugins/companion.model.ts b/src/app/model/octoprint/plugins/companion.model.ts new file mode 100644 index 000000000..84e7e9349 --- /dev/null +++ b/src/app/model/octoprint/plugins/companion.model.ts @@ -0,0 +1,3 @@ +export interface CompanionData { + fanspeed: object; +} diff --git a/src/app/services/socket/socket.octoprint.service.ts b/src/app/services/socket/socket.octoprint.service.ts index 0c20c3da2..c9afa52c9 100644 --- a/src/app/services/socket/socket.octoprint.service.ts +++ b/src/app/services/socket/socket.octoprint.service.ts @@ -18,6 +18,7 @@ import { SocketAuth, } from '../../model'; import { + CompanionData, DisplayLayerProgressData, OctoprintFilament, OctoprintPluginMessage, @@ -81,7 +82,8 @@ export class OctoPrintSocketService implements SocketService { set: 0, unit: '°C', }, - fanSpeed: this.configService.isDisplayLayerProgressEnabled() ? 0 : -1, + fanSpeed: + this.configService.isDisplayLayerProgressEnabled() || this.configService.isCompanionPluginEnabled() ? 0 : -1, } as PrinterStatus; this.printerStatusSubject.next(this.printerStatus); } @@ -168,6 +170,10 @@ export class OctoPrintSocketService implements SocketService { check: (plugin: string) => ['action_command_prompt', 'action_command_notification'].includes(plugin), handler: (message: unknown) => this.handlePrinterNotification(message as PrinterNotification), }, + { + check: (plugin: string) => plugin === 'octodash' && this.configService.isCompanionPluginEnabled(), + handler: (message: unknown) => this.extractFanSpeed(message as CompanionData), + }, ]; plugins.forEach(plugin => plugin.check(pluginMessage.plugin.plugin) && plugin.handler(pluginMessage.plugin.data)); @@ -254,9 +260,17 @@ export class OctoPrintSocketService implements SocketService { this.printerStatusSubject.next(this.printerStatus); } - public extractFanSpeed(message: DisplayLayerProgressData): void { - this.printerStatus.fanSpeed = - message.fanspeed === 'Off' ? 0 : message.fanspeed === '-' ? 0 : Number(message.fanspeed.replace('%', '').trim()); + public extractFanSpeed(message: DisplayLayerProgressData | CompanionData): void { + if (typeof message.fanspeed === 'object') { + this.printerStatus.fanSpeed = Number(Math.round(message.fanspeed['1'])); + } else { + this.printerStatus.fanSpeed = + message.fanspeed === 'Off' + ? 0 + : message.fanspeed === '-' + ? 0 + : Number(message.fanspeed.replace('%', '').trim()); + } } //==== Job Status ====// diff --git a/src/app/settings/settings.component.html b/src/app/settings/settings.component.html index d42bc3ff2..7bd757aab 100644 --- a/src/app/settings/settings.component.html +++ b/src/app/settings/settings.component.html @@ -470,6 +470,15 @@ plugins
+ OctoDash Companion +
+ + + + enabled +
Display Layer Progress