ui: 修复 og:url 泄漏源站ip的问题

This commit is contained in:
undefined committed 2021-05-18 12:28:02 +08:00
1 parent 6c3f01aa47
commit 4052fa691e
4 files changed
+12 -8

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.8.24",
"version": "4.8.25",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
@@ -198,6 +198,7 @@ const page = new NamedPage('problem_files', () => {
let content = '';
if (ev) {
const link = $(ev.currentTarget).find('a').attr('href');
if (!link) return;
if (filesize > 8 * 1024 * 1024) Notification.error(i18n('file too large'));
Notification.info(i18n('Loading file...'));
const res = await request.get(link);
@@ -217,6 +218,7 @@ const page = new NamedPage('problem_files', () => {
await pjax.request({ push: false });
}
if ($('[name="remove_selected_testdata"]').length) {
$('.problem-files-testdata .col--name').on('click', (ev) => handleEdit('testdata', ev));
$('.problem-files-additional_file .col--name').on('click', (ev) => handleEdit('additional_file', ev));
$('.problem-files-testdata').on('dragover', (ev) => handleDragOver('testdata', ev));
@@ -224,13 +226,14 @@ const page = new NamedPage('problem_files', () => {
$('.problem-files-testdata').on('drop', (ev) => handleDrop('testdata', ev));
$('.problem-files-additional_file').on('drop', (ev) => handleDrop('additional_file', ev));
$('[name="upload_testdata"]').on('click', () => handleClickUpload('testdata'));
$('[name="create_testdata"]').on('click', () => handleEdit('testdata'));
$('[name="download_selected_testdata"]').on('click', () => handleClickDownloadSelected('testdata'));
$('[name="remove_selected_testdata"]').on('click', () => handleClickRemoveSelected('testdata'));
$('[name="upload_file"]').on('click', () => handleClickUpload('additional_file'));
$('[name="create_testdata"]').on('click', () => handleEdit('testdata'));
$('[name="create_file"]').on('click', () => handleEdit('additional_file'));
$('[name="download_selected_file"]').on('click', () => handleClickDownloadSelected('additional_file'));
$('[name="remove_selected_testdata"]').on('click', () => handleClickRemoveSelected('testdata'));
$('[name="remove_selected_file"]').on('click', () => handleClickRemoveSelected('additional_file'));
}
$('[name="download_selected_testdata"]').on('click', () => handleClickDownloadSelected('testdata'));
$('[name="download_selected_file"]').on('click', () => handleClickDownloadSelected('additional_file'));
});
export default page;
@@ -23,7 +23,7 @@
{% block ogp %}
<meta property="og:site_name" content="{{ model.system.get('server.name') }}" />
<meta property="og:title" content="{{ handler.renderTitle(page_name) }}" />
<meta property="og:url" content="{{ handler.ctx.request.href }}" />
<meta property="og:url" content="{{ model.system.get('server.url') }}{{ handler.ctx.request.path }}" />
<meta property="og:image" content="{{ static_url('favicon-96x96.png') }}" />
{% endblock %}
{% if not isIE(handler.request.headers['user-agent']) %}
@@ -40,7 +40,6 @@
{% endif %}
</head>
<body>
{{ handler.request.headers.hmr|default('')|safe }}
{% block body %}{% endblock %}
{% if not isIE(handler.request.headers['user-agent']) %}
<script>
@@ -14,11 +14,13 @@
</div>
{{ noscript_note.render() }}
{% include "partials/problem_files-testdata.html" %}
{% if handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA) or handler.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA) %}
{% if testdata.length %}
<div class="section__body">
<button class="rounded button" name="download_selected_testdata">{{ _('Download Selected') }}</button>
{% if handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<button class="rounded button" name="remove_selected_testdata">{{ _('Remove Selected') }}</button>
{% endif %}
</div>
{% endif %}
{% endif %}