This commit is contained in:
cutestnekoaqua 2023-04-05 23:52:42 +02:00
parent 18d1f6eaaa
commit 238cfa2d75
No known key found for this signature in database
GPG Key ID: 6BF0964A5069C1E0
10 changed files with 56 additions and 37 deletions

View File

@ -7,7 +7,7 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { 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' classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -2,10 +2,10 @@
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
<form class="eppvobhk" :class="{ signing }" @submit.prevent="onSubmit"> <form class="eppvobhk" :class="{ signing }" @submit.prevent="onSubmit">
<div class="normal-signin"> <div class="normal-signin">
{{ i18n.ts.ririca.instance }} Instance
<MkSelect v-model="instanceUrl" large :model-value="instances[0]?.url"> <MkSelect v-model="instanceUrl" large :model-value="instances[0]?.url">
<option value="other"> <option value="other">
{{ i18n.ts.ririca.selectInstanceYourself }} Select other instance
</option> </option>
<option <option
v-for="(instance, i) in instances" v-for="(instance, i) in instances"
@ -25,7 +25,7 @@
required required
/> />
</template> </template>
{{ i18n.ts.ririca.accessToken }} Access Token
<MkInput <MkInput
v-model="token" v-model="token"
:spellcheck="false" :spellcheck="false"
@ -40,7 +40,7 @@
:disabled="signing" :disabled="signing"
style="margin: 0 auto" style="margin: 0 auto"
> >
{{ signing ? i18n.ts.loggingIn : i18n.ts.login }} {{ signing ? "Logging in" : "Login" }}
</MkButton> </MkButton>
</div> </div>
<div style="display: flex; justify-content: center"></div> <div style="display: flex; justify-content: center"></div>
@ -48,7 +48,7 @@
href="https://misskey.io/notes/99l9jqqun2" href="https://misskey.io/notes/99l9jqqun2"
target="_blank" target="_blank"
style="color: var(--link); text-align: center" style="color: var(--link); text-align: center"
>{{ i18n.ts.ririca.howToCreateToken }}</a> >How to create a access token</a>
</form> </form>
// #v-else // #v-else
<form class="eppvobhk _monolithic_" :class="{ signing, totpLogin }" @submit.prevent="onSubmit"> <form class="eppvobhk _monolithic_" :class="{ signing, totpLogin }" @submit.prevent="onSubmit">
@ -243,7 +243,7 @@ function onSubmit() {
signing = true; signing = true;
console.log('submit'); console.log('submit');
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
if (!token.valueOf()) { if (token.valueOf()) {
login(token, instanceUrlResult); login(token, instanceUrlResult);
signing = false; signing = false;
// #v-else // #v-else
@ -331,7 +331,12 @@ function resetPassword() {
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
let instances = $ref([]); 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) => { res.json().then((data) => {
instances = data.instancesInfos; instances = data.instancesInfos;
}); });

View File

@ -5,7 +5,7 @@
@close="onClose" @close="onClose"
@closed="emit('closed')" @closed="emit('closed')"
> >
<template #header>{{ i18n.ts.login }}</template> <template #header>Login</template>
<MkSignin :auto-set="autoSet" :message="message" @login="onLogin"/> <MkSignin :auto-set="autoSet" :message="message" @login="onLogin"/>
</XModalWindow> </XModalWindow>

View File

@ -2,7 +2,7 @@
<img v-if="customEmoji" class="mk-emoji custom" :class="{ normal, noStyle }" :src="url" :alt="alt" :title="alt" decoding="async"/> <img v-if="customEmoji" class="mk-emoji custom" :class="{ normal, noStyle }" :src="url" :alt="alt" :title="alt" decoding="async"/>
<img v-else-if="char && !useOsNativeEmojis" class="mk-emoji" <img v-else-if="char && !useOsNativeEmojis" class="mk-emoji"
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
:src="char2path(char)" :src="char2filePath(char)"
// #v-else // #v-else
:src="url" :src="url"
// #v-endif // #v-endif
@ -36,13 +36,15 @@ const customEmoji = computed(() => isCustom.value ? ce.value.find(x => x.name ==
const url = computed(() => { const url = computed(() => {
if (char.value) { if (char.value) {
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
//...
// #v-else // #v-else
return char2filePath(char.value); return char2filePath(char.value);
// #v-endif // #v-endif
} else { } else {
return defaultStore.state.disableShowingAnimatedImages const rawUrl = defaultStore.state.disableShowingAnimatedImages
? getStaticImageUrl(customEmoji.value.url) ? getStaticImageUrl(customEmoji.value.url)
: customEmoji.value.url; : customEmoji.value.url;
return rawUrl.startsWith("http") ? rawUrl : instanceUrl + rawUrl;
} }
}); });
const alt = computed(() => customEmoji.value ? `:${customEmoji.value.name}:` : char.value); const alt = computed(() => customEmoji.value ? `:${customEmoji.value.name}:` : char.value);

View File

@ -1,6 +1,6 @@
import { $i } from "@/account"; import { $i } from "@/account";
// #v-ifdef VITE_CAPACITOR // #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 // #v-else
const address = new URL(location.href); const address = new URL(location.href);
// #v-endif // #v-endif
@ -15,10 +15,10 @@ export const url = $i?.instanceUrl;
// #v-else // #v-else
export const url = address.origin; export const url = address.origin;
// #v-endif // #v-endif
export const apiUrl = `${url}/api`; export const apiUrl = `${url ? url : "http://localhost"}/api`;
export const wsUrl = `${url export const wsUrl = `${url ? url
.replace("http://", "ws://") .replace("http://", "ws://")
.replace("https://", "wss://")}/streaming`; .replace("https://", "wss://") : "ws://localhost"}/streaming`;
export const lang = localStorage.getItem("lang"); export const lang = localStorage.getItem("lang");
export const langs = _LANGS_; export const langs = _LANGS_;
export const locale = JSON.parse(localStorage.getItem("locale")); export const locale = JSON.parse(localStorage.getItem("locale"));

View File

@ -1,8 +1,9 @@
import { markRaw } from "vue"; import { markRaw } from "vue";
import { locale } from "@/config";
import { I18n } from "@/scripts/i18n"; 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が認識しない // このファイルに書きたくないけどここに書かないと何故かVeturが認識しない
declare module "@vue/runtime-core" { declare module "@vue/runtime-core" {

View File

@ -5,6 +5,12 @@
// https://vitejs.dev/config/build-options.html#build-modulepreload // https://vitejs.dev/config/build-options.html#build-modulepreload
import "vite/modulepreload-polyfill"; 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 "@/style.scss";
import "@phosphor-icons/web/bold"; import "@phosphor-icons/web/bold";
import "@phosphor-icons/web/fill"; import "@phosphor-icons/web/fill";
@ -52,7 +58,7 @@ import { getUrlWithoutLoginId } from "@/scripts/login-id";
import { getAccountFromId } from "@/scripts/get-account-from-id"; import { getAccountFromId } from "@/scripts/get-account-from-id";
import { Device, DeviceInfo } from "@capacitor/device"; import { Device, DeviceInfo } from "@capacitor/device";
import { App } from "@capacitor/app"; import { App } from "@capacitor/app";
import lightThemeDefault from "@/themes/_light.json5"; import lightThemeDefault from "@/themes/l-rosepinedawn.json5";
import OneSignal from "onesignal-cordova-plugin"; import OneSignal from "onesignal-cordova-plugin";
export let storedDeviceInfo: DeviceInfo; export let storedDeviceInfo: DeviceInfo;
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
@ -215,7 +221,9 @@ const onesignal_app_id = "efe09597-0778-4156-97b7-0bf8f52c21a7";
if (_DEV_) { if (_DEV_) {
console.log("not signed in"); console.log("not signed in");
} }
// #v-ifdef VITE_CAPACITOR
applyTheme(lightThemeDefault); applyTheme(lightThemeDefault);
// #v-endif
} }
} }
//#endregion //#endregion

View File

@ -6,7 +6,7 @@
// #v-endif // #v-endif
<div class="top"> <div class="top">
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
//... <!-- aaa -->
// #v-else // #v-else
<MkFeaturedPhotos class="bg"/> <MkFeaturedPhotos class="bg"/>
<XTimeline class="tl"/> <XTimeline class="tl"/>
@ -29,7 +29,7 @@
</div> </div>
<div class="main"> <div class="main">
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
//... <!-- aaa -->
// #v-else // #v-else
<img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/> <img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
// #v-endif // #v-endif
@ -45,24 +45,27 @@
</h1> </h1>
<div class="about"> <div class="about">
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
<div class="desc" v-html="i18n.ts.headlineMisskey"></div> <div class="desc">🌎 Calckey is an open source, decentralized social media platform that's free forever! 🚀</div>
// #v-else // #v-else
<div class="desc" v-html="meta.description || i18n.ts.headlineMisskey"></div> <div class="desc" v-html="meta.description || i18n.ts.headlineMisskey"></div>
// #v-endif // #v-endif
</div> </div>
<div class="action"> <div class="action">
// #v-ifdef VITE_CAPACITOR // #v-ifdef VITE_CAPACITOR
<div> <MkButton inline rounded data-cy-signin @click="signin()">Login</MkButton>
<input id="term" v-model="isTerm" type="checkbox" /><label <MkSelect v-model="lang">
for="term" <template #label>{{ i18n.ts.uiLanguage }}</template>
<p>{{ lang }}</p>
<p>{{ langs }}</p>
<option
v-for="x in langs"
:key="x[0]"
:value="x[0]"
:selected="x[0] === lang"
> >
Agree to Privacy Policy and Terms of Use</label {{ x[1] }}
><br /> </option>
<a href="https://riinswork.space/missRirica/privacy/"> </MkSelect>
Read Privacy Policy and Terms of Use
</a>
</div>
<MkButton inline rounded data-cy-signin :disabled="!isTerm" @click="signin()">{{ i18n.ts.login }}</MkButton>
// #v-else // #v-else
<MkButton inline rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.signup }}</MkButton> <MkButton inline rounded gradate data-cy-signup style="margin-right: 12px;" @click="signup()">{{ i18n.ts.signup }}</MkButton>
<MkButton inline rounded data-cy-signin @click="signin()">{{ i18n.ts.login }}</MkButton> <MkButton inline rounded data-cy-signin @click="signin()">{{ i18n.ts.login }}</MkButton>
@ -90,6 +93,7 @@ import XTimeline from './welcome.timeline.vue';
import MarqueeText from '@/components/MkMarquee.vue'; import MarqueeText from '@/components/MkMarquee.vue';
import XSigninDialog from '@/components/MkSigninDialog.vue'; import XSigninDialog from '@/components/MkSigninDialog.vue';
import XSignupDialog from '@/components/MkSignupDialog.vue'; import XSignupDialog from '@/components/MkSignupDialog.vue';
import MkSelect from '@/components/form/select.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import XNote from '@/components/MkNote.vue'; import XNote from '@/components/MkNote.vue';
import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue'; import MkFeaturedPhotos from '@/components/MkFeaturedPhotos.vue';

View File

@ -3,6 +3,8 @@ import pluginVue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
import locales from '../../locales'; import locales from '../../locales';
import { dependencies } from './package.json';
import meta from '../../package.json'; import meta from '../../package.json';
import pluginJson5 from './vite.json5'; import pluginJson5 from './vite.json5';
import viteCompression from 'vite-plugin-compression'; import viteCompression from 'vite-plugin-compression';
@ -54,9 +56,6 @@ export default defineConfig(({ command, mode }) => {
build: { build: {
target: [ target: [
'chrome87',
'firefox78',
'safari14',
'es2017', 'es2017',
], ],
manifest: 'manifest.json', manifest: 'manifest.json',
@ -67,8 +66,8 @@ export default defineConfig(({ command, mode }) => {
}, },
output: { output: {
manualChunks: { manualChunks: {
vue: ['vue'], vendor: ['vue'],
}, }
}, },
}, },
cssCodeSplit: true, cssCodeSplit: true,