|
|
@ -1,4 +1,6 @@
|
|
|
|
import { isAccountLoggedIn } from "./auth";
|
|
|
|
import { isAccountLoggedIn } from "./auth";
|
|
|
|
|
|
|
|
import { refreshCookie } from "@/api/auth";
|
|
|
|
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
import store from "@/store";
|
|
|
|
import store from "@/store";
|
|
|
|
|
|
|
|
|
|
|
|
export function isTrackPlayable(track) {
|
|
|
|
export function isTrackPlayable(track) {
|
|
|
@ -61,7 +63,7 @@ export function shuffleAList(list) {
|
|
|
|
|
|
|
|
|
|
|
|
export function throttle(fn, time) {
|
|
|
|
export function throttle(fn, time) {
|
|
|
|
let isRun = false;
|
|
|
|
let isRun = false;
|
|
|
|
return function () {
|
|
|
|
return function() {
|
|
|
|
if (isRun) return;
|
|
|
|
if (isRun) return;
|
|
|
|
isRun = true;
|
|
|
|
isRun = true;
|
|
|
|
fn.apply(this, arguments);
|
|
|
|
fn.apply(this, arguments);
|
|
|
@ -75,3 +77,17 @@ export function updateHttps(url) {
|
|
|
|
if (!url) return "";
|
|
|
|
if (!url) return "";
|
|
|
|
return url.replace(/^http:/, "https:");
|
|
|
|
return url.replace(/^http:/, "https:");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function dailyTask() {
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
store.state.settings.lastRefreshCookieDate === undefined ||
|
|
|
|
|
|
|
|
store.state.settings.lastRefreshCookieDate !== dayjs().date()
|
|
|
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
console.log("execute dailyTask");
|
|
|
|
|
|
|
|
store.commit("updateSettings", {
|
|
|
|
|
|
|
|
key: "lastRefreshCookieDate",
|
|
|
|
|
|
|
|
value: dayjs().date(),
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
refreshCookie();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|