diff --git a/build/index.js b/build/index.js index 2ece9623f..60d97369d 100644 --- a/build/index.js +++ b/build/index.js @@ -4,7 +4,6 @@ const ignoreFailure = require('./ignoreFailure'); async function build(type) { if (!['development', 'production'].includes(type)) throw new Error(`Unknown type: ${type}`); - ignoreFailure(fs.mkdirSync, root('.cache')); ignoreFailure(fs.mkdirSync, root('.build')); await require('./locales')(type); await require('./buildModule')(type); diff --git a/hydro/lib/axios.js b/hydro/lib/axios.js index 1714e373d..c3c65b353 100644 --- a/hydro/lib/axios.js +++ b/hydro/lib/axios.js @@ -20,4 +20,4 @@ async function post(url, data, options) { return res; } -global.Hydro['lib.axios'] = module.exports = { get, post }; +global.Hydro.lib.axios = module.exports = { get, post }; diff --git a/hydro/lib/download.js b/hydro/lib/download.js index 23dd26d3f..033ec1b3c 100644 --- a/hydro/lib/download.js +++ b/hydro/lib/download.js @@ -20,4 +20,4 @@ async function download(url, path, retry = 3) { return r; } -global.Hydro['lib.download'] = module.exports = download; +global.Hydro.lib.download = module.exports = download; diff --git a/module/module-pastebin/handler.js b/module/module-pastebin/handler.js index a6c838ea2..36205fb07 100644 --- a/module/module-pastebin/handler.js +++ b/module/module-pastebin/handler.js @@ -6,7 +6,12 @@ const { nav } = global.Hydro.lib; class PasteShowHandler extends Handler { async get({ docId }) { const doc = await pastebin.get(docId); - this.response.body = { doc }; + const path = [ + ['Hydro', '/'], + ['paste_show', null], + [doc.title, null, true], + ]; + this.response.body = { path, doc }; this.response.template = 'paste_show.html'; } } @@ -17,6 +22,11 @@ class PasteCreateHandler extends Handler { } async get() { + const path = [ + ['Hydro', '/'], + ['paste_create', null], + ]; + this.response.body = { path }; this.response.template = 'paste_create.html'; } diff --git a/module/module-pastebin/locale/en.yaml b/module/module-pastebin/locale/en.yaml new file mode 100644 index 000000000..f26525ef6 --- /dev/null +++ b/module/module-pastebin/locale/en.yaml @@ -0,0 +1,2 @@ +paste_create: Create a paste +paste_show: Read a paste diff --git a/module/module-pastebin/locale/zh_CN.yaml b/module/module-pastebin/locale/zh_CN.yaml index bbf1830ef..353817be6 100644 --- a/module/module-pastebin/locale/zh_CN.yaml +++ b/module/module-pastebin/locale/zh_CN.yaml @@ -1 +1,3 @@ -pastebin: 剪贴板 \ No newline at end of file +pastebin: 剪贴板 +paste_create: 创建新内容 +paste_show: 查看内容 diff --git a/module/problem-import-syzoj/handler.js b/module/problem-import-syzoj/handler.js index 46e1c65cd..4e67112f8 100644 --- a/module/problem-import-syzoj/handler.js +++ b/module/problem-import-syzoj/handler.js @@ -1,7 +1,7 @@ const assert = require('assert'); -const download = global.Hydro['lib.download']; -const axios = global.Hydro['lib.axios']; +const { download } = global.Hydro.lib; +const { axios } = global.Hydro.lib; const { ValidationError, RemoteOnlineJudgeError } = global.Hydro.error; async function syzoj(url) { diff --git a/templates/partials/path.html b/templates/partials/path.html index d6b57b449..d3ee93d6c 100644 --- a/templates/partials/path.html +++ b/templates/partials/path.html @@ -5,7 +5,7 @@