代码拉取完成,页面将自动刷新
同步操作将从 doramart/Pandora 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
const path = require('path');
var Cache = require('js-cache');
class AppBootHook {
constructor(app) {
this.app = app;
}
beforeStart() {
this.app.runSchedule('backup_data');
}
configWillLoad() {
this.app.loader.loadFile(path.join(this.app.config.baseDir, 'app/bootstrap/index.js'));
const ctx = this.app.createAnonymousContext();
this.app.nunjucks.addExtension('remote', new remote(ctx));
this.app.nunjucks.addExtension('HeaderExtension', new HeaderExtension(ctx));
this.app.nunjucks.addExtension('AssetsExtension', new AssetsExtension(ctx));
this.app.nunjucks.addExtension('PluginsExtension', new PluginsExtension(ctx));
this.app.nunjucks.addExtension('recommend', new recommend(ctx));
this.app.nunjucks.addExtension('hot', new hot(ctx));
this.app.nunjucks.addExtension('news', new news(ctx));
this.app.nunjucks.addExtension('random', new random(ctx));
this.app.nunjucks.addExtension('near_post', new near_post(ctx));
this.app.nunjucks.addExtension('tags', new tags(ctx));
this.app.nunjucks.addExtension('hottags', new hottags(ctx));
this.app.nunjucks.addExtension('ads', new ads(ctx));
this.app.nunjucks.addExtension('navtree', new navtree(ctx));
this.app.nunjucks.addExtension('childnav', new childnav(ctx));
}
async didLoad() {
}
async willReady() {
// 请将你的应用项目中 app.beforeStart 中的代码置于此处。
}
async didReady() {
let _theApp = this.app;
_theApp.cache = new Cache();
_theApp.messenger.on('refreshCache', by => {
_theApp.logger.info('start update by %s', by);
const ctx = _theApp.createAnonymousContext();
ctx.runInBackground(async () => {
let {
key,
value,
time
} = by;
_theApp.cache.set(key, value, time);
});
});
// 应用初始化
let thisCtx = this.app.createAnonymousContext();
this.app.init(thisCtx);
}
}
module.exports = AppBootHook;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。