mirror of
https://github.com/koodo-reader/koodo-reader.git
synced 2025-12-23 23:17:55 -05:00
Refactor: Simplify getWebsiteUrl and getPublicUrl functions by using getServerRegion for consistency
This commit is contained in:
@@ -593,15 +593,7 @@ export const getServerRegion = () => {
|
||||
return isUseCN ? "china" : "global";
|
||||
};
|
||||
export const getWebsiteUrl = () => {
|
||||
let isUseCN = false;
|
||||
if (ConfigService.getItem("serverRegion")) {
|
||||
isUseCN = ConfigService.getItem("serverRegion") === "china";
|
||||
} else {
|
||||
if (navigator.language && navigator.language === "zh-CN") {
|
||||
isUseCN = true;
|
||||
}
|
||||
}
|
||||
return isUseCN ? CN_WEBSITE_URL : WEBSITE_URL;
|
||||
return getServerRegion() === "china" ? CN_WEBSITE_URL : WEBSITE_URL;
|
||||
};
|
||||
export const formatTimestamp = (timestamp) => {
|
||||
if (!timestamp) return "";
|
||||
|
||||
@@ -1,23 +1,12 @@
|
||||
import axios from "axios";
|
||||
import toast from "react-hot-toast";
|
||||
import i18n from "../../i18n";
|
||||
import {
|
||||
ConfigService,
|
||||
TokenService,
|
||||
} from "../../assets/lib/kookit-extra-browser.min";
|
||||
import { reloadManager } from "../common";
|
||||
import { TokenService } from "../../assets/lib/kookit-extra-browser.min";
|
||||
import { getServerRegion, reloadManager } from "../common";
|
||||
const PUBLIC_URL = "https://api.960960.xyz";
|
||||
const CN_PUBLIC_URL = "https://api.koodoreader.cn";
|
||||
export const getPublicUrl = () => {
|
||||
let isUseCN = false;
|
||||
if (ConfigService.getItem("serverRegion")) {
|
||||
isUseCN = ConfigService.getItem("serverRegion") === "china";
|
||||
} else {
|
||||
if (navigator.language && navigator.language === "zh-CN") {
|
||||
isUseCN = true;
|
||||
}
|
||||
}
|
||||
return isUseCN ? CN_PUBLIC_URL : PUBLIC_URL;
|
||||
return getServerRegion() === "china" ? CN_PUBLIC_URL : PUBLIC_URL;
|
||||
};
|
||||
export const checkDeveloperUpdate = async () => {
|
||||
let res = await axios.get(
|
||||
|
||||
Reference in New Issue
Block a user