Skip to content

Commit

Permalink
苏公堤翻新归来!新增无损下载
Browse files Browse the repository at this point in the history
  • Loading branch information
qinlili23333 committed Jun 17, 2022
1 parent 4ca5ed4 commit 5d8de09
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
14 changes: 14 additions & 0 deletions audioInfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,20 @@
"source_quality": "AAC320",
"release_date": "2022-02-12"
},
{
"name": "苏公堤",
"url": {
"yuketang": "https://bj.bcebos.com/yunpanx/%E8%8B%8F%E5%85%AC%E5%A0%A4_20220617110634_6120.ogg",
"cloudflare": "https://cdn-cf.545.qinlili.bid/%E7%BA%AF%E4%BA%AB/%E8%8B%8F%E5%85%AC%E5%A0%A4V2.ogg"
},
"cover": "https://i0.hdslb.com/bfs/archive/[email protected]",
"quality": "OPUS256",
"full_title": "切歌:樱乃笙曦&孙小花|优化:琴梨梨[Hi-Res]",
"origin": "https://www.bilibili.com/video/BV1wq4y187FK",
"source_quality": "AAC320",
"release_date": "2022-02-11",
"hi_res_id": "8067059-598594023-9780a1"
},
{
"name": "九张机",
"url": {
Expand Down
42 changes: 42 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,48 @@ <H3>去全部歌单里添加一些吧</H3>
setStatus("下载" + songInfo.name + "成功", false);
});
menuList.appendChild(dlMenu);
if (songInfo.hi_res_id) {
let dlHiMenu = makeMenu("下载Hi-Res FLAC", "./img/download.svg");
dlHiMenu.addEventListener("click", async () => {
if (!window.ctfile) {
setStatus("加载城通网盘解析模块", true);
await loadScriptAsync("https://ctfile.qinlili.bid/ctget.js");
}
setStatus("获取下载地址", true);
let fileInfo = await window.ctfile.getByID(songInfo.hi_res_id, "547873715");
if (fileInfo.success) {
let xhr = new XMLHttpRequest();
xhr.responseType = "blob";
xhr.onprogress = event => {
if (event.loaded && event.total) {
var percent = String(Number(event.loaded) / Number(event.total) * 100).substring(0, 4);
setStatus("正在下载" + songInfo.name + percent + "%", true);
}
};
xhr.onload = event => {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
setStatus("正在写出" + songInfo.name, true);
let a = document.createElement('a');
a.href = URL.createObjectURL(xhr.response);
a.download = songInfo.name + ".flac";
a.click();
setStatus("下载" + songInfo.name + "成功", false);
} else {
setStatus("节点返回异常状态码:" + xhr.status);
}
}
}
xhr.onerror = function (e) {
}
xhr.open('GET', fileInfo.link + "&ForceNoCache=1", true)
xhr.send()
} else {
setStatus("读取下载链接失败:" + fileInfo.errormsg);
}
});
menuList.appendChild(dlHiMenu);
}
}
let coverMenu = makeMenu("查看封面", "./img/cover.svg");
coverMenu.addEventListener("click", (event) => {
Expand Down
10 changes: 5 additions & 5 deletions sw.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var APP_PREFIX = '545在线'
var VERSION = '1.0.6.20220616'
var VERSION_AZUSA_PATCH_USE = '1.0.5.20220615'
var VERSION = '1.0.7.20220617'
var VERSION_AZUSA_PATCH_USE = '1.0.6.20220616'
var AZUSA_PATCH_SKIP_LIST = [
'./img/bai.png',
'./img/wanan.png',
Expand Down Expand Up @@ -111,7 +111,7 @@ self.addEventListener('fetch', event => {
});
}
}
if (event.request.method == "GET" && (event.request.url.indexOf("http") == 0) && (event.request.url.indexOf("ForceNoCache") == -1)) {
if (event.request.method == "GET" && (event.request.url.indexOf("http") == 0) && (event.request.url.indexOf("ForceNoCache") == -1) && (event.request.url.indexOf("webapi.ctfile.com") == -1)) {
event.respondWith(
caches.open(getCacheName(event.request.url)).then(async cache => {
return cache.match(event.request).then(response => {
Expand All @@ -135,7 +135,7 @@ self.addEventListener('fetch', event => {
});
self.addEventListener('install', e => {
self.skipWaiting();
const install = async() => {
const install = async () => {
const cache = await caches.open(CACHE_NAME)
console.log('installing cache : ' + CACHE_NAME)
if ((await caches.has(AZUSA_CACHE))) {
Expand Down Expand Up @@ -173,7 +173,7 @@ self.addEventListener('activate', e => {
})
)
});
self.addEventListener('notificationclick', function(event) {
self.addEventListener('notificationclick', function (event) {
event.notification.close();
console.log(event)
switch (event.notification.tag) {
Expand Down
4 changes: 2 additions & 2 deletions version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"success": true,
"latest": "1.0.6.20220616",
"azusa_patch_avaliable": "1.0.5.20220615"
"latest": "1.0.7.20220617",
"azusa_patch_avaliable": "1.0.6.20220616"
}

1 comment on commit 5d8de09

@vercel
Copy link

@vercel vercel bot commented on 5d8de09 Jun 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.