Add language cache cleanup

This commit is contained in:
Aicirou 2020-06-30 19:02:11 +08:00
parent f73ea87cb0
commit 0aab140452
3 changed files with 46 additions and 46 deletions

View File

@ -12,50 +12,7 @@
<link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet"> <link href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" rel="stylesheet">
<% } %> <% } %>
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
<script> <script src="/setting.js"></script>
var authConfig = {
version: '1.1.1',
roots: [
{
id: "",
name: "TeamDrive",
pass: "",
},
{
id: "root",
name: "PriveDrive",
pass: "",
},
{
id: "",
name: "folder1",
pass: "",
}
],
};
var themeOptions = {
// en/zh-chs/zh-cht
languages: 'en',
render: {
head_md: true,
readme_md: true,
// 是否显示文件/文件夹描述(默认不显示)
// Show file/folder description or not (not shown by default)
desc: true,
},
player: {
api: "",
autoplay: true
}
}
window.gdconfig = JSON.parse(JSON.stringify({ version: authConfig.version, themeOptions: themeOptions }));
window.themeOptions = themeOptions;
window.gds = JSON.parse(
JSON.stringify(authConfig.roots.map((it) => it.name))
);
window.current_drive_order = 0;
// window.MODEL = { q: "the",root_type: 1 };
</script>
<!-- 使用 CDN 加速的 JS 文件,配置在 vue.config.js 下 --> <!-- 使用 CDN 加速的 JS 文件,配置在 vue.config.js 下 -->
<% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %> <% for (var i in htmlWebpackPlugin.options.cdn&&htmlWebpackPlugin.options.cdn.js) { %>
<script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script> <script src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>

41
public/setting.js Normal file
View File

@ -0,0 +1,41 @@
var authConfig = {
version: '1.1.1',
roots: [
{
id: "",
name: "TeamDrive",
pass: "",
},
{
id: "root",
name: "PriveDrive",
pass: "",
},
{
id: "",
name: "folder1",
pass: "",
}
],
};
var themeOptions = {
// en/zh-chs/zh-cht
languages: 'en',
render: {
head_md: true,
readme_md: true,
// 是否显示文件/文件夹描述(默认不显示)
// Show file/folder description or not (not shown by default)
desc: true,
},
player: {
api: "",
autoplay: true
}
}
window.gdconfig = JSON.parse(JSON.stringify({ version: authConfig.version, themeOptions: themeOptions }));
window.themeOptions = themeOptions;
window.gds = JSON.parse(
JSON.stringify(authConfig.roots.map((it) => it.name))
);
window.current_drive_order = 0;

View File

@ -15,18 +15,20 @@
</template> </template>
<script> <script>
import util from '@/libs/util'
export default { export default {
data() { data () {
return {}; return {};
}, },
methods: { methods: {
cleanCache() { cleanCache () {
new Promise((resolve) => { new Promise((resolve) => {
Object.keys(localStorage).forEach((item) => { Object.keys(localStorage).forEach((item) => {
if (item.indexOf("file_path_") !== -1) { if (item.indexOf("file_path_") !== -1) {
localStorage.removeItem(item); localStorage.removeItem(item);
} }
}); });
util.cookies.remove("lang")
resolve(); resolve();
}).then(() => { }).then(() => {
this.$notify({ this.$notify({