ui: fix preview namespace conflict

This commit is contained in:
undefined committed 2022-10-20 11:40:19 +08:00
1 parent dc13760852
commit 500e08abac
3 files changed
+6 -5

No files matched your search

+2 -1
View File
@@ -121,7 +121,8 @@ class UserLoginHandler extends Handler {
if (!udoc) udoc = await user.getByUname(domainId, uname);
if (!udoc) throw new UserNotFoundError(uname);
await Promise.all([
this.limitRate('user_login', 60, 5),
this.limitRate('user_login', 60, 30),
this.limitRate(`user_login_${uname}`, 60, 5),
oplog.log(this, 'user.login', { redirect }),
]);
if (udoc._tfa && !verifyToken(udoc._tfa, tfa)) throw new InvalidTokenError('2FA token invalid.');
@@ -9,7 +9,7 @@ import pjax from 'vj/utils/pjax';
import request from 'vj/utils/request';
import tpl from 'vj/utils/tpl';
async function startEdit(filename, value) {
async function startEdit(filename, value, fileCategory = 'file') {
const { default: Editor } = await import('vj/components/editor/index');
const promise = new ActionDialog({
$body: tpl`
@@ -32,7 +32,7 @@ async function startEdit(filename, value) {
autoResize: false,
autoLayout: false,
language: (language as string),
model: `hydro://problem/file/${filename}`,
model: `hydro://problem/${fileCategory}/${filename}`,
});
const action = await promise;
value = (editor.value() as string).replace(/\r\n/g, '\n');
@@ -143,7 +143,7 @@ export async function previewFile(ev, type = '') {
throw e;
}
} else Notification.info(i18n('Loading editor...'));
const val = await startEdit(filename, content);
const val = await startEdit(filename, content, type || 'file');
if (typeof val !== 'string') return null;
Notification.info(i18n('Saving file...'));
const data = new FormData();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.42.2",
"version": "4.42.3",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "index.ts",