添加copyright
This commit is contained in:
@@ -87,6 +87,16 @@ async function checkAndFixDatabase() {
|
||||
await db.query("ALTER TABLE site_settings ADD COLUMN latency_target VARCHAR(255) AFTER latency_dest");
|
||||
console.log(`[Database Integrity] ✅ Column 'latency_target' added.`);
|
||||
}
|
||||
if (!columnNames.includes('icp_filing')) {
|
||||
console.log(`[Database Integrity] ⚠️ Missing column 'icp_filing' in 'site_settings'. Adding it...`);
|
||||
await db.query("ALTER TABLE site_settings ADD COLUMN icp_filing VARCHAR(255) AFTER latency_target");
|
||||
console.log(`[Database Integrity] ✅ Column 'icp_filing' added.`);
|
||||
}
|
||||
if (!columnNames.includes('ps_filing')) {
|
||||
console.log(`[Database Integrity] ⚠️ Missing column 'ps_filing' in 'site_settings'. Adding it...`);
|
||||
await db.query("ALTER TABLE site_settings ADD COLUMN ps_filing VARCHAR(255) AFTER icp_filing");
|
||||
console.log(`[Database Integrity] ✅ Column 'ps_filing' added.`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('[Database Integrity] ❌ Error checking integrity:', err.message);
|
||||
}
|
||||
@@ -132,6 +142,8 @@ async function createTable(tableName) {
|
||||
latency_source VARCHAR(100),
|
||||
latency_dest VARCHAR(100),
|
||||
latency_target VARCHAR(255),
|
||||
icp_filing VARCHAR(255),
|
||||
ps_filing VARCHAR(255),
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
|
||||
@@ -269,6 +269,8 @@ app.post('/api/setup/init', async (req, res) => {
|
||||
latency_source VARCHAR(100),
|
||||
latency_dest VARCHAR(100),
|
||||
latency_target VARCHAR(255),
|
||||
icp_filing VARCHAR(255),
|
||||
ps_filing VARCHAR(255),
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
`);
|
||||
@@ -412,7 +414,9 @@ const serveIndex = async (req, res) => {
|
||||
blackbox_source_id: null,
|
||||
latency_source: null,
|
||||
latency_dest: null,
|
||||
latency_target: null
|
||||
latency_target: null,
|
||||
icp_filing: null,
|
||||
ps_filing: null
|
||||
};
|
||||
|
||||
if (isDbInitialized) {
|
||||
@@ -564,7 +568,9 @@ app.get('/api/settings', async (req, res) => {
|
||||
blackbox_source_id: null,
|
||||
latency_source: null,
|
||||
latency_dest: null,
|
||||
latency_target: null
|
||||
latency_target: null,
|
||||
icp_filing: null,
|
||||
ps_filing: null
|
||||
});
|
||||
}
|
||||
res.json(rows[0]);
|
||||
@@ -576,11 +582,11 @@ app.get('/api/settings', async (req, res) => {
|
||||
|
||||
// Update site settings
|
||||
app.post('/api/settings', requireAuth, async (req, res) => {
|
||||
const { page_name, title, logo_url, default_theme, show_95_bandwidth, p95_type, blackbox_source_id, latency_source, latency_dest, latency_target } = req.body;
|
||||
const { page_name, title, logo_url, default_theme, show_95_bandwidth, p95_type, blackbox_source_id, latency_source, latency_dest, latency_target, icp_filing, ps_filing } = req.body;
|
||||
try {
|
||||
await db.query(
|
||||
`INSERT INTO site_settings (id, page_name, title, logo_url, default_theme, show_95_bandwidth, p95_type, blackbox_source_id, latency_source, latency_dest, latency_target)
|
||||
VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`INSERT INTO site_settings (id, page_name, title, logo_url, default_theme, show_95_bandwidth, p95_type, blackbox_source_id, latency_source, latency_dest, latency_target, icp_filing, ps_filing)
|
||||
VALUES (1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
page_name = VALUES(page_name),
|
||||
title = VALUES(title),
|
||||
@@ -591,12 +597,15 @@ app.post('/api/settings', requireAuth, async (req, res) => {
|
||||
blackbox_source_id = VALUES(blackbox_source_id),
|
||||
latency_source = VALUES(latency_source),
|
||||
latency_dest = VALUES(latency_dest),
|
||||
latency_target = VALUES(latency_target)`,
|
||||
latency_target = VALUES(latency_target),
|
||||
icp_filing = VALUES(icp_filing),
|
||||
ps_filing = VALUES(ps_filing)`,
|
||||
[
|
||||
page_name, title, logo_url, default_theme,
|
||||
show_95_bandwidth ? 1 : 0, p95_type || 'tx',
|
||||
blackbox_source_id || null, latency_source || null,
|
||||
latency_dest || null, latency_target || null
|
||||
latency_dest || null, latency_target || null,
|
||||
icp_filing || null, ps_filing || null
|
||||
]
|
||||
);
|
||||
res.json({ success: true });
|
||||
|
||||
Reference in New Issue
Block a user