add Dockerfile

This commit is contained in:
wy 2025-03-12 16:27:01 +08:00
parent 5ec428a75c
commit bb92f4d2f3
2 changed files with 15 additions and 2 deletions

11
Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM node:22-alpine
LABEL authors="wy"
EXPOSE 20123
COPY index.js .
COPY package.json .
RUN npm install
CMD ["node", "index.js"]

View File

@ -14,8 +14,6 @@ const SMTP_SECURE = process.env.SMTP_SECURE === 'true'
const SMTP_SENDER = process.env.SMTP_SENDER const SMTP_SENDER = process.env.SMTP_SENDER
const SMTP_PASS = process.env.SMTP_PASS const SMTP_PASS = process.env.SMTP_PASS
console.log(process.env)
let stat = null let stat = null
app.get('/', (req, res) => { app.get('/', (req, res) => {
@ -74,6 +72,7 @@ if (configs.length > 0) {
// cd // cd
if (drugCd && typeof drugCd === 'number' && drugCd - timeDiff < 60 && drugCd - timeDiff > 0) { if (drugCd && typeof drugCd === 'number' && drugCd - timeDiff < 60 && drugCd - timeDiff > 0) {
console.log(`[${uid}]发送XAN通知`)
transporter.sendMail({ transporter.sendMail({
from: `"Torn通知" <${SMTP_SENDER}>`, // sender address from: `"Torn通知" <${SMTP_SENDER}>`, // sender address
to: email, // list of receivers to: email, // list of receivers
@ -86,6 +85,7 @@ if (configs.length > 0) {
} }
// 体力满 // 体力满
if (energyFull && typeof energyFull === 'number' && energyFull - timeDiff < 60 && energyFull - timeDiff > 0) { if (energyFull && typeof energyFull === 'number' && energyFull - timeDiff < 60 && energyFull - timeDiff > 0) {
console.log(`[${uid}]发送体力通知`)
transporter.sendMail({ transporter.sendMail({
from: `"Torn通知" <${SMTP_SENDER}>`, from: `"Torn通知" <${SMTP_SENDER}>`,
to: email, to: email,
@ -97,6 +97,7 @@ if (configs.length > 0) {
} }
// 精神满 // 精神满
if (nerveFull && typeof nerveFull === 'number' && nerveFull - timeDiff < 60 && nerveFull - timeDiff > 0) { if (nerveFull && typeof nerveFull === 'number' && nerveFull - timeDiff < 60 && nerveFull - timeDiff > 0) {
console.log(`[${uid}]发送精神通知`)
transporter.sendMail({ transporter.sendMail({
from: `"Torn通知" <${SMTP_SENDER}>`, from: `"Torn通知" <${SMTP_SENDER}>`,
to: email, to: email,
@ -108,6 +109,7 @@ if (configs.length > 0) {
} }
// 飞机落地 // 飞机落地
if (travelTimeLeft && typeof travelTimeLeft === 'number' && travelTimeLeft - timeDiff < 60 && travelTimeLeft - timeDiff > 0) { if (travelTimeLeft && typeof travelTimeLeft === 'number' && travelTimeLeft - timeDiff < 60 && travelTimeLeft - timeDiff > 0) {
console.log(`[${uid}]发送飞行通知`)
transporter.sendMail({ transporter.sendMail({
from: `"Torn通知" <${SMTP_SENDER}>`, from: `"Torn通知" <${SMTP_SENDER}>`,
to: email, to: email,