mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
测试:从vj4的自动迁移脚本(未完成)
This commit is contained in:
1 parent
cedb427dc9
commit
41125c6929
11 files changed
+185
-24
No files matched your search
@@ -0,0 +1,41 @@
|
||||
const {
|
||||
Route, Connection, Handler, ConnectionHandler,
|
||||
} = global.Hydro.service.server;
|
||||
const { PERM_MANAGE } = global.Hydro.permission;
|
||||
const migrate = global.Hydro.script.migrateVijos;
|
||||
|
||||
class MigrateVijosHandler extends Handler {
|
||||
async prepare() {
|
||||
this.checkPerm(PERM_MANAGE);
|
||||
}
|
||||
|
||||
async get() {
|
||||
const path = [
|
||||
['Hydro', '/'],
|
||||
['migrate_vijos', null],
|
||||
];
|
||||
this.response.body = { path };
|
||||
this.response.template = 'migrate_vijos.html';
|
||||
}
|
||||
}
|
||||
|
||||
class MigrateVijosConnectionHandler extends ConnectionHandler {
|
||||
async prepare() {
|
||||
this.checkPerm(PERM_MANAGE);
|
||||
}
|
||||
|
||||
async message(msg) {
|
||||
if (msg.key === 'start') {
|
||||
migrate(msg, (data) => { this.send(data); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function apply() {
|
||||
Route('/migrate/vijos', module.exports.MigrateVijosHandler);
|
||||
Connection('/migrate/vijos-conn', module.exports.MigrateVijosConnectionHandler);
|
||||
}
|
||||
|
||||
global.Hydro.handler.pastebin = module.exports = {
|
||||
MigrateVijosHandler, MigrateVijosConnectionHandler, apply,
|
||||
};
|
||||
Reference in new issue
Block a user