2
0
mirror of https://github.com/ad1217/PrinterStatus synced 2024-11-13 03:53:29 -05:00

Compare commits

..

No commits in common. "f39366cd8238f11a92db2d61c65224c14f2f4439" and "d6a3fb766f28e779731f9ec1e9a82a682955031a" have entirely different histories.

7 changed files with 877 additions and 878 deletions

View File

@ -2,21 +2,21 @@
"name": "printer_status", "name": "printer_status",
"version": "0.0.0", "version": "0.0.0",
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^3.0.3", "@vitejs/plugin-vue": "^2.0.1",
"sass": "^1.54.5", "sass": "^1.45.2",
"typescript": "^4.7.4", "typescript": "^4.5.4",
"vite": "^3.0.9", "vite": "^2.7.10",
"vue-tsc": "^0.40.1" "vue-tsc": "^0.30.2"
}, },
"dependencies": { "dependencies": {
"@popperjs/core": "^2.11.6", "@popperjs/core": "^2.11.2",
"bootstrap": "^5.2.0", "bootstrap": "^5.1.3",
"hls.js": "^1.2.1", "hls.js": "^1.1.2",
"pretty-ms": "^7.0.1", "pretty-ms": "^7.0.1",
"vue": "^3.2.37" "vue": "^3.2.26"
}, },
"scripts": { "scripts": {
"start": "pnpm run -r --include-workspace-root --parallel dev", "start": "pnpm run -r --parallel dev",
"server": "cd server && npm start", "server": "cd server && npm start",
"dev": "vite", "dev": "vite",
"build": "vue-tsc --noEmit && vite build", "build": "vue-tsc --noEmit && vite build",

File diff suppressed because it is too large Load Diff

1
server/.gitignore vendored
View File

@ -1 +0,0 @@
dist/

View File

@ -4,25 +4,23 @@
"@types/express-ws": "^3.0.1", "@types/express-ws": "^3.0.1",
"@types/fluent-ffmpeg": "^2.1.20", "@types/fluent-ffmpeg": "^2.1.20",
"@types/js-yaml": "^4.0.5", "@types/js-yaml": "^4.0.5",
"@types/node": "^18.7.11", "@types/node": "^17.0.8",
"@types/node-fetch": "^2.6.2", "@types/node-fetch": "^2.5.12",
"@types/ws": "^8.5.3", "@types/ws": "^8.2.2",
"ts-node-dev": "^2.0.0", "ts-node": "^10.4.0",
"typescript": "^4.7.4" "typescript": "^4.5.4"
}, },
"dependencies": { "dependencies": {
"express": "^4.18.1", "express": "^4.17.2",
"express-ws": "^5.0.2", "express-ws": "^5.0.2",
"fluent-ffmpeg": "^2.1.2", "fluent-ffmpeg": "^2.1.2",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"mp4frag": "^0.6.0", "mp4frag": "^0.5.4",
"node-fetch": "^2.6.7", "node-fetch": "^2.6.6",
"ws": "^8.8.1" "ws": "^8.4.0"
}, },
"scripts": { "scripts": {
"start": "npm run dev", "start": "npm run dev",
"dev": "ts-node-dev --files ./src/server.ts", "dev": "ts-node --files ./src/server.ts"
"build": "tsc",
"serve": "node dist/server.js"
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,6 @@ import { Message, StatusMessage, SettingsMessage } from '../../types/messages';
import * as octoprint from '../../types/octoprint'; import * as octoprint from '../../types/octoprint';
const PING_TIME = 10000; const PING_TIME = 10000;
const STATUS_TIMEOUT = 30000;
type Timeout = ReturnType<typeof setTimeout>; type Timeout = ReturnType<typeof setTimeout>;
@ -59,7 +58,6 @@ export default class OctoprintConnection {
let pingSender: ReturnType<typeof setInterval>; let pingSender: ReturnType<typeof setInterval>;
let pongTimeout: Timeout; let pongTimeout: Timeout;
let statusTimeout: Timeout;
const url = new URL('/sockjs/websocket', this.address); const url = new URL('/sockjs/websocket', this.address);
url.protocol = 'ws'; url.protocol = 'ws';
@ -68,14 +66,6 @@ export default class OctoprintConnection {
.on('open', () => { .on('open', () => {
pingSender = setInterval(() => websocket.ping(), PING_TIME); pingSender = setInterval(() => websocket.ping(), PING_TIME);
pongTimeout = this.heartbeat(websocket, pongTimeout); pongTimeout = this.heartbeat(websocket, pongTimeout);
statusTimeout = setTimeout(() => {
console.log(
`No status recieved in ${STATUS_TIMEOUT / 1000}s for "${
this.slug
}", disconnecting`
);
websocket.terminate();
}, STATUS_TIMEOUT);
console.log(`Connected to "${this.slug}"`); console.log(`Connected to "${this.slug}"`);
websocket.send(JSON.stringify({ auth: session_key })); websocket.send(JSON.stringify({ auth: session_key }));
@ -91,7 +81,6 @@ export default class OctoprintConnection {
this.broadcast(ext_event); this.broadcast(ext_event);
if ('current' in event || 'history' in event) { if ('current' in event || 'history' in event) {
clearTimeout(statusTimeout);
this.lastStatus = ext_event; this.lastStatus = ext_event;
} }
}) })
@ -101,7 +90,6 @@ export default class OctoprintConnection {
.on('close', () => { .on('close', () => {
clearInterval(pingSender); clearInterval(pingSender);
clearTimeout(pongTimeout); clearTimeout(pongTimeout);
clearTimeout(statusTimeout);
console.log( console.log(
`Lost connection to "${this.slug}", attempting reconnection in 5 seconds` `Lost connection to "${this.slug}", attempting reconnection in 5 seconds`

View File

@ -1,11 +1,9 @@
{ {
"include": ["src/**/*"],
"compilerOptions": { "compilerOptions": {
"target": "es5", "target": "es5",
"strict": true, "strict": true,
"module": "commonjs", "module": "commonjs",
"moduleResolution": "node", "moduleResolution": "node",
"outDir": "dist",
"experimentalDecorators": true "experimentalDecorators": true
} }
} }