mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-03 18:48:12 +08:00
feat: dynamical config
This commit is contained in:
40
lib/pkg.js
40
lib/pkg.js
@@ -1,21 +1,25 @@
|
||||
const app = require('./app');
|
||||
const config = require('./config');
|
||||
|
||||
const pkg = (path) =>
|
||||
new Promise((resolve) => {
|
||||
app.callback()(
|
||||
{
|
||||
url: path,
|
||||
method: 'GET',
|
||||
headers: {},
|
||||
socket: {},
|
||||
},
|
||||
{
|
||||
setHeader: () => {},
|
||||
end: (data) => {
|
||||
resolve(data);
|
||||
module.exports = {
|
||||
setConfig: (conf) => {
|
||||
config.set(conf);
|
||||
},
|
||||
request: (path) =>
|
||||
new Promise((resolve) => {
|
||||
app.callback()(
|
||||
{
|
||||
url: path,
|
||||
method: 'GET',
|
||||
headers: {},
|
||||
socket: {},
|
||||
},
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
module.exports = pkg;
|
||||
{
|
||||
setHeader: () => {},
|
||||
end: (data) => {
|
||||
resolve(data);
|
||||
},
|
||||
}
|
||||
);
|
||||
}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user