2020-12-09 13:33:29 +00:00
|
|
|
<template>
|
2022-01-12 11:27:08 +00:00
|
|
|
<div class="w-full min-h-screen px-1vw reset" :class="[theme]">
|
2022-01-13 05:12:06 +00:00
|
|
|
<NavBar />
|
2021-07-07 14:18:09 +00:00
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
<keep-alive :max="5">
|
2021-10-08 18:52:51 +00:00
|
|
|
<component :is="Component" :key="$route.fullPath" />
|
2021-07-07 14:18:09 +00:00
|
|
|
</keep-alive>
|
|
|
|
</router-view>
|
2021-03-29 06:38:29 +00:00
|
|
|
|
2022-09-05 17:25:45 +00:00
|
|
|
<footer class="text-center">
|
2021-05-10 18:14:28 +00:00
|
|
|
<a aria-label="GitHub" href="https://github.com/TeamPiped/Piped">
|
2021-12-27 22:33:55 +00:00
|
|
|
<font-awesome-icon :icon="['fab', 'github']" />
|
2021-03-29 06:38:29 +00:00
|
|
|
</a>
|
2021-12-27 14:46:39 +00:00
|
|
|
<a class="ml-2" href="https://github.com/TeamPiped/Piped#donations">
|
2021-12-27 22:33:55 +00:00
|
|
|
<font-awesome-icon :icon="['fab', 'bitcoin']" />
|
2022-07-20 20:20:10 +00:00
|
|
|
<span class="ml-1" v-t="'actions.donations'" />
|
2021-03-29 06:38:29 +00:00
|
|
|
</a>
|
2021-12-27 14:46:30 +00:00
|
|
|
</footer>
|
2020-12-09 13:33:29 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-04-08 15:46:49 +00:00
|
|
|
import NavBar from "./components/NavBar.vue";
|
2020-12-09 13:33:29 +00:00
|
|
|
export default {
|
2021-03-31 22:09:39 +00:00
|
|
|
components: {
|
2022-01-13 05:12:06 +00:00
|
|
|
NavBar,
|
2021-05-10 18:14:28 +00:00
|
|
|
},
|
2021-07-18 20:20:35 +00:00
|
|
|
mounted() {
|
2021-08-22 10:27:09 +00:00
|
|
|
if (this.getPreferenceBoolean("watchHistory", false))
|
|
|
|
if ("indexedDB" in window) {
|
|
|
|
const request = indexedDB.open("piped-db", 1);
|
2022-01-01 14:53:55 +00:00
|
|
|
request.onupgradeneeded = function () {
|
2021-08-22 10:27:09 +00:00
|
|
|
const db = request.result;
|
|
|
|
console.log("Upgrading object store.");
|
|
|
|
if (!db.objectStoreNames.contains("watch_history")) {
|
|
|
|
const store = db.createObjectStore("watch_history", { keyPath: "videoId" });
|
|
|
|
store.createIndex("video_id_idx", "videoId", { unique: true });
|
|
|
|
store.createIndex("id_idx", "id", { unique: true, autoIncrement: true });
|
|
|
|
}
|
|
|
|
};
|
|
|
|
request.onsuccess = e => {
|
|
|
|
window.db = e.target.result;
|
|
|
|
};
|
|
|
|
} else console.log("This browser doesn't support IndexedDB");
|
2021-08-25 16:30:21 +00:00
|
|
|
|
|
|
|
const App = this;
|
|
|
|
|
2022-01-01 14:53:55 +00:00
|
|
|
(async function () {
|
2022-06-26 01:53:06 +00:00
|
|
|
const defaultLang = await App.defaultLangage;
|
|
|
|
const locale = App.getPreferenceString("hl", defaultLang);
|
2021-10-27 00:59:03 +00:00
|
|
|
if (locale !== App.TimeAgoConfig.locale) {
|
2022-01-12 05:39:36 +00:00
|
|
|
const localeTime = await import(
|
|
|
|
"./../node_modules/javascript-time-ago/locale/" + locale + ".json"
|
|
|
|
).then(module => module.default);
|
2021-10-27 00:59:03 +00:00
|
|
|
App.TimeAgo.addLocale(localeTime);
|
|
|
|
App.TimeAgoConfig.locale = locale;
|
|
|
|
}
|
2021-08-25 16:30:21 +00:00
|
|
|
if (window.i18n.global.locale.value !== locale) {
|
|
|
|
if (!window.i18n.global.availableLocales.includes(locale)) {
|
2021-12-28 14:39:20 +00:00
|
|
|
const messages = await import(`./locales/${locale}.json`).then(module => module.default);
|
2021-08-25 16:30:21 +00:00
|
|
|
window.i18n.global.setLocaleMessage(locale, messages);
|
|
|
|
}
|
|
|
|
window.i18n.global.locale.value = locale;
|
|
|
|
}
|
|
|
|
})();
|
2021-07-18 20:20:35 +00:00
|
|
|
},
|
2020-12-09 13:33:29 +00:00
|
|
|
};
|
|
|
|
</script>
|