|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const http = require('http');
|
|
|
|
|
|
const PORT = 7860;
|
|
|
|
|
|
|
|
|
const server = http.createServer((req, res) => {
|
|
|
console.log(`Request received: ${req.method} ${req.url}`);
|
|
|
|
|
|
|
|
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
|
|
|
|
|
|
|
if (req.method === 'OPTIONS') {
|
|
|
res.writeHead(204);
|
|
|
res.end();
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (req.url === '/health' || req.url === '/') {
|
|
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
|
res.end(JSON.stringify({
|
|
|
status: 'ok',
|
|
|
message: 'Stremio proxy-only mode is running',
|
|
|
timestamp: new Date().toISOString()
|
|
|
}));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (req.url.startsWith('/manifest.json')) {
|
|
|
|
|
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
|
res.end(JSON.stringify({
|
|
|
id: 'org.stremio.minimal',
|
|
|
version: '1.0.0',
|
|
|
name: 'Stremio Minimal Proxy',
|
|
|
description: 'Minimal Stremio server for Hugging Face Spaces testing',
|
|
|
resources: ['catalog', 'meta', 'stream'],
|
|
|
types: ['movie', 'series'],
|
|
|
catalogs: []
|
|
|
}));
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
|
res.end(JSON.stringify({
|
|
|
status: 'ok',
|
|
|
message: 'Stremio proxy-only mode',
|
|
|
endpoint: req.url,
|
|
|
info: 'This is a fallback mode that mimics Stremio endpoints for testing'
|
|
|
}));
|
|
|
});
|
|
|
|
|
|
|
|
|
server.listen(PORT, () => {
|
|
|
console.log(`===== Stremio Proxy-Only Mode =====`);
|
|
|
console.log(`Server running on port ${PORT}`);
|
|
|
console.log(`This is a FALLBACK server that doesn't provide real Stremio functionality`);
|
|
|
console.log(`Use it only to verify your deployment is working correctly`);
|
|
|
}); |