Revert "Obliteration of Ai-chan 🐱🔫"

This reverts commit 7095abf728.
This commit is contained in:
Eris 2022-08-10 06:10:03 +00:00
parent 6f7d29185f
commit fedc5ffb7a
13 changed files with 116 additions and 8 deletions

View File

@ -57,7 +57,6 @@
- Quotes have solid border
- Reply limit bug fixed
- Make showing the update popup optional
- Obliteration of Ai-chan
- [Make showing ads optional](https://github.com/misskey-dev/misskey/pull/8996)
- [OAuth bearer token authentication](https://github.com/misskey-dev/misskey/pull/9021)
- [Styled Repair Tools](https://github.com/misskey-dev/misskey/pull/8956)

View File

@ -61,4 +61,5 @@ describe('After user signed in', () => {
buildWidgetTest('jobQueue');
buildWidgetTest('button');
buildWidgetTest('aiscript');
buildWidgetTest('aichan');
});

View File

@ -1,6 +1,6 @@
---
_lang_: "English"
headlineMisskey: "An open source, decentralized social media platform that's free forever! 🚀"
headlineMisskey: "A network connected by notes"
introMisskey: "Welcome! Calckey is an open source, decentralized microblogging service.\nCreate \"notes\" to share your thoughts with everyone around you. 📡\nWith \"reactions\", you can also quickly express your feelings about everyone's notes. 👍\nLet's explore a new world! 🚀"
monthAndDay: "{month}/{day}"
search: "Search"

View File

@ -15,7 +15,7 @@ export const packedUserLiteSchema = {
username: {
type: 'string',
nullable: false, optional: false,
example: 'calc',
example: 'ai',
},
host: {
type: 'string',

View File

@ -34,11 +34,11 @@ export const errors = {
},
},
'418': {
'I_AM_CALC': {
'I_AM_AI': {
value: {
error: {
message: 'You sent a request to Calc, Calckey\'s resident stoner furry, instead of the server.',
code: 'I_AM_CALC',
message: 'You sent a request to Ai-chan, Misskey\'s showgirl, instead of the server.',
code: 'I_AM_AI',
id: '60c46cd1-f23a-46b1-bebe-5d2b73951a84',
},
},

View File

@ -156,7 +156,7 @@ export function genOpenapiSpec() {
},
},
'418': {
description: 'I\'m Calc',
description: 'I\'m Ai',
content: {
'application/json': {
schema: {

View File

@ -59,7 +59,7 @@ export default defineComponent({
async openDialog() {
os.alert({
type: 'warning',
title: 'Oh my Calc',
title: 'Oh my Aichan',
text: 'Lorem ipsum dolor sit amet, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
});
},

View File

@ -57,6 +57,7 @@
</FormSwitch>
<FormSwitch v-model="disableDrawer" class="_formBlock">{{ i18n.ts.disableDrawer }}</FormSwitch>
<FormSwitch v-model="showUpdates" class="_formBlock">{{ i18n.ts.showUpdates }}</FormSwitch>
<FormSwitch v-model="aiChanMode">{{ i18n.ts.aiChanMode }}</FormSwitch>
<FormRadios v-model="fontSize" class="_formBlock">
<template #label>{{ i18n.ts.fontSize }}</template>
@ -145,6 +146,7 @@ const enterSendsMessage = computed(defaultStore.makeGetterSetter('enterSendsMess
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));
const squareAvatars = computed(defaultStore.makeGetterSetter('squareAvatars'));
const showUpdates = computed(defaultStore.makeGetterSetter('showUpdates'));
const aiChanMode = computed(defaultStore.makeGetterSetter('aiChanMode'));
watch(lang, () => {
localStorage.setItem('lang', lang.value as string);
@ -173,6 +175,7 @@ watch([
useSystemFont,
enableInfiniteScroll,
squareAvatars,
aiChanMode,
showGapBetweenNotesInTimeline,
instanceTicker,
overridedDeviceKind,

View File

@ -84,6 +84,7 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
'squareAvatars',
'numberOfPageCache',
'showUpdates',
'aiChanMode',
];
const coldDeviceStorageSaveKeys: (keyof typeof ColdDeviceStorage.default)[] = [
'lightTheme',

View File

@ -247,6 +247,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: 5,
},
aiChanMode: {
where: 'device',
default: false,
},
enterSendsMessage: {
where: 'device',
default: true,

View File

@ -34,6 +34,8 @@
<XWidgets v-if="widgetsShowing" class="tray"/>
</transition>
<iframe v-if="$store.state.aiChanMode" ref="live2d" class="ivnzpscs" src="https://misskey-dev.github.io/mascot-web/?scale=2&y=1.4"></iframe>
<XCommon/>
</div>
</template>
@ -144,6 +146,28 @@ onMounted(() => {
window.addEventListener('resize', () => {
isDesktop = (window.innerWidth >= DESKTOP_THRESHOLD);
}, { passive: true });
if (defaultStore.state.aiChanMode) {
const iframeRect = live2d.getBoundingClientRect();
window.addEventListener('mousemove', ev => {
live2d.contentWindow.postMessage({
type: 'moveCursor',
body: {
x: ev.clientX - iframeRect.left,
y: ev.clientY - iframeRect.top,
},
}, '*');
}, { passive: true });
window.addEventListener('touchmove', ev => {
live2d.contentWindow.postMessage({
type: 'moveCursor',
body: {
x: ev.touches[0].clientX - iframeRect.left,
y: ev.touches[0].clientY - iframeRect.top,
},
}, '*');
}, { passive: true });
}
});
</script>

View File

@ -0,0 +1,74 @@
<template>
<MkContainer :naked="widgetProps.transparent" :show-header="false" class="mkw-aichan">
<iframe ref="live2d" class="dedjhjmo" src="https://misskey-dev.github.io/mascot-web/?scale=1.5&y=1.1&eyeY=100" @click="touched"></iframe>
</MkContainer>
</template>
<script lang="ts" setup>
import { onMounted, onUnmounted, reactive, ref } from 'vue';
import { useWidgetPropsManager, Widget, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget';
import { GetFormResultType } from '@/scripts/form';
const name = 'ai';
const widgetPropsDef = {
transparent: {
type: 'boolean' as const,
default: false,
},
};
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
// vueimporttype
//const props = defineProps<WidgetComponentProps<WidgetProps>>();
//const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
const props = defineProps<{ widget?: Widget<WidgetProps>; }>();
const emit = defineEmits<{ (ev: 'updateProps', props: WidgetProps); }>();
const { widgetProps, configure } = useWidgetPropsManager(name,
widgetPropsDef,
props,
emit,
);
const live2d = ref<HTMLIFrameElement>();
const touched = () => {
//if (this.live2d) this.live2d.changeExpression('gurugurume');
};
const onMousemove = (ev: MouseEvent) => {
const iframeRect = live2d.value.getBoundingClientRect();
live2d.value.contentWindow.postMessage({
type: 'moveCursor',
body: {
x: ev.clientX - iframeRect.left,
y: ev.clientY - iframeRect.top,
},
}, '*');
};
onMounted(() => {
window.addEventListener('mousemove', onMousemove, { passive: true });
});
onUnmounted(() => {
window.removeEventListener('mousemove', onMousemove);
});
defineExpose<WidgetComponentExpose>({
name,
configure,
id: props.widget ? props.widget.id : null,
});
</script>
<style lang="scss" scoped>
.dedjhjmo {
width: 100%;
height: 350px;
border: none;
pointer-events: none;
}
</style>

View File

@ -22,6 +22,7 @@ export default function(app: App) {
app.component('MkwInstanceCloud', defineAsyncComponent(() => import('./instance-cloud.vue')));
app.component('MkwButton', defineAsyncComponent(() => import('./button.vue')));
app.component('MkwAiscript', defineAsyncComponent(() => import('./aiscript.vue')));
app.component('MkwAichan', defineAsyncComponent(() => import('./aichan.vue')));
}
export const widgets = [
@ -46,4 +47,5 @@ export const widgets = [
'jobQueue',
'button',
'aiscript',
'aichan',
];