mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
Merge branch 'master' into remove-union
This commit is contained in:
17 files changed
+47
-28
No files matched your search
@@ -151,7 +151,7 @@ export const xss = new FilterXSS({
|
||||
css: cssFilterOptions,
|
||||
safeAttrValue(tag, name, value) {
|
||||
if (name === 'id') return escapeAttrValue(`xss-id-${value}`);
|
||||
if (name === 'class') return value.split(' ').filter((i) => whitelistClasses.includes(i)).join(' ');
|
||||
if (name === 'class') return value.split(' ').filter((i) => whitelistClasses.includes(i) || i.startsWith('language-')).join(' ');
|
||||
return safeAttrValue(tag, name, value, CssFilter);
|
||||
},
|
||||
});
|
||||
|
||||
@@ -157,6 +157,14 @@ env.addGlobal('set', (obj, key, val) => {
|
||||
env.addGlobal('findSubModule', (prefix) => Object.keys(global.Hydro.ui.template).filter((n) => n.startsWith(prefix)));
|
||||
env.addGlobal('templateExists', (name) => !!global.Hydro.ui.template[name]);
|
||||
|
||||
const platformIconMap = { 'mac os': 'mac' };
|
||||
const supportedPlatformIcons = ['android', 'chromeos', 'ios', 'linux', 'mac', 'mobile', 'windows'];
|
||||
env.addGlobal('platformIcon', (platform) => {
|
||||
const key = platformIconMap[platform?.toLowerCase()] || platform?.toLowerCase();
|
||||
if (supportedPlatformIcons.includes(key)) return key;
|
||||
return 'unknown';
|
||||
});
|
||||
|
||||
const render = (name: string, state: any) => new Promise<string>((resolve, reject) => {
|
||||
env.render(name, {
|
||||
page_name: name.split('.')[0],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.54.3",
|
||||
"version": "4.54.4",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "index.ts",
|
||||
|
||||
@@ -13,7 +13,7 @@ export default new NamedPage('record_detail', async () => {
|
||||
$(document).on('click', '.subtask-case', function () {
|
||||
const text = $(this).find('.message').text();
|
||||
const data = $(this).find('.message').html();
|
||||
if (!text?.trim()) return;
|
||||
if (!text?.trim() || (!text.includes('\n') && text.length < 20)) return;
|
||||
new InfoDialog({
|
||||
$body: tpl(<pre dangerouslySetInnerHTML={{ __html: data }} />),
|
||||
}).open();
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
<li class="sessionlist__item">
|
||||
<div class="media">
|
||||
<div class="media__left medium">
|
||||
<span class="sessionlist__icon icon icon-platform--{{ icon(session.updateUa.os) }}"></span>
|
||||
<span class="sessionlist__icon icon icon-platform--{{ platformIcon(session.updateUaInfo.os.name) }}"></span>
|
||||
</div>
|
||||
<div class="media__body medium typo">
|
||||
<p>{{ _('Last Update At') }}: {{ datetimeSpan(session.updateAt)|safe }}</p>
|
||||
@@ -161,8 +161,8 @@
|
||||
<p>{{ _('Hostname') }}: {{ session.createHost }}</p>
|
||||
{% endif %}
|
||||
<p>{{ _('Location') }}: {{ _(session.updateGeoip.display) }} ({{ session.updateIp }})</p>
|
||||
<p>{{ _('Operating System') }}: {{ session.updateUa.os }}</p>
|
||||
<p>{{ _('Browser') }}: {{ session.updateUa.name }} {{ session.updateUa.version }}</p>
|
||||
<p>{{ _('Operating System') }}: {{ session.updateUaInfo.os.name }} {{ session.updateUaInfo.os.version }}</p>
|
||||
<p>{{ _('Browser') }}: {{ session.updateUaInfo.browser.name }} {{ session.updateUaInfo.browser.version }}</p>
|
||||
{% if session.isCurrent %}
|
||||
<p class="sessionlist__current-session"><span class="icon icon-check"></span> {{ _('This is the current session') }}</p>
|
||||
{% endif %}
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
<div class="dialog dialog--signin" style="display:none">
|
||||
<div class="dialog__content">
|
||||
{% if model.system.get('server.login') %}
|
||||
{% if model.system.get('server.login') and handler.user.hasPriv(PRIV.PRIV_REGISTER_USER) %}
|
||||
<div class="dialog--signin__bg">
|
||||
<div class="dialog--signin__side">
|
||||
<h1>{{ _("Don't have an account?") }}</h1>
|
||||
<p>{{ _('By signing up a {0} universal account, you can submit code and join discussions in all online judging services provided by us.').format((handler.domain|default({ui:[]})).ui.name|default(model.system.get('server.name'))) }}</p>
|
||||
{% if handler.user.hasPriv(PRIV.PRIV_REGISTER_USER) %}
|
||||
<div><a href="{{ url('user_register') }}" class="inverse rounded button">{{ _('Sign Up Now') }}</a></div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
Reference in new issue
Block a user