docker
This commit is contained in:
parent
0c3e4ae880
commit
f775f64034
2 changed files with 15 additions and 2 deletions
9
Dockerfile
Normal file
9
Dockerfile
Normal 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"
|
||||||
8
index.js
8
index.js
|
|
@ -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();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue