mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix preview namespace conflict
This commit is contained in:
1 parent
dc13760852
commit
500e08abac
3 files changed
+6
-5
No files matched your search
@@ -121,7 +121,8 @@ class UserLoginHandler extends Handler {
|
|||||||
if (!udoc) udoc = await user.getByUname(domainId, uname);
|
if (!udoc) udoc = await user.getByUname(domainId, uname);
|
||||||
if (!udoc) throw new UserNotFoundError(uname);
|
if (!udoc) throw new UserNotFoundError(uname);
|
||||||
await Promise.all([
|
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 }),
|
oplog.log(this, 'user.login', { redirect }),
|
||||||
]);
|
]);
|
||||||
if (udoc._tfa && !verifyToken(udoc._tfa, tfa)) throw new InvalidTokenError('2FA token invalid.');
|
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 request from 'vj/utils/request';
|
||||||
import tpl from 'vj/utils/tpl';
|
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 { default: Editor } = await import('vj/components/editor/index');
|
||||||
const promise = new ActionDialog({
|
const promise = new ActionDialog({
|
||||||
$body: tpl`
|
$body: tpl`
|
||||||
@@ -32,7 +32,7 @@ async function startEdit(filename, value) {
|
|||||||
autoResize: false,
|
autoResize: false,
|
||||||
autoLayout: false,
|
autoLayout: false,
|
||||||
language: (language as string),
|
language: (language as string),
|
||||||
model: `hydro://problem/file/${filename}`,
|
model: `hydro://problem/${fileCategory}/${filename}`,
|
||||||
});
|
});
|
||||||
const action = await promise;
|
const action = await promise;
|
||||||
value = (editor.value() as string).replace(/\r\n/g, '\n');
|
value = (editor.value() as string).replace(/\r\n/g, '\n');
|
||||||
@@ -143,7 +143,7 @@ export async function previewFile(ev, type = '') {
|
|||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
} else Notification.info(i18n('Loading editor...'));
|
} 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;
|
if (typeof val !== 'string') return null;
|
||||||
Notification.info(i18n('Saving file...'));
|
Notification.info(i18n('Saving file...'));
|
||||||
const data = new FormData();
|
const data = new FormData();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.42.2",
|
"version": "4.42.3",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
|
|||||||
Reference in new issue
Block a user