mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-10-09 12:04:07 +00:00
feat(image_hosting): remove get_image wrapper
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
78d8418c27
commit
d3082fd9d9
@ -16,6 +16,20 @@ DirectorySlash Off
|
||||
|
||||
DirectoryIndex
|
||||
|
||||
<filesMatch "\.(ico|gif|jpg|png)$">
|
||||
ExpiresActive On
|
||||
ExpiresDefault "access plus 6 month"
|
||||
Header append Cache-Control "public"
|
||||
</filesMatch>
|
||||
|
||||
<filesMatch "\.(css|js)$">
|
||||
ExpiresActive On
|
||||
ExpiresDefault "access plus 1 week"
|
||||
Header append Cache-Control "public"
|
||||
</filesMatch>
|
||||
|
||||
RequestHeader append X-Author "Baoshuo ( https://baoshuo.ren )"
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
RewriteCond %{QUERY_STRING} ^$
|
||||
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!Auth::check()) {
|
||||
become403Page(UOJLocale::get('need login'));
|
||||
}
|
||||
|
||||
$name = $_GET['image_name'];
|
||||
if (!validateString($name)) {
|
||||
become404Page();
|
||||
}
|
||||
|
||||
$file_name = UOJContext::storagePath() . "/image_hosting/$name.png";
|
||||
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
$mimetype = finfo_file($finfo, $file_name);
|
||||
if ($mimetype === false) {
|
||||
become404Page();
|
||||
}
|
||||
finfo_close($finfo);
|
||||
|
||||
header("X-Sendfile: $file_name");
|
||||
header("Content-type: $mimetype");
|
||||
header("Cache-Control: max-age=604800", true);
|
@ -412,7 +412,7 @@ $pag = new Paginator($pag_config);
|
||||
<?php foreach ($pag->get() as $idx => $row) : ?>
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<img src="<?= $row['path'] ?>" class="card-img-top" height="200" style="object-fit: contain">
|
||||
<img src="<?= $row['path'] ?>" class="card-img-top" height="200" style="object-fit: contain" loading="lazy" decoding="async">
|
||||
<div class="card-footer bg-transparent small px-2">
|
||||
<div class="d-flex flex-wrap justify-content-between">
|
||||
<time><?= $row['upload_time'] ?></time>
|
||||
@ -470,10 +470,6 @@ $pag = new Paginator($pag_config);
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
|
||||
});
|
||||
|
||||
var copy_url_toast = new bootstrap.Toast('#copy-url-toast', {
|
||||
delay: 2000
|
||||
});
|
@ -324,8 +324,8 @@ $solution_view_type_form->runAtServer();
|
||||
<h2 class="h3 card-title">提示</h2>
|
||||
<ol>
|
||||
<li>请勿引用不稳定的外部资源(如来自个人服务器的图片或文档等),以便备份及后期维护;</li>
|
||||
<li>请勿在题面中直接插入大段 HTML 代码,这可能会破坏页面的显示,可以考虑使用 <a class="text-decoration-none" href="/html2markdown" target="_blank">转换工具</a> 转换后再作修正;</li>
|
||||
<li>图片上传推荐使用 <a class="text-decoration-none" href="/image_hosting" target="_blank">S2OJ 图床</a>,以免后续产生外链图片大量失效的情况。</li>
|
||||
<li>请勿在题面中直接插入大段 HTML 代码,这可能会破坏页面的显示,可以考虑使用 <a class="text-decoration-none" href="/apps/html2markdown" target="_blank">转换工具</a> 转换后再作修正;</li>
|
||||
<li>图片上传推荐使用 <a class="text-decoration-none" href="/apps/image_hosting" target="_blank">S2OJ 图床</a>,以免后续产生外链图片大量失效的情况。</li>
|
||||
</ol>
|
||||
<p class="card-text">
|
||||
更多内容请查看 S2OJ 用户手册中的「<a class="text-decoration-none" href="https://s2oj.github.io/#/manage/problem?id=%e4%bc%a0%e9%a2%98%e6%8c%87%e5%bc%95">传题指引</a>」部分。
|
||||
|
@ -107,8 +107,8 @@ $blog_editor->runAtServer();
|
||||
<ol>
|
||||
<li>题解发布后还需要返回对应题目的题解页面 <b>手动输入博客 ID</b> 来将本文添加到题目的题解列表中(博客 ID 可以在右上角找到);</li>
|
||||
<li>请勿引用不稳定的外部资源(如来自个人服务器的图片或文档等),以便备份及后期维护;</li>
|
||||
<li>请勿在博文中直接插入大段 HTML 代码,这可能会破坏页面的显示,可以考虑使用 <a class="text-decoration-none" href="/html2markdown" target="_blank">转换工具</a> 转换后再作修正;</li>
|
||||
<li>图片上传推荐使用 <a class="text-decoration-none" href="/image_hosting" target="_blank">S2OJ 图床</a>,以免后续产生外链图片大量失效的情况。</li>
|
||||
<li>请勿在博文中直接插入大段 HTML 代码,这可能会破坏页面的显示,可以考虑使用 <a class="text-decoration-none" href="/apps/html2markdown" target="_blank">转换工具</a> 转换后再作修正;</li>
|
||||
<li>图片上传推荐使用 <a class="text-decoration-none" href="/apps/image_hosting" target="_blank">S2OJ 图床</a>,以免后续产生外链图片大量失效的情况。</li>
|
||||
</ol>
|
||||
<p class="card-text">
|
||||
帮助:<a class="text-decoration-none" href="http://uoj.ac/blog/7">UOJ 博客使用教程</a>。
|
||||
|
@ -91,9 +91,8 @@ Route::group(
|
||||
Route::any('/click-zan', '/click_zan.php');
|
||||
|
||||
// Apps
|
||||
Route::any('/image_hosting', '/app/image_hosting/index.php');
|
||||
Route::get('/image_hosting/{image_name}.png', '/app/image_hosting/get_image.php');
|
||||
Route::any('/html2markdown', '/app/html2markdown.php');
|
||||
Route::any('/apps/image_hosting', '/apps/image_hosting.php');
|
||||
Route::any('/apps/html2markdown', '/apps/html2markdown.php');
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -111,13 +111,13 @@ mb-4" role="navigation">
|
||||
</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<a class="dropdown-item" href="<?= HTML::url('/image_hosting') ?>">
|
||||
<a class="dropdown-item" href="<?= HTML::url('/apps/image_hosting') ?>">
|
||||
<i class="bi bi-images"></i>
|
||||
<?= UOJLocale::get('image hosting') ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="dropdown-item" href="<?= HTML::url('/html2markdown') ?>">
|
||||
<a class="dropdown-item" href="<?= HTML::url('/apps/html2markdown') ?>">
|
||||
<i class="bi bi-markdown"></i>
|
||||
<?= UOJLocale::get('html to markdown') ?>
|
||||
</a>
|
||||
|
@ -44,7 +44,7 @@ if (!isset($ShowPageHeader)) {
|
||||
<title><?= isset($PageTitle) ? $PageTitle : UOJConfig::$data['profile']['oj-name-short'] ?> - <?= $PageMainTitle ?></title>
|
||||
|
||||
<script type="text/javascript">
|
||||
uojHome = ''; // '<?= HTML::url('/') ?>'
|
||||
uojHome = ''; // '<?= HTML::url('/') ?>';
|
||||
</script>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
|
||||
@ -270,7 +270,7 @@ if (!isset($ShowPageHeader)) {
|
||||
});
|
||||
</script>
|
||||
|
||||
<script defer data-domain="sjzezoj.com" src="https://stat.u.sb/js/script.js"></script>
|
||||
<script async data-domain="sjzezoj.com" src="https://stat.u.sb/js/script.js"></script>
|
||||
</head>
|
||||
|
||||
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
|
||||
|
1
web/image_hosting
Symbolic link
1
web/image_hosting
Symbolic link
@ -0,0 +1 @@
|
||||
app/storage/image_hosting
|
@ -49,7 +49,7 @@ setLAMPConf(){
|
||||
UOJEOF
|
||||
#Enable modules and make UOJ site conf enabled
|
||||
a2ensite 000-uoj.conf && a2dissite 000-default.conf
|
||||
a2enmod rewrite headers && sed -i -e '172s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
||||
a2enmod rewrite headers expires && sed -i -e '172s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
|
||||
#Create UOJ session save dir and make PHP extensions available
|
||||
mkdir --mode=733 /var/lib/php/uoj_sessions && chmod +t /var/lib/php/uoj_sessions
|
||||
sed -i 's|;sys_temp_dir = "/tmp"|sys_temp_dir = "/tmp"|g' /etc/php/7.4/apache2/php.ini
|
||||
|
Loading…
Reference in New Issue
Block a user