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()
}
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

View File

@ -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

View File

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

View File

@ -5,7 +5,7 @@
@close="onClose"
@closed="emit('closed')"
>
<template #header>{{ i18n.ts.login }}</template>
<template #header>Login</template>
<MkSignin :auto-set="autoSet" :message="message" @login="onLogin"/>
</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-else-if="char && !useOsNativeEmojis" class="mk-emoji"
// #v-ifdef VITE_CAPACITOR
:src="char2path(char)"
:src="char2filePath(char)"
// #v-else
:src="url"
// #v-endif
@ -36,13 +36,15 @@ const customEmoji = computed(() => 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);

View File

@ -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"));

View File

@ -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" {

View File

@ -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

View File

@ -6,7 +6,7 @@
// #v-endif
<div class="top">
// #v-ifdef VITE_CAPACITOR
//...
<!-- aaa -->
// #v-else
<MkFeaturedPhotos class="bg"/>
<XTimeline class="tl"/>
@ -29,7 +29,7 @@
</div>
<div class="main">
// #v-ifdef VITE_CAPACITOR
//...
<!-- aaa -->
// #v-else
<img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
// #v-endif
@ -45,24 +45,27 @@
</h1>
<div class="about">
// #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
<div class="desc" v-html="meta.description || i18n.ts.headlineMisskey"></div>
// #v-endif
</div>
<div class="action">
// #v-ifdef VITE_CAPACITOR
<div>
<input id="term" v-model="isTerm" type="checkbox" /><label
for="term"
<MkButton inline rounded data-cy-signin @click="signin()">Login</MkButton>
<MkSelect v-model="lang">
<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
><br />
<a href="https://riinswork.space/missRirica/privacy/">
Read Privacy Policy and Terms of Use
</a>
</div>
<MkButton inline rounded data-cy-signin :disabled="!isTerm" @click="signin()">{{ i18n.ts.login }}</MkButton>
{{ x[1] }}
</option>
</MkSelect>
// #v-else
<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>
@ -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';

View File

@ -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,