From 238cfa2d757e53d0dcc157253f38ec6fa1bf2b4f Mon Sep 17 00:00:00 2001 From: cutestnekoaqua Date: Wed, 5 Apr 2023 23:52:42 +0200 Subject: [PATCH] meow! --- packages/client/android/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.properties | 2 +- packages/client/src/components/MkSignin.vue | 19 +++++++----- .../client/src/components/MkSigninDialog.vue | 2 +- .../client/src/components/global/MkEmoji.vue | 6 ++-- packages/client/src/config.ts | 8 ++--- packages/client/src/i18n.ts | 5 ++-- packages/client/src/init.ts | 10 ++++++- .../client/src/pages/welcome.entrance.a.vue | 30 +++++++++++-------- packages/client/vite.config.ts | 9 +++--- 10 files changed, 56 insertions(+), 37 deletions(-) diff --git a/packages/client/android/build.gradle b/packages/client/android/build.gradle index 763ca95e16..ebc4119f34 100644 --- a/packages/client/android/build.gradle +++ b/packages/client/android/build.gradle @@ -7,7 +7,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.2.1' + classpath 'com.android.tools.build:gradle:7.4.0' classpath 'com.google.gms:google-services:4.3.13' // NOTE: Do not place your application dependencies here; they belong diff --git a/packages/client/android/gradle/wrapper/gradle-wrapper.properties b/packages/client/android/gradle/wrapper/gradle-wrapper.properties index 92f06b50fd..2ec77e51a9 100644 --- a/packages/client/android/gradle/wrapper/gradle-wrapper.properties +++ b/packages/client/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/client/src/components/MkSignin.vue b/packages/client/src/components/MkSignin.vue index 72cf3fd906..54c0c1ac31 100644 --- a/packages/client/src/components/MkSignin.vue +++ b/packages/client/src/components/MkSignin.vue @@ -2,10 +2,10 @@ // #v-ifdef VITE_CAPACITOR
@@ -48,7 +48,7 @@ href="https://misskey.io/notes/99l9jqqun2" target="_blank" style="color: var(--link); text-align: center" - >{{ i18n.ts.ririca.howToCreateToken }} + >How to create a access token
// #v-else
@@ -243,7 +243,7 @@ function onSubmit() { signing = true; console.log('submit'); // #v-ifdef VITE_CAPACITOR - if (!token.valueOf()) { + if (token.valueOf()) { login(token, instanceUrlResult); signing = false; // #v-else @@ -331,7 +331,12 @@ function resetPassword() { // #v-ifdef VITE_CAPACITOR let instances = $ref([]); -fetch("https://api.calckey.org/instances.json").then((res) => { +fetch("https://api.calckey.org/instances.json", { + mode: 'cors', + headers: { + 'Access-Control-Allow-Origin':'*' + } +}).then((res) => { res.json().then((data) => { instances = data.instancesInfos; }); diff --git a/packages/client/src/components/MkSigninDialog.vue b/packages/client/src/components/MkSigninDialog.vue index 7e35e45c5a..8ff87e9ac1 100644 --- a/packages/client/src/components/MkSigninDialog.vue +++ b/packages/client/src/components/MkSigninDialog.vue @@ -5,7 +5,7 @@ @close="onClose" @closed="emit('closed')" > - + diff --git a/packages/client/src/components/global/MkEmoji.vue b/packages/client/src/components/global/MkEmoji.vue index 3288c35118..a192cd1346 100644 --- a/packages/client/src/components/global/MkEmoji.vue +++ b/packages/client/src/components/global/MkEmoji.vue @@ -2,7 +2,7 @@ isCustom.value ? ce.value.find(x => x.name == const url = computed(() => { if (char.value) { // #v-ifdef VITE_CAPACITOR +//... // #v-else return char2filePath(char.value); // #v-endif } else { - return defaultStore.state.disableShowingAnimatedImages + const rawUrl = defaultStore.state.disableShowingAnimatedImages ? getStaticImageUrl(customEmoji.value.url) : customEmoji.value.url; + return rawUrl.startsWith("http") ? rawUrl : instanceUrl + rawUrl; } }); const alt = computed(() => customEmoji.value ? `:${customEmoji.value.name}:` : char.value); diff --git a/packages/client/src/config.ts b/packages/client/src/config.ts index 89c25c9430..462f16c922 100644 --- a/packages/client/src/config.ts +++ b/packages/client/src/config.ts @@ -1,6 +1,6 @@ import { $i } from "@/account"; // #v-ifdef VITE_CAPACITOR -const address = $i ? new URL($i.instanceUrl) : "localhost"; +const address = $i ? new URL($i.instanceUrl) : new URL("http://localhost"); // #v-else const address = new URL(location.href); // #v-endif @@ -15,10 +15,10 @@ export const url = $i?.instanceUrl; // #v-else export const url = address.origin; // #v-endif -export const apiUrl = `${url}/api`; -export const wsUrl = `${url +export const apiUrl = `${url ? url : "http://localhost"}/api`; +export const wsUrl = `${url ? url .replace("http://", "ws://") - .replace("https://", "wss://")}/streaming`; + .replace("https://", "wss://") : "ws://localhost"}/streaming`; export const lang = localStorage.getItem("lang"); export const langs = _LANGS_; export const locale = JSON.parse(localStorage.getItem("locale")); diff --git a/packages/client/src/i18n.ts b/packages/client/src/i18n.ts index c45cfee59c..2197332bd8 100644 --- a/packages/client/src/i18n.ts +++ b/packages/client/src/i18n.ts @@ -1,8 +1,9 @@ import { markRaw } from "vue"; -import { locale } from "@/config"; import { I18n } from "@/scripts/i18n"; -export const i18n = markRaw(new I18n(locale)); +const locale = JSON.parse(localStorage.getItem("locale")); +const loader = new I18n(locale); +export const i18n = markRaw(loader); // このファイルに書きたくないけどここに書かないと何故かVeturが認識しない declare module "@vue/runtime-core" { diff --git a/packages/client/src/init.ts b/packages/client/src/init.ts index a112da41d0..1657b68930 100644 --- a/packages/client/src/init.ts +++ b/packages/client/src/init.ts @@ -5,6 +5,12 @@ // https://vitejs.dev/config/build-options.html#build-modulepreload import "vite/modulepreload-polyfill"; +// #v-ifdef VITE_CAPACITOR +console.log("Compiled for Capacitor"); +// #v-else +console.log("Compiled for Web"); +// #v-endif + import "@/style.scss"; import "@phosphor-icons/web/bold"; import "@phosphor-icons/web/fill"; @@ -52,7 +58,7 @@ import { getUrlWithoutLoginId } from "@/scripts/login-id"; import { getAccountFromId } from "@/scripts/get-account-from-id"; import { Device, DeviceInfo } from "@capacitor/device"; import { App } from "@capacitor/app"; -import lightThemeDefault from "@/themes/_light.json5"; +import lightThemeDefault from "@/themes/l-rosepinedawn.json5"; import OneSignal from "onesignal-cordova-plugin"; export let storedDeviceInfo: DeviceInfo; // #v-ifdef VITE_CAPACITOR @@ -215,7 +221,9 @@ const onesignal_app_id = "efe09597-0778-4156-97b7-0bf8f52c21a7"; if (_DEV_) { console.log("not signed in"); } + // #v-ifdef VITE_CAPACITOR applyTheme(lightThemeDefault); + // #v-endif } } //#endregion diff --git a/packages/client/src/pages/welcome.entrance.a.vue b/packages/client/src/pages/welcome.entrance.a.vue index 874c7dd021..e912f213e4 100644 --- a/packages/client/src/pages/welcome.entrance.a.vue +++ b/packages/client/src/pages/welcome.entrance.a.vue @@ -6,7 +6,7 @@ // #v-endif
// #v-ifdef VITE_CAPACITOR - //... + // #v-else @@ -29,7 +29,7 @@
// #v-ifdef VITE_CAPACITOR - //... + // #v-else // #v-endif @@ -45,24 +45,27 @@
// #v-ifdef VITE_CAPACITOR -
+
🌎 Calckey is an open source, decentralized social media platform that's free forever! 🚀
// #v-else
// #v-endif
// #v-ifdef VITE_CAPACITOR -
-
- - Read Privacy Policy and Terms of Use - -
- {{ i18n.ts.login }} + {{ x[1] }} + + // #v-else {{ i18n.ts.signup }} {{ i18n.ts.login }} @@ -90,6 +93,7 @@ import XTimeline from './welcome.timeline.vue'; import MarqueeText from '@/components/MkMarquee.vue'; import XSigninDialog from '@/components/MkSigninDialog.vue'; import XSignupDialog from '@/components/MkSignupDialog.vue'; +import MkSelect from '@/components/form/select.vue'; import MkButton from '@/components/MkButton.vue'; import XNote from '@/components/MkNote.vue'; import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue'; diff --git a/packages/client/vite.config.ts b/packages/client/vite.config.ts index 5cfe236508..3c8ee5ad96 100644 --- a/packages/client/vite.config.ts +++ b/packages/client/vite.config.ts @@ -3,6 +3,8 @@ import pluginVue from '@vitejs/plugin-vue'; import { defineConfig } from 'vite'; import locales from '../../locales'; +import { dependencies } from './package.json'; + import meta from '../../package.json'; import pluginJson5 from './vite.json5'; import viteCompression from 'vite-plugin-compression'; @@ -54,9 +56,6 @@ export default defineConfig(({ command, mode }) => { build: { target: [ - 'chrome87', - 'firefox78', - 'safari14', 'es2017', ], manifest: 'manifest.json', @@ -67,8 +66,8 @@ export default defineConfig(({ command, mode }) => { }, output: { manualChunks: { - vue: ['vue'], - }, + vendor: ['vue'], + } }, }, cssCodeSplit: true,