Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e9f0ac648 |
+1
-1
@@ -5,7 +5,7 @@ services:
|
||||
build:
|
||||
context: .
|
||||
args:
|
||||
VERSION: v2026.08.26-r6
|
||||
VERSION: v2026.08.27-r7
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:8083:8080"
|
||||
|
||||
+18
@@ -5,6 +5,16 @@ const results = document.querySelector('#results');
|
||||
const modeNote = document.querySelector('#mode-note');
|
||||
const localDownloads = document.querySelector('#local-downloads');
|
||||
const lyricCache = new Map();
|
||||
let publicMode = false;
|
||||
|
||||
const downloadEvents = {
|
||||
lrc: 'original-lrc',
|
||||
txt: 'original-txt',
|
||||
transLRC: 'translation-lrc',
|
||||
transTXT: 'translation-txt',
|
||||
romaLRC: 'sound-lrc',
|
||||
romaTXT: 'sound-txt'
|
||||
};
|
||||
|
||||
function text(value) { return document.createTextNode(value ?? ''); }
|
||||
function hasText(value) { return typeof value === 'string' && value.trim().length > 0; }
|
||||
@@ -26,6 +36,7 @@ async function loadInfo() {
|
||||
if (info.mode === 'local') {
|
||||
modeNote.textContent = '本机模式:查询从这台电脑直接发出,不经过 lrc.flechazo.xin。';
|
||||
} else {
|
||||
publicMode = true;
|
||||
modeNote.textContent = '网页模式:查询由本站后端转发,但不会写入数据库或日志正文。下载文件在浏览器中生成。';
|
||||
localDownloads.hidden = false;
|
||||
}
|
||||
@@ -46,6 +57,12 @@ function download(name, body, type = 'text/plain;charset=utf-8') {
|
||||
setTimeout(() => URL.revokeObjectURL(url), 1500);
|
||||
}
|
||||
|
||||
function recordDownload(kind) {
|
||||
const event = downloadEvents[kind];
|
||||
if (!publicMode || !event) return;
|
||||
fetch(`/api/events/download/${event}`, {method: 'POST', keepalive: true}).catch(() => {});
|
||||
}
|
||||
|
||||
function parseLRC(lrc) {
|
||||
const lines = [];
|
||||
for (const raw of (lrc || '').split(/\r?\n/)) {
|
||||
@@ -129,6 +146,7 @@ function saveLyrics(song, data, kind) {
|
||||
const selected = variants[kind];
|
||||
if (!selected || !hasText(selected[1])) throw new Error('这首歌没有对应歌词');
|
||||
download(selected[0], selected[1]);
|
||||
recordDownload(kind);
|
||||
}
|
||||
|
||||
function populatePreview(select, output, data) {
|
||||
|
||||
Reference in New Issue
Block a user