Fix js/css path (paste)

Fix collapse layout animation (web)

Signed-off-by: Joe Ma <rikkaneko23@gmail.com>
This commit is contained in:
Joe Ma 2023-03-26 19:22:11 +08:00
parent 576a543703
commit 7e65c403f7
No known key found for this signature in database
GPG key ID: 7A0ECF5F5EDC587F
3 changed files with 23 additions and 7 deletions

View file

@ -23,8 +23,8 @@ import dedent from 'dedent-js';
// Constants
const SERVICE_URL = 'pb.nekoul.com';
const PASTE_INDEX_HTML_URL_v1 = 'https://raw.githubusercontent.com/rikkaneko/paste/main/web/v1/paste.html';
const PASTE_INDEX_HTML_URL = 'https://raw.githubusercontent.com/rikkaneko/paste/main/web/v2/paste.html';
const PASTE_WEB_URL_v1 = 'https://raw.githubusercontent.com/rikkaneko/paste/main/web/v1';
const PASTE_WEB_URL = 'https://raw.githubusercontent.com/rikkaneko/paste/main/web/v2';
const UUID_LENGTH = 4;
export interface Env {
@ -69,7 +69,23 @@ export default {
}
if (path === '/v1' && method == 'GET') {
return await fetch(PASTE_INDEX_HTML_URL_v1, {
return await fetch(PASTE_WEB_URL_v1 + '/paste.html', {
cf: {
cacheEverything: true,
},
}).then(value => {
return new Response(value.body, {
// Add the correct content-type to response header
headers: {
'content-type': 'text/html; charset=UTF-8;',
'cache-control': 'public, max-age=172800',
},
});
});
}
if (/\/(js|css)\/.*$/.test(path) && method == 'GET') {
return await fetch(PASTE_WEB_URL + path, {
cf: {
cacheEverything: true,
},
@ -88,7 +104,7 @@ export default {
switch (method) {
// Fetch the HTML for uploading text/file
case 'GET': {
return await fetch(PASTE_INDEX_HTML_URL, {
return await fetch(PASTE_WEB_URL + '/paste.html', {
cf: {
cacheEverything: true,
},

View file

@ -16,10 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
.card-header .fa {
.card-header .fa-chevron-down {
transition: .3s transform ease-in-out;
}
.card-header .collapsed .fa {
.card-header .collapsed .fa-chevron-down {
transform: rotate(90deg);
}

View file

@ -112,7 +112,7 @@
<div class="card-header mb-3">
<span data-bs-toggle="collapse" data-bs-target="#advanced_settings_layout" aria-expanded="false"
aria-controls="advanced_settings_layout" id="advanced_settings_control"
class="d-block">
class="d-block collapsed">
<i class="fa fa-chevron-down pull-right mt-1"></i>
Advanced Settings
</span>