mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: add browser warning for superadmin
This commit is contained in:
1 parent
05f47e5515
commit
6acd1fed9f
4 files changed
+37
-10
No files matched your search
@@ -0,0 +1,28 @@
|
|||||||
|
import { AutoloadPage } from 'vj/misc/Page';
|
||||||
|
import i18n from 'vj/utils/i18n';
|
||||||
|
import tpl from 'vj/utils/tpl';
|
||||||
|
import { InfoDialog } from './dialog';
|
||||||
|
|
||||||
|
function isSupported() {
|
||||||
|
try {
|
||||||
|
if (!navigator.userAgent.includes('Chrome/')) return false;
|
||||||
|
const ver = +navigator.userAgent.split('Chrome/')[1].split('.')[0];
|
||||||
|
if (!Number.isSafeInteger(ver)) return false;
|
||||||
|
if (ver < 80) return false;
|
||||||
|
return true;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new AutoloadPage('browser-update', () => {
|
||||||
|
if (UserContext.priv !== -1) return; // Only warn superadmins
|
||||||
|
if (sessionStorage.getItem('su-browser-warn')) return;
|
||||||
|
const key = 'warn::admin:unsupportedbrowser';
|
||||||
|
if (!isSupported() && i18n(key) !== key) {
|
||||||
|
new InfoDialog({
|
||||||
|
$body: tpl.typoMsg(i18n(key)),
|
||||||
|
}).open();
|
||||||
|
sessionStorage.setItem('su-browser-warn', 'on');
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -13,7 +13,6 @@ __langname: 简体中文
|
|||||||
'{0}: Permissions': '{0}: 权限'
|
'{0}: Permissions': '{0}: 权限'
|
||||||
'{0}: Roles': '{0}: 角色'
|
'{0}: Roles': '{0}: 角色'
|
||||||
'{0}: Users': '{0}: 用户'
|
'{0}: Users': '{0}: 用户'
|
||||||
"{0}'s blog": "{0} 的博客"
|
|
||||||
'# My Submissions': '我的递交数'
|
'# My Submissions': '我的递交数'
|
||||||
'# Submissions': '递交数'
|
'# Submissions': '递交数'
|
||||||
'↓ # Comments': '↓ 评论数'
|
'↓ # Comments': '↓ 评论数'
|
||||||
@@ -40,6 +39,7 @@ __langname: 简体中文
|
|||||||
'Solved {0} problems, RP: {1} (No. {2})': '解决了 {0} 道题目,RP: {1} (No. {2})'
|
'Solved {0} problems, RP: {1} (No. {2})': '解决了 {0} 道题目,RP: {1} (No. {2})'
|
||||||
'The value `{1}` of {0} already exists.': '{0} 的值 `{1}` 已经存在。'
|
'The value `{1}` of {0} already exists.': '{0} 的值 `{1}` 已经存在。'
|
||||||
'Yes': 是
|
'Yes': 是
|
||||||
|
"{0}'s blog": "{0} 的博客"
|
||||||
"Effects only when Difficulty is not 'Use algorithm calculated'.": 仅当难度不为“使用算法计算”时才起效。
|
"Effects only when Difficulty is not 'Use algorithm calculated'.": 仅当难度不为“使用算法计算”时才起效。
|
||||||
"Split by ', '.": 由“, ”或“,”分隔。
|
"Split by ', '.": 由“, ”或“,”分隔。
|
||||||
"What's file?": 什么是文件?
|
"What's file?": 什么是文件?
|
||||||
@@ -170,8 +170,8 @@ Continue: 继续
|
|||||||
Contributed Problems: 贡献的题目
|
Contributed Problems: 贡献的题目
|
||||||
Contributions: 贡献
|
Contributions: 贡献
|
||||||
Copy Email: 复制电子邮件
|
Copy Email: 复制电子邮件
|
||||||
Copy Link: 复制链接
|
|
||||||
Copy from: 复制自
|
Copy from: 复制自
|
||||||
|
Copy Link: 复制链接
|
||||||
Copy QQ Number: 复制QQ号
|
Copy QQ Number: 复制QQ号
|
||||||
Copy Selected: 复制选中
|
Copy Selected: 复制选中
|
||||||
Copy WeChat Account: 复制微信号
|
Copy WeChat Account: 复制微信号
|
||||||
@@ -595,8 +595,8 @@ Pretest Data: 自测数据
|
|||||||
Pretest Your Code: 使用自定义数据测试
|
Pretest Your Code: 使用自定义数据测试
|
||||||
Pretest: 自测
|
Pretest: 自测
|
||||||
Pretest?: 自测?
|
Pretest?: 自测?
|
||||||
Privilege: 权限
|
|
||||||
Privacy: 隐私
|
Privacy: 隐私
|
||||||
|
Privilege: 权限
|
||||||
Problem {1} not found.: 题目 {1} 不存在。
|
Problem {1} not found.: 题目 {1} 不存在。
|
||||||
Problem Data: 题目数据
|
Problem Data: 题目数据
|
||||||
Problem ID cannot be a pure number. Leave blank if you want to use numberic id.: 题目ID不能为纯数字。 若要自动分配数字ID请将此处留空。
|
Problem ID cannot be a pure number. Leave blank if you want to use numberic id.: 题目ID不能为纯数字。 若要自动分配数字ID请将此处留空。
|
||||||
@@ -872,6 +872,7 @@ User {0} already exists.: 用户 {0} 已存在。
|
|||||||
User {0} not found.: 用户 {0} 不存在。
|
User {0} not found.: 用户 {0} 不存在。
|
||||||
User can join this domain by visiting the following URL: 用户可以访问此链接来加入此域
|
User can join this domain by visiting the following URL: 用户可以访问此链接来加入此域
|
||||||
User ID: 用户 ID
|
User ID: 用户 ID
|
||||||
|
User Privilege: 用户权限
|
||||||
User will no longer be allowed to join the domain after expiration.: 过期后,用户将不能加入此域。
|
User will no longer be allowed to join the domain after expiration.: 过期后,用户将不能加入此域。
|
||||||
user_detail: 用户
|
user_detail: 用户
|
||||||
user_extra_files: 编译额外文件
|
user_extra_files: 编译额外文件
|
||||||
@@ -884,7 +885,6 @@ User-defined role: 用户定义的角色
|
|||||||
User: 用户
|
User: 用户
|
||||||
Username / UID: 用户名或 UID
|
Username / UID: 用户名或 UID
|
||||||
Username: 用户名
|
Username: 用户名
|
||||||
User Privilege: 用户权限
|
|
||||||
Users with those roles will be removed from the domain.: 拥有这些角色的用户将从此域中移除。
|
Users with those roles will be removed from the domain.: 拥有这些角色的用户将从此域中移除。
|
||||||
Users: 用户
|
Users: 用户
|
||||||
Using your {0} universal account: 使用您的 {0} 通用账户
|
Using your {0} universal account: 使用您的 {0} 通用账户
|
||||||
@@ -917,6 +917,7 @@ Visible to registered users: 对注册用户可见
|
|||||||
Visit: 查看
|
Visit: 查看
|
||||||
Vote problem solutions: 为题解投票
|
Vote problem solutions: 为题解投票
|
||||||
Vote: 投票
|
Vote: 投票
|
||||||
|
warn::admin:unsupportedbrowser: "身为超级管理员,您仍在使用过于老旧的浏览器。\n这些浏览器可能不支持 Hydro 管理面板的部分功能,\n我们强烈建议您升级到最新的 Chrome 浏览器。"
|
||||||
We will check code similarity after this contest.: 我们会在赛后检查代码相似度。
|
We will check code similarity after this contest.: 我们会在赛后检查代码相似度。
|
||||||
WeChat Visibility: 微信可见性
|
WeChat Visibility: 微信可见性
|
||||||
WeChat: 微信
|
WeChat: 微信
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.42.6",
|
"version": "4.42.7",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
|
|||||||
@@ -16,11 +16,9 @@ export default function tpl(pieces: TemplateStringsArray, ...substitutions: Subs
|
|||||||
}
|
}
|
||||||
|
|
||||||
tpl.typoMsg = function (msg: string, raw = false) {
|
tpl.typoMsg = function (msg: string, raw = false) {
|
||||||
return tpl`
|
if (raw) return `<div class="typo"><p>${msg}</p></div>`;
|
||||||
<div class="typo">
|
const lines = msg.trim().split('\n');
|
||||||
<p>${raw ? { html: msg, templateRaw: true } : msg}</p>
|
return `<div class="typo">${lines.map((i) => `<p>${_.escape(i)}</p>`).join('\n')}</div>`;
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function rawHtml(html: string) {
|
export function rawHtml(html: string) {
|
||||||
|
|||||||
Reference in new issue
Block a user