Spaces:
Paused
Paused
Update server.js
Browse files
server.js
CHANGED
|
@@ -536,17 +536,20 @@ app.use(PROXY_TELEGRAM_PATH_PREFIX, createProxyMiddleware({
|
|
| 536 |
}
|
| 537 |
}));
|
| 538 |
|
|
|
|
|
|
|
| 539 |
app.get('/', (req, res) => {
|
| 540 |
const spaceHost = process.env.SPACE_HOST;
|
| 541 |
const baseUrl = req.protocol + '://' + (spaceHost || req.get('host'));
|
| 542 |
-
|
| 543 |
-
const
|
| 544 |
-
const
|
| 545 |
-
const
|
| 546 |
-
const
|
|
|
|
| 547 |
const relativeFilePathWithTokenPlaceholder = `bot${botTokenPlaceholder}/${categoryPlaceholder}/${filenamePlaceholder}`;
|
| 548 |
-
const linkExpiryPlaceholder = "
|
| 549 |
-
const encryptedPayloadPlaceholder = "
|
| 550 |
|
| 551 |
const htmlDoc = `
|
| 552 |
<!DOCTYPE html>
|
|
@@ -672,7 +675,7 @@ app.get('/', (req, res) => {
|
|
| 672 |
|
| 673 |
<h3>3.3. Other File Operations (base path: <code>${baseUrl}/file</code>)</h3>
|
| 674 |
<table>
|
| 675 |
-
<thead><tr><th
|
| 676 |
<tbody>
|
| 677 |
<tr><td>List Bot Files</td><td><code>/list?token=${botTokenPlaceholder}</code></td><td>GET</td><td>JSON list of files and their sizes.</td></tr>
|
| 678 |
<tr><td>Download by ID</td><td><code>/${botTokenPlaceholder}/downloadFile?file_id=${fileIdPlaceholder}</code></td><td>GET</td><td>The file for download.</td></tr>
|
|
@@ -702,6 +705,9 @@ app.get('/', (req, res) => {
|
|
| 702 |
res.send(htmlDoc);
|
| 703 |
});
|
| 704 |
|
|
|
|
|
|
|
|
|
|
| 705 |
app.listen(APP_PORT, () => {
|
| 706 |
console.log(`Main app (Proxy & Tools) listening on port ${APP_PORT}`);
|
| 707 |
console.log(`Telegram Bot API (internal) should be on port ${INTERNAL_TELEGRAM_API_PORT}`);
|
|
|
|
| 536 |
}
|
| 537 |
}));
|
| 538 |
|
| 539 |
+
|
| 540 |
+
|
| 541 |
app.get('/', (req, res) => {
|
| 542 |
const spaceHost = process.env.SPACE_HOST;
|
| 543 |
const baseUrl = req.protocol + '://' + (spaceHost || req.get('host'));
|
| 544 |
+
// Placeholders without angle brackets for better rendering if HTML escaping is tricky
|
| 545 |
+
const botTokenPlaceholder = "YOUR_BOT_TOKEN";
|
| 546 |
+
const fileIdPlaceholder = "FILE_ID";
|
| 547 |
+
const methodPlaceholder = "METHOD_NAME";
|
| 548 |
+
const categoryPlaceholder = "CATEGORY";
|
| 549 |
+
const filenamePlaceholder = "FILENAME";
|
| 550 |
const relativeFilePathWithTokenPlaceholder = `bot${botTokenPlaceholder}/${categoryPlaceholder}/${filenamePlaceholder}`;
|
| 551 |
+
const linkExpiryPlaceholder = "HOURS";
|
| 552 |
+
const encryptedPayloadPlaceholder = "ENCRYPTED_PAYLOAD";
|
| 553 |
|
| 554 |
const htmlDoc = `
|
| 555 |
<!DOCTYPE html>
|
|
|
|
| 675 |
|
| 676 |
<h3>3.3. Other File Operations (base path: <code>${baseUrl}/file</code>)</h3>
|
| 677 |
<table>
|
| 678 |
+
<thead><tr><th>Operation</th><th>URL</th><th>Method</th><th>Description</th></tr></thead>
|
| 679 |
<tbody>
|
| 680 |
<tr><td>List Bot Files</td><td><code>/list?token=${botTokenPlaceholder}</code></td><td>GET</td><td>JSON list of files and their sizes.</td></tr>
|
| 681 |
<tr><td>Download by ID</td><td><code>/${botTokenPlaceholder}/downloadFile?file_id=${fileIdPlaceholder}</code></td><td>GET</td><td>The file for download.</td></tr>
|
|
|
|
| 705 |
res.send(htmlDoc);
|
| 706 |
});
|
| 707 |
|
| 708 |
+
|
| 709 |
+
|
| 710 |
+
|
| 711 |
app.listen(APP_PORT, () => {
|
| 712 |
console.log(`Main app (Proxy & Tools) listening on port ${APP_PORT}`);
|
| 713 |
console.log(`Telegram Bot API (internal) should be on port ${INTERNAL_TELEGRAM_API_PORT}`);
|