diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 1e1fa97..a43365e 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -338,7 +338,7 @@ dependencies = [
"num-traits",
"serde",
"wasm-bindgen",
- "windows-targets",
+ "windows-targets 0.48.5",
]
[[package]]
@@ -2175,6 +2175,17 @@ dependencies = [
"num-traits",
]
+[[package]]
+name = "os_info"
+version = "3.7.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e"
+dependencies = [
+ "log",
+ "serde",
+ "winapi",
+]
+
[[package]]
name = "overload"
version = "0.1.1"
@@ -2226,7 +2237,7 @@ dependencies = [
"libc",
"redox_syscall 0.4.1",
"smallvec",
- "windows-targets",
+ "windows-targets 0.48.5",
]
[[package]]
@@ -3229,6 +3240,19 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "sys-locale"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f8a11bd9c338fdba09f7881ab41551932ad42e405f61d01e8406baea71c07aee"
+dependencies = [
+ "js-sys",
+ "libc",
+ "wasm-bindgen",
+ "web-sys",
+ "windows-sys 0.45.0",
+]
+
[[package]]
name = "system-configuration"
version = "0.5.1"
@@ -3374,6 +3398,7 @@ dependencies = [
"objc",
"once_cell",
"open",
+ "os_info",
"percent-encoding",
"rand 0.8.5",
"raw-window-handle",
@@ -3386,6 +3411,7 @@ dependencies = [
"serde_repr",
"serialize-to-javascript",
"state",
+ "sys-locale",
"tar",
"tauri-macros",
"tauri-runtime",
@@ -4339,7 +4365,7 @@ version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
dependencies = [
- "windows-targets",
+ "windows-targets 0.48.5",
]
[[package]]
@@ -4358,7 +4384,7 @@ version = "0.51.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64"
dependencies = [
- "windows-targets",
+ "windows-targets 0.48.5",
]
[[package]]
@@ -4392,13 +4418,37 @@ dependencies = [
"windows_x86_64_msvc 0.42.2",
]
+[[package]]
+name = "windows-sys"
+version = "0.45.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
+dependencies = [
+ "windows-targets 0.42.2",
+]
+
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
- "windows-targets",
+ "windows-targets 0.48.5",
+]
+
+[[package]]
+name = "windows-targets"
+version = "0.42.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
+dependencies = [
+ "windows_aarch64_gnullvm 0.42.2",
+ "windows_aarch64_msvc 0.42.2",
+ "windows_i686_gnu 0.42.2",
+ "windows_i686_msvc 0.42.2",
+ "windows_x86_64_gnu 0.42.2",
+ "windows_x86_64_gnullvm 0.42.2",
+ "windows_x86_64_msvc 0.42.2",
]
[[package]]
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 314265f..9d4b412 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -19,7 +19,7 @@ chrono = "0.4"
rusqlite = { version = "0.27.0", features = ["bundled"] }
regex = "1.10.2"
futures = "0.3"
-tauri = { version = "1.5", features = [ "shell-open", "dialog-open", "http-request"] }
+tauri = { version = "1.5", features = [ "os-all", "shell-open", "dialog-open", "http-request"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
reqwest = { version = "0.11.9", features = ["json", "cookies", "stream"] }
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 70b6d2c..83a1ab7 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -94,6 +94,9 @@ fn init_headers() -> HeaderMap {
.join("; ") + ";";
headers.insert("Cookie", HeaderValue::from_str(&cookies_header).unwrap());
}
+ headers.insert("Upgrade-Insecure-Requests", HeaderValue::from_static("1"));
+ headers.insert("Sec-Ch-Ua", HeaderValue::from_static("\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\""));
+ headers.insert("Sec-Ch-Ua-Mobile", HeaderValue::from_static("?0"));
headers.insert("Connection", HeaderValue::from_static("keep-alive"));
headers.insert("Referer", HeaderValue::from_static("https://www.bilibili.com"));
headers
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index edf1c54..6b692a9 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -17,6 +17,9 @@
"all": false,
"open": true
},
+ "os": {
+ "all": true
+ },
"dialog": {
"all": false,
"open": true
diff --git a/src/css/style.css b/src/css/style.css
index 031bae5..102b314 100644
--- a/src/css/style.css
+++ b/src/css/style.css
@@ -30,6 +30,15 @@
background-color: #3b3b3b;
}
+.version,
+.about {
+ font-size: 18px;
+ margin: 5px 0;
+}
+
+#version,
+.about span { font-family: "HarmonyOS_Bold", sans-serif; }
+
.loading,
.loading-only,
.loading-multi {
@@ -1352,6 +1361,7 @@ input[name="temp-dir-path"] {
cursor: not-allowed;
}
+.about a, .about span,
.login a {
color: #3086bf;
text-decoration: none;
@@ -1378,8 +1388,7 @@ input[name="temp-dir-path"] {
.profile,
.down-page-bar,
.settings-page-bar,
-.settings-side-general-bar,
-.settings-side-advanced-bar {
+.settings-side-sel-bar {
position: relative;
display: flex;
flex-direction: column;
@@ -1426,8 +1435,7 @@ input[name="temp-dir-path"] {
}
.down-page-bar-background,
-.settings-side-general-bar-background,
-.settings-side-advanced-bar-background,
+.settings-side-bar-background,
.settings-page-bar-background {
width: 50px;
height: 50px;
@@ -1444,14 +1452,12 @@ input[name="temp-dir-path"] {
.user-profile-exit-background:hover,
.down-page-bar-background:hover,
-.settings-side-advanced-bar-background:hover,
-.settings-side-general-bar-background:hover,
+.settings-side-bar-background:hover,
.settings-page-bar-background:hover {
background-color: #3b3b3b !important;
}
-.settings-side-general-bar-background.checked,
-.settings-side-advanced-bar-background.checked {
+.settings-side-bar-background.checked {
background-color: #4c4c4c;
}
@@ -1492,9 +1498,8 @@ input[name="temp-dir-path"] {
}
.down-page-bar-name,
-.settings-side-general-bar-name,
-.settings-side-advanced-bar-name,
.settings-page-bar-name,
+.settings-side-bar-name,
.user-name {
font-size: 13px;
max-width: 110px;
@@ -1515,8 +1520,7 @@ input[name="temp-dir-path"] {
position: relative;
}
-.settings-general-page,
-.settings-advanced-page {
+.settings-page {
width: calc(100vw - 107px);
left: 107px;
height: calc(98vh - 12px);
@@ -1527,13 +1531,31 @@ input[name="temp-dir-path"] {
flex-direction: column;
}
-.settings-general-page.active,
-.settings-advanced-page.active {
+.settings-page.active {
opacity: 1;
visibility: visible;
animation: settings-page-anime 0.5s cubic-bezier(0,1,.6,1);
}
+.settings-page._info svg { width: 20%; }
+
+.settings-page._info img {
+ width: 80px;
+ height: 80px;
+ user-select: none;
+ margin-right: 20px;
+}
+
+.settings-page._info icon {
+ display: flex;
+ margin: 40px 0;
+}
+
+.settings-page._info i {
+ margin-top: 40px;
+ font-size: 14px;
+}
+
@keyframes settings-page-anime {
0% {
bottom: -20px;
diff --git a/src/img/icon.png b/src/img/icon.png
new file mode 100644
index 0000000..a824fb6
Binary files /dev/null and b/src/img/icon.png differ
diff --git a/src/index.html b/src/index.html
index 32db0c0..f1f3c7a 100644
--- a/src/index.html
+++ b/src/index.html
@@ -89,16 +89,20 @@
-
-
-
常规
+
-
-
+
常规
存储路径
@@ -106,7 +110,7 @@
浏览
-
+
高级
临时文件存储路径
@@ -114,6 +118,49 @@
浏览
+
+
关于
+
+
+
+
+
版本: (; )
+
+
+
+
Copyright © btjawa & MIT License
+
@@ -125,8 +172,8 @@
diff --git a/src/js/render.js b/src/js/render.js
index 7ff8f6d..12edc7c 100644
--- a/src/js/render.js
+++ b/src/js/render.js
@@ -1,6 +1,6 @@
const { invoke } = window.__TAURI__.tauri;
const { listen } = window.__TAURI__.event;
-const { shell, dialog, http } = window.__TAURI__;
+const { shell, dialog, http, app, os } = window.__TAURI__;
const searchBtn = $('.search-btn');
const searchInput = $('input[name="search-input"]');
@@ -17,10 +17,6 @@ const multiNextPage = $('.video-multi-next');
const multiSelect = $('.multi-select-btn');
const multiSelectNext = $('.multi-select-next-btn');
const multiSelectDown = $('.multi-select-next-down-btn');
-const generalBg = $('.settings-side-general-bar-background');
-const advancedBg = $('.settings-side-advanced-bar-background');
-const generalPage = $('.settings-general-page');
-const advancedPage = $('.settings-advanced-page');
const downDirPath = $('input[name="down-dir-path"]');
const tempDirPath = $('input[name="temp-dir-path"]');
@@ -136,21 +132,16 @@ async function getVideoFull(aid, cid, type, action) {
let getDetailUrl = type !== "bangumi"
? `https://api.bilibili.com/x/player/wbi/playurl?${signature}`
: `https://api.bilibili.com/pgc/player/web/playurl?${signature}`;
- try {
- const detailsData = await http.fetch(getDetailUrl,
- { headers });
- if (detailsData.ok) {
- const details = await detailsData.data;
- if (handleErr(details, type)) {
- currentVideoBlock.next($(`.video-block-${action}`))
- .removeClass('active').remove();
- return;
- }
- return details;
- } else {
- console.error("请求失败");
+ const details = (await http.fetch(getDetailUrl,
+ { headers })).data;
+ if (details.code == 0) {
+ if (handleErr(details, type)) {
+ currentVideoBlock.next($(`.video-block-${action}`))
+ .removeClass('active').remove();
+ return;
}
- } catch (error) {
+ return details;
+ } else {
handleErr(error, type);
}
}
@@ -286,46 +277,42 @@ function handleErr(err, type) {
}
async function search(input) {
- try {
- infoBlock.removeClass('active');
- videoList.removeClass('active');
- videoListTabHead.removeClass('active');
- multiSelect.off('click');
- currentElm.push(".video-root");
- if ($('.multi-select-icon').hasClass('checked')) multiSelect.click();
- let match = input.match(/BV[a-zA-Z0-9]+|av(\d+)/i);
+ infoBlock.removeClass('active');
+ videoList.removeClass('active');
+ videoListTabHead.removeClass('active');
+ multiSelect.off('click');
+ currentElm.push(".video-root");
+ if ($('.multi-select-icon').hasClass('checked')) multiSelect.click();
+ let match = input.match(/BV[a-zA-Z0-9]+|av(\d+)/i);
+ if (match) {
+ parseVideo(match[0]);
+ searchElm.addClass('active').removeClass('back');
+ loadingBox.addClass('active');
+ } else {
+ match = input.match(/ep(\d+)|ss(\d+)/i);
if (match) {
- parseVideo(match[0]);
+ parseBangumi(match[0]);
searchElm.addClass('active').removeClass('back');
loadingBox.addClass('active');
} else {
- match = input.match(/ep(\d+)|ss(\d+)/i);
+ match = input.match(/au(\d+)/i);
if (match) {
- parseBangumi(match[0]);
- searchElm.addClass('active').removeClass('back');
- loadingBox.addClass('active');
- } else {
- match = input.match(/au(\d+)/i);
- if (match) {
- iziToast.error({
- icon: 'fa-regular fa-circle-exclamation',
- layout: '2',
- title: `警告`,
- message: "暂不支持au解析"
- });
- } else if (!input || !input.match(/a-zA-Z0-9/g) || true) {
- iziToast.error({
- icon: 'fa-regular fa-circle-exclamation',
- layout: '2',
- title: `警告`,
- message: !input ? "请输入链接/AV/BV/SS/EP号" : "输入不合法!请检查格式"
- });
- backward();
- }
+ iziToast.error({
+ icon: 'fa-regular fa-circle-exclamation',
+ layout: '2',
+ title: `警告`,
+ message: "暂不支持au解析"
+ });
+ } else if (!input || !input.match(/a-zA-Z0-9/g) || true) {
+ iziToast.error({
+ icon: 'fa-regular fa-circle-exclamation',
+ layout: '2',
+ title: `警告`,
+ message: !input ? "请输入链接/AV/BV/SS/EP号" : "输入不合法!请检查格式"
+ });
+ backward();
}
}
- } catch (err) {
- console.error(err);
}
}
@@ -461,14 +448,17 @@ async function backward() {
$('.video-list').empty();
} else if (currentElm[index] == '.settings') {
settingsElm.removeClass('active').addClass('back');
- generalPage.removeClass('active');
- advancedPage.removeClass('active');
+ $('.settings-page').removeClass('active');
}
currentElm.pop();
}
$(document).ready(function () {
invoke('init');
+ app.getVersion().then(ver => $('#version').html(ver));
+ os.platform().then(type => $('#platform').html(type));
+ os.arch().then(arch => $('#arch').html(arch));
+ $('#year').html((new Date()).getFullYear())
$('.user-avatar-placeholder').append(bigVipIcon);
async function handleSearch() {
await search(searchInput.val());
@@ -1456,6 +1446,7 @@ async function smsLogin() {
async function login() {
if ($('.user-name').text() != "登录") return;
currentElm.push(".login");
+ $('.login-tab-pwd .login-tab-sms').off('click');
loginElm.addClass('active').removeClass('back');
scanLogin();
$('.login-tab-pwd').on('click', async () => {
@@ -1503,10 +1494,13 @@ async function captcha() {
}
function settings() {
+ $('.settings-side-bar-background').off('click');
settingsElm.removeClass('back').addClass('active');
currentElm.push('.settings');
const downDirOpenBtn = $('.down-dir-path-openbtn');
const tempDirOpenBtn = $('.temp-dir-path-openbtn');
+ downDirOpenBtn.off('click');
+ tempDirOpenBtn.off('click');
function handelSave(set) {
invoke('rw_config', {action: "save", sets: {
max_conc: 0,
@@ -1522,20 +1516,19 @@ function settings() {
message: `已保存设置 - ${set}`,
});
}
- generalBg.on('click', () => {
- generalBg.addClass('checked');
- advancedBg.removeClass('checked');
- generalPage.addClass('active');
- advancedPage.removeClass('active');
- });
- advancedBg.on('click', () => {
- generalBg.removeClass('checked');
- advancedBg.addClass('checked');
- generalPage.removeClass('active');
- advancedPage.addClass('active')
- .find('.settings-page-block-title').first().css("margin-right", "10px");
+ $('.settings-side-bar-background').on('click', (event) => {
+ const targetBg = $(event.target).closest('.settings-side-bar-background');
+ const type = targetBg.attr('class').split(/\s+/)[1];
+ $('.settings-side-bar-background').removeClass('checked');
+ $('.settings-page').removeClass('active');
+ targetBg.addClass('checked');
+ $(`.settings-page.${type}`).addClass('active');
+ if (type === "_info") {
+ const svg = $('.settings-page._info').find('svg').css('display', 'none');
+ setTimeout(() => svg.append(svg.find('style').detach()).css('display', 'block'), 1);
+ }
});
- generalBg.click();
+ $('.settings-side-bar-background.general').click();
downDirOpenBtn.on('click', async () => {
const selected = await selFile('directory');
if (selected) {
@@ -1618,7 +1611,7 @@ async function getUserProfile(mid) {
userData[0] = mid;
userData[1] = details.data.coins;
if (details.code != "0"){
- console.error(details);
+ handleErr(details, null);
return;
}
iziToast.info({
@@ -1632,8 +1625,6 @@ async function getUserProfile(mid) {
}
$('.user-avatar').attr('src', details.data.face);
$('.user-name').text(details.data.name);
- $('.user-avatar-placeholder').attr('data-after', '主页');
- $('.user-avatar-placeholder').on('click', debounce(userProfile, 500));
if (details.data.vip.type != 0 && details.data.vip.avatar_subscript == 1) {
$('.user-vip-icon').css('display', 'block');
}
@@ -1678,7 +1669,6 @@ listen("exit-success", async (event) => {
})
listen("login-status", async (event) => {
- console.log(event.payload)
if (event.payload == 86090) {
$('.login-qrcode-tips').addClass('active')
.html(`