This commit is contained in:
Henry Jameson 2026-01-14 15:14:14 +02:00
commit f775f64034
2 changed files with 15 additions and 2 deletions

9
Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM node:22
COPY node_modules index.js package.json yarn.lock .
RUN yarn
ENTRYPOINT node ./index.js
LABEL org.opencontainers.image.title="hj-stream-bot" \
org.opencontainers.image.description="HJ Stream Bot"

View file

@ -5,7 +5,10 @@ const userBearer = process.env.USER_BEARER;
const instance = process.env.INSTANCE; const instance = process.env.INSTANCE;
const videoId = process.env.VIDEO_ID; const videoId = process.env.VIDEO_ID;
const globalState = { currentlyLive: false }; const globalState = {
exit: false,
currentlyLive: false,
};
const headers = (bearer) => ({ const headers = (bearer) => ({
accept: '*/*', accept: '*/*',
@ -55,6 +58,7 @@ const scrobble = ({ title, external_link }) =>
// }); // });
process.on('SIGINT', () => { process.on('SIGINT', () => {
globalState.exit = true;
process.exit(); process.exit();
}); });
@ -90,7 +94,7 @@ const loop = async () => {
} }
} }
setTimeout(loop, 30 * 1000); if (!globalState.exit) setTimeout(loop, 30 * 1000);
}; };
loop(); loop();