メンテナンスモードを追加
This commit is contained in:
parent
92ce9b196a
commit
f037a1cb60
@ -4,7 +4,7 @@ body {
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.terms-container {
|
.common-container {
|
||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
margin: 80px auto;
|
margin: 80px auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
@ -16,6 +16,7 @@ const requiredEnvVars = [
|
|||||||
"CRON_INTERVAL_MINUTES",
|
"CRON_INTERVAL_MINUTES",
|
||||||
"ADMIN_ID",
|
"ADMIN_ID",
|
||||||
"ADMIN_PASS",
|
"ADMIN_PASS",
|
||||||
|
"IS_MAINTENANCE",
|
||||||
];
|
];
|
||||||
|
|
||||||
requiredEnvVars.forEach((varName) => {
|
requiredEnvVars.forEach((varName) => {
|
||||||
@ -37,6 +38,7 @@ export const YOUTUBE_API_KEY = process.env.YOUTUBE_API_KEY as string;
|
|||||||
export const SESSION_SECRET = process.env.SESSION_SECRET as string;
|
export const SESSION_SECRET = process.env.SESSION_SECRET as string;
|
||||||
export const ADMIN_ID = process.env.ADMIN_ID as string;
|
export const ADMIN_ID = process.env.ADMIN_ID as string;
|
||||||
export const ADMIN_PASS = process.env.ADMIN_PASS as string;
|
export const ADMIN_PASS = process.env.ADMIN_PASS as string;
|
||||||
|
export const IS_MAINTENANCE = process.env.IS_MAINTENANCE === "true";
|
||||||
|
|
||||||
// cron のスケジュールを計算
|
// cron のスケジュールを計算
|
||||||
const intervalMinutes = parseInt(process.env.CRON_INTERVAL_MINUTES || "60", 10);
|
const intervalMinutes = parseInt(process.env.CRON_INTERVAL_MINUTES || "60", 10);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { IS_MAINTENANCE } from "../config/env";
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import { LiveSchedule, Channel } from "../models";
|
import { LiveSchedule, Channel } from "../models";
|
||||||
import { Op } from "sequelize";
|
import { Op } from "sequelize";
|
||||||
@ -11,6 +12,11 @@ dayjs.extend(timezone);
|
|||||||
const router = express.Router();
|
const router = express.Router();
|
||||||
|
|
||||||
router.get("/", async (req, res) => {
|
router.get("/", async (req, res) => {
|
||||||
|
// IS_MAINTENANCE が true の場合メンテナンスページを表示
|
||||||
|
if (IS_MAINTENANCE) {
|
||||||
|
return res.render("maintenance");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const now = dayjs().tz("Asia/Tokyo").startOf("day"); // 当日0時
|
const now = dayjs().tz("Asia/Tokyo").startOf("day"); // 当日0時
|
||||||
const liveSchedules = await LiveSchedule.findAll({
|
const liveSchedules = await LiveSchedule.findAll({
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
|
import { IS_MAINTENANCE } from "../config/env";
|
||||||
import { Channel } from "../models";
|
import { Channel } from "../models";
|
||||||
import { updateLiveSchedulesForChannel } from "./liveScheduleService";
|
import { updateLiveSchedulesForChannel } from "./liveScheduleService";
|
||||||
|
|
||||||
export const updateAllLiveSchedules = async () => {
|
export const updateAllLiveSchedules = async () => {
|
||||||
|
if (IS_MAINTENANCE) {
|
||||||
|
console.log("Maintenance mode is enabled. Skipping live schedule update.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const channels = await Channel.findAll();
|
const channels = await Channel.findAll();
|
||||||
|
|
||||||
|
28
views/maintenance.ejs
Normal file
28
views/maintenance.ejs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ja">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<link rel="stylesheet" href="/css/common.css">
|
||||||
|
</head>
|
||||||
|
<%- include("partials/head") %>
|
||||||
|
<body>
|
||||||
|
<%- include("partials/header") %>
|
||||||
|
<div class="header-spacer"></div>
|
||||||
|
<div class="main-content">
|
||||||
|
<div class="common-container">
|
||||||
|
<h1>メンテナンス中</h1>
|
||||||
|
<section>
|
||||||
|
<p>
|
||||||
|
現在、サイトはメンテナンス中です。<br>
|
||||||
|
ご不便をおかけして申し訳ございませんが、しばらくお待ちください。
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
メンテナンスが完了次第、サービスを再開いたします。<br>
|
||||||
|
何卒ご理解のほどよろしくお願い申し上げます。
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -3,14 +3,14 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<link rel="stylesheet" href="/css/terms.css">
|
<link rel="stylesheet" href="/css/common.css">
|
||||||
</head>
|
</head>
|
||||||
<%- include("partials/head") %>
|
<%- include("partials/head") %>
|
||||||
<body>
|
<body>
|
||||||
<%- include("partials/header") %>
|
<%- include("partials/header") %>
|
||||||
<div class="header-spacer"></div>
|
<div class="header-spacer"></div>
|
||||||
<div class="main-content">
|
<div class="main-content">
|
||||||
<div class="terms-container">
|
<div class="common-container">
|
||||||
<h1>利用規約</h1>
|
<h1>利用規約</h1>
|
||||||
<section>
|
<section>
|
||||||
<h2>サイトの運営について</h2>
|
<h2>サイトの運営について</h2>
|
||||||
|
Loading…
Reference in New Issue
Block a user