mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-25 19:52:48 +00:00
fix(i18n): disable cache by appending version numbers
This commit is contained in:
parent
09a5168b23
commit
d4dc124e99
|
|
@ -648,6 +648,12 @@ module.exports = function(webpackEnv) {
|
|||
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
|
||||
// You can remove this if you don't use Moment.js:
|
||||
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
|
||||
|
||||
new webpack.DefinePlugin({
|
||||
ASSETS_VERSION: JSON.stringify(
|
||||
require("../package.json").version
|
||||
),
|
||||
}),
|
||||
// Generate a service worker script that will precache, and keep up to date,
|
||||
// the HTML & assets that are part of the Webpack build.
|
||||
isEnvProduction &&
|
||||
|
|
|
|||
|
|
@ -292,7 +292,9 @@ export default function WebDAV() {
|
|||
</Tooltip>
|
||||
<Tooltip
|
||||
placement="top"
|
||||
title={t("setting.delete")}
|
||||
title={t(
|
||||
"setting.delete"
|
||||
)}
|
||||
onClick={() =>
|
||||
deleteAccount(id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import ChainedBackend, { ChainedBackendOptions } from "i18next-chained-backend";
|
|||
import LanguageDetector from "i18next-browser-languagedetector";
|
||||
import LocalStorageBackend from "i18next-localstorage-backend";
|
||||
|
||||
declare let ASSETS_VERSION: string;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
|
||||
// @ts-ignore
|
||||
i18n.use(ChainedBackend)
|
||||
|
|
@ -32,6 +34,7 @@ i18n.use(ChainedBackend)
|
|||
expirationTime: 7 * 24 * 60 * 60 * 1000, // 7 days
|
||||
},
|
||||
{
|
||||
queryStringParams: { v: ASSETS_VERSION },
|
||||
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import { getResumeCtx } from "../component/Uploader/core/utils";
|
||||
|
||||
export const sizeToString = (bytes) => {
|
||||
if (bytes === 0 || bytes === "0") return "0 B";
|
||||
const k = 1024;
|
||||
|
|
@ -157,10 +155,9 @@ export function vhCheck() {
|
|||
}
|
||||
|
||||
export const removeI18nCache = () => {
|
||||
for (let i = 0, len = localStorage.length; i < len; i++) {
|
||||
const key = localStorage.key(i);
|
||||
Object.keys(localStorage).forEach(function (key) {
|
||||
if (key && key.startsWith("i18next_res_")) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue