Skip to content

Commit

Permalink
chore: upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
AnatoleAM committed Nov 25, 2023
1 parent 29d1812 commit ac63939
Show file tree
Hide file tree
Showing 13 changed files with 1,418 additions and 1,105 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
"rules": {}
}
]
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
30 changes: 16 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@
"devDependencies": {
"@apollo/client": "^3.8.1",
"@floating-ui/dom": "^1.5.1",
"@intlify/unplugin-vue-i18n": "^0.12.3",
"@intlify/unplugin-vue-i18n": "^1.5.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/chrome": "^0.0.243",
"@types/chrome": "^0.0.253",
"@types/dompurify": "^3.0.2",
"@types/fs-extra": "^11.0.1",
"@types/marked": "^5.0.1",
"@types/marked": "^6.0.0",
"@types/node": "^20.5.1",
"@types/sharedworker": "^0.0.102",
"@types/sharedworker": "^0.0.107",
"@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/eslint-plugin": "^6.12.0",
"@typescript-eslint/parser": "^6.4.0",
"@vitejs/plugin-vue": "^4.3.1",
"@vue/apollo-composable": "^4.0.0-beta.8",
"@vue/compiler-sfc": "^3.3.4",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^11.0.3",
"@vue/eslint-config-typescript": "^12.0.0",
"@vueuse/core": "^10.3.0",
"@vueuse/head": "^1.3.1",
"@vueuse/head": "^2.0.0",
"chokidar": "^3.5.3",
"color2k": "^2.0.2",
"date-fns": "^2.30.0",
Expand All @@ -65,29 +65,31 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-vue": "^9.17.0",
"graphql": "^16.8.0",
"marked": "^7.0.4",
"nanoid": "^4.0.2",
"javascript-obfuscator": "^4.1.0",
"marked": "^10.0.0",
"nanoid": "^5.0.3",
"npm-run-all": "^4.1.5",
"pinia": "^2.1.6",
"postcss-html": "^1.5.0",
"postcss-scss": "^4.0.7",
"prettier": "^3.0.2",
"rollup-plugin-obfuscator": "^1.0.3",
"sass": "^1.66.1",
"stylelint": "^15.10.3",
"stylelint-config-html": "^1.1.0",
"stylelint-config-standard": "^34.0.0",
"stylelint-config-standard-scss": "^10.0.0",
"stylelint-config-standard-scss": "^11.1.0",
"stylelint-config-standard-vue": "^1.0.0",
"stylelint-scss": "^5.1.0",
"terser": "^5.19.2",
"tldts": "^6.0.14",
"typescript": "^5.1.3",
"typescript": "^5.3.2",
"ua-parser-js": "^1.0.35",
"uuid": "^9.0.0",
"vite": "^4.4.9",
"vite": "^5.0.2",
"vite-plugin-chrome-extension": "^0.0.7",
"vue-i18n": "9.2.2",
"vue-router": "4.2.4",
"vue-i18n": "9.7.1",
"vue-router": "4.2.5",
"vue-tsc": "^1.8.8",
"webextension-polyfill-ts": "^0.26.0"
}
Expand Down
48 changes: 1 addition & 47 deletions src/app/settings/SettingsViewHome.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,55 +19,18 @@
</div>
</div>
</div>
<div ref="sidebarEl" class="seventv-settings-home-sidebar seventv-settings-compact">
<a
v-if="sidebarEl"
class="twitter-timeline"
noscrollbar="1"
noborders="1"
transparent="1"
data-chrome="noheader nofooter noborders noscrollbar transparent"
:data-tweet-limit="10"
:data-height="sidebarEl.offsetHeight"
:data-theme="theme.toLowerCase()"
href="https://twitter.com/Official_7TV?ref_src=twsrc%5Etfw"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { onMounted, ref } from "vue";
import { storeToRefs } from "pinia";
import { useStore } from "@/store/main";
import { useUserAgent } from "@/composable/useUserAgent";
import Changelog from "@/site/global/Changelog.vue";
import CloudIcon from "@/assets/svg/icons/CloudIcon.vue";
import UiScrollable from "@/ui/UiScrollable.vue";
const { theme } = storeToRefs(useStore());
const { browser } = useUserAgent();
const appName = import.meta.env.VITE_APP_NAME;
const appContainer = import.meta.env.VITE_APP_CONTAINER ?? "Extension";
const appServer = import.meta.env.VITE_APP_API ?? "Offline";
const version = import.meta.env.VITE_APP_VERSION;
const isRemote = seventv.remote || false;
const sidebarEl = ref<HTMLElement | null>(null);
onMounted(() => {
// Skip loading the twitter widget on Firefox
if (browser.name === "Firefox") return;
// Insert twitter widget
const twitterScript = document.createElement("script");
twitterScript.async = true;
twitterScript.setAttribute("src", "https://platform.twitter.com/widgets.js");
twitterScript.setAttribute("charset", "utf-8");
document.head.appendChild(twitterScript);
});
const isRemote = seventv.hosted || false;
</script>
<style scoped lang="scss">
.seventv-settings-home {
Expand All @@ -77,10 +40,6 @@ onMounted(() => {
@media (width <= 1600px) {
grid-template-columns: 1.25fr 0;
.seventv-settings-home-sidebar {
display: none !important;
}
}
.seventv-settings-home-body {
Expand Down Expand Up @@ -117,10 +76,5 @@ onMounted(() => {
}
}
}
.seventv-settings-home-sidebar {
z-index: 1;
overflow: clip;
}
}
</style>
4 changes: 2 additions & 2 deletions src/site/site.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ app.provide("app-id", appID);
const extensionOrigin = scr?.getAttribute("extension_origin") ?? "";
app.provide(
SITE_WORKER_URL,
seventv.remote ? seventv.host_manifest?.worker_file ?? null : null ?? scr?.getAttribute("worker_url"),
seventv.hosted ? seventv.host_manifest?.worker_file ?? null : null ?? scr?.getAttribute("worker_url"),
);
app.provide(SITE_ASSETS_URL, extensionOrigin + "assets");
app.provide(SITE_EXT_OPTIONS_URL, extensionOrigin + "index.html");
Expand All @@ -76,7 +76,7 @@ app.use(createPinia())
.mount("#seventv-root");

// unlink built-in stylesheet while in hosted mode
if (seventv.remote) {
if (seventv.hosted) {
const sheets = document.querySelectorAll<HTMLLinkElement>("#seventv-stylesheet");
for (let i = 0; i < sheets.length; i++) {
const sheet = sheets.item(i);
Expand Down
3 changes: 3 additions & 0 deletions src/site/site.normal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function loadSite() {
import("./site.app");
}
46 changes: 24 additions & 22 deletions src/site/site.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { log } from "@/common/Logger";
import { semanticVersionToNumber } from "@/common/Transform";
import { loadSite } from "./site.normal";

(async () => {
const manifestURL = `${import.meta.env.VITE_APP_HOST}/manifest${
import.meta.env.VITE_APP_VERSION_BRANCH ? "." + import.meta.env.VITE_APP_VERSION_BRANCH.toLowerCase() : ""
}.json`;
const host: string = import.meta.env.VITE_APP_HOST;
const versionBranch: string = import.meta.env.VITE_APP_VERSION_BRANCH;

const manifestURL = `${host}/manifest${versionBranch ? "." + versionBranch.toLowerCase() : ""}.json`;

const manifest = await fetch(manifestURL)
.then((res) => res.json())
Expand All @@ -17,29 +19,29 @@ import { semanticVersionToNumber } from "@/common/Transform";
host_manifest: manifest ?? null,
};

if (manifest && hostedVersion > localVersion) {
seventv.remote = true;
if (!manifest || hostedVersion <= localVersion) {
log.info("<Site>", "Using Local Mode,", "v" + import.meta.env.VITE_APP_VERSION);
loadSite();
} else {
seventv.hosted = true;

const scr = document.createElement("script");
scr.id = "seventv-site-hosted";
scr.src = manifest.index_file;
scr.type = "module";
const v1 = document.createElement("script");
v1.id = "seventv-site-hosted";
v1.src = manifest.index_file;
v1.type = "module";

const style = document.createElement("link");
style.rel = "stylesheet";
style.type = "text/css";
style.href = manifest.stylesheet_file;
style.setAttribute("charset", "utf-8");
style.setAttribute("content", "text/html");
style.setAttribute("http-equiv", "content-type");
style.id = "seventv-stylesheet";
const v2 = document.createElement("link");
v2.rel = "stylesheet";
v2.type = "text/css";
v2.href = manifest.stylesheet_file;
v2.setAttribute("charset", "utf-8");
v2.setAttribute("content", "text/html");
v2.setAttribute("http-equiv", "content-type");
v2.id = "seventv-stylesheet";

document.head.appendChild(style);
document.head.appendChild(scr);
document.head.appendChild(v2);
document.head.appendChild(v1);

log.info("<Site>", "Using Hosted Mode,", "v" + manifest.version);
} else {
import("./site.app");
log.info("<Site>", "Using Local Mode,", "v" + import.meta.env.VITE_APP_VERSION);
}
})();
2 changes: 1 addition & 1 deletion src/types/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ declare interface SeventvGlobalScope {
stylesheet_file: string;
index_file: string;
};
remote?: boolean;
hosted?: boolean;
}

declare const seventv: SeventvGlobalScope;
Expand Down
2 changes: 1 addition & 1 deletion vite.config.background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig(() => {
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: appName,
VITE_APP_VERSION: getFullVersion(isNightly),
VITE_APP_VERSION_BRANCH: process.env.BRANCH,
VITE_APP_VERSION_BRANCH: process.env.BRANCH || "",
};

return {
Expand Down
2 changes: 1 addition & 1 deletion vite.config.content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default defineConfig(() => {
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: appName,
VITE_APP_VERSION: fullVersion,
VITE_APP_VERSION_BRANCH: process.env.BRANCH,
VITE_APP_VERSION_BRANCH: process.env.BRANCH || "",
VITE_APP_STYLESHEET_NAME: `seventv.style.${fullVersion}.css`,
};

Expand Down
2 changes: 1 addition & 1 deletion vite.config.hosted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig(() => {
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: appName,
VITE_APP_VERSION: fullVersion,
VITE_APP_VERSION_BRANCH: process.env.BRANCH,
VITE_APP_VERSION_BRANCH: process.env.BRANCH || "",
VITE_APP_CHANGELOG: fs.readFileSync(
r(
{
Expand Down
21 changes: 20 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import vuei18n from "@intlify/unplugin-vue-i18n/vite";
import vue from "@vitejs/plugin-vue";
import fs from "fs-extra";
import path from "path";
import obfuscator from "rollup-plugin-obfuscator";
import { defineConfig, loadEnv } from "vite";

const ignoreHMR = [
Expand Down Expand Up @@ -40,7 +41,7 @@ export default defineConfig(() => {
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: appName,
VITE_APP_VERSION: fullVersion,
VITE_APP_VERSION_BRANCH: process.env.BRANCH as BranchName,
VITE_APP_VERSION_BRANCH: (process.env.BRANCH as BranchName) || "",
VITE_APP_CHANGELOG: fs.readFileSync(
r(
{
Expand Down Expand Up @@ -101,6 +102,24 @@ export default defineConfig(() => {
assetFileNames: `assets/seventv.[name].${fullVersion}[extname]`,
chunkFileNames: `assets/seventv.[name].${fullVersion}.js`,
},
plugins: [
obfuscator({
include: ["src/site/site.ts", "src/composable/useWorker.ts"],
options: {
stringArray: true,
stringArrayEncoding: ["rc4"],
stringArrayShuffle: true,
splitStrings: true,
splitStringsChunkLength: 3,
controlFlowFlattening: true,
renameGlobals: true,
transformObjectKeys: true,
selfDefending: true,
numbersToExpressions: true,
seed: Date.now(),
},
}),
],
},
},

Expand Down
2 changes: 1 addition & 1 deletion vite.config.worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig(() => {
...loadEnv(mode, process.cwd()),
VITE_APP_NAME: name,
VITE_APP_VERSION: version,
VITE_APP_VERSION_BRANCH: process.env.BRANCH,
VITE_APP_VERSION_BRANCH: process.env.BRANCH || "",
};

process.stdout.write("Building worker...\n");
Expand Down
Loading

0 comments on commit ac63939

Please sign in to comment.