Merge branch 'develop' into swn

This commit is contained in:
tamaina
2021-11-04 19:14:10 +09:00
54 changed files with 847 additions and 174 deletions

View File

@@ -7,21 +7,21 @@
>
<template #header>{{ $ts.forgotPassword }}</template>
<form class="_monolithic_" @submit.prevent="onSubmit" v-if="$instance.enableEmail">
<div class="_section">
<MkInput v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" spellcheck="false" autofocus required>
<form class="bafeceda" @submit.prevent="onSubmit" v-if="$instance.enableEmail">
<div class="main _formRoot">
<MkInput class="_formBlock" v-model="username" type="text" pattern="^[a-zA-Z0-9_]+$" spellcheck="false" autofocus required>
<template #label>{{ $ts.username }}</template>
<template #prefix>@</template>
</MkInput>
<MkInput v-model="email" type="email" spellcheck="false" required>
<MkInput class="_formBlock" v-model="email" type="email" spellcheck="false" required>
<template #label>{{ $ts.emailAddress }}</template>
<template #caption>{{ $ts._forgotPassword.enterEmail }}</template>
</MkInput>
<MkButton type="submit" :disabled="processing" primary style="margin: 0 auto;">{{ $ts.send }}</MkButton>
<MkButton class="_formBlock" type="submit" :disabled="processing" primary style="margin: 0 auto;">{{ $ts.send }}</MkButton>
</div>
<div class="_section">
<div class="sub">
<MkA to="/about" class="_link">{{ $ts._forgotPassword.ifNoEmail }}</MkA>
</div>
</form>
@@ -69,3 +69,16 @@ export default defineComponent({
}
});
</script>
<style lang="scss" scoped>
.bafeceda {
> .main {
padding: 24px;
}
> .sub {
border-top: solid 0.5px var(--divider);
padding: 24px;
}
}
</style>

View File

@@ -150,26 +150,26 @@ export default defineComponent({
});
};
for (const optionOrOptgroup of options) {
if (optionOrOptgroup.type === 'optgroup') {
const optgroup = optionOrOptgroup;
menu.push({
type: 'label',
text: optgroup.props.label,
});
for (const option of optgroup.children) {
const scanOptions = (options: VNode[]) => {
for (const vnode of options) {
if (vnode.type === 'optgroup') {
const optgroup = vnode;
menu.push({
type: 'label',
text: optgroup.props.label,
});
scanOptions(optgroup.children);
} else if (Array.isArray(vnode.children)) { // 何故かフラグメントになってくることがある
const fragment = vnode;
scanOptions(fragment.children);
} else {
const option = vnode;
pushOption(option);
}
} else if (Array.isArray(optionOrOptgroup.children)) { // 何故かフラグメントになってくることがある
const fragment = optionOrOptgroup;
for (const option of fragment.children) {
pushOption(option);
}
} else {
const option = optionOrOptgroup;
pushOption(option);
}
}
};
scanOptions(options);
os.popupMenu(menu, container.value, {
width: container.value.offsetWidth,

View File

@@ -11,6 +11,7 @@
:title="video.name"
preload="none"
controls
@contextmenu.stop
>
<source
:src="video.url"

View File

@@ -1,13 +1,12 @@
<template>
<MkA class="ldlomzub" :class="{ isMe }" :to="url" v-user-preview="canonical" v-if="url.startsWith('/')">
<span class="me" v-if="isMe">{{ $ts.you }}</span>
<MkA v-if="url.startsWith('/')" class="ldlomzub" :class="{ isMe }" :to="url" v-user-preview="canonical" :style="{ background: bg }">
<img class="icon" :src="`/avatar/@${username}@${host}`" alt="">
<span class="main">
<span class="username">@{{ username }}</span>
<span class="host" v-if="(host != localHost) || $store.state.showFullAcct">@{{ toUnicode(host) }}</span>
</span>
</MkA>
<a class="ldlomzub" :href="url" target="_blank" rel="noopener" v-else>
<a v-else class="ldlomzub" :href="url" target="_blank" rel="noopener" :style="{ background: bg }">
<span class="main">
<span class="username">@{{ username }}</span>
<span class="host">@{{ toUnicode(host) }}</span>
@@ -17,10 +16,11 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { toUnicode } from 'punycode/';
import * as tinycolor from 'tinycolor2';
import { toUnicode } from 'punycode';
import { host as localHost } from '@client/config';
import { wellKnownServices } from '../../well-known-services';
import * as os from '@client/os';
import { $i } from '@client/account';
export default defineComponent({
props: {
@@ -33,53 +33,46 @@ export default defineComponent({
required: true
}
},
data() {
setup(props) {
const canonical = props.host === localHost ? `@${props.username}` : `@${props.username}@${toUnicode(props.host)}`;
const wellKnown = wellKnownServices.find(x => x[0] === props.host);
const url = wellKnown ? wellKnown[1](props.username) : `/${canonical}`;
const isMe = $i && (
`@${props.username}@${toUnicode(props.host)}` === `@${$i.username}@${toUnicode(localHost)}`.toLowerCase()
);
const bg = tinycolor(getComputedStyle(document.documentElement).getPropertyValue(isMe ? '--mentionMe' : '--mention'));
bg.setAlpha(0.20);
return {
localHost
localHost,
isMe,
url,
canonical,
toUnicode,
bg: bg.toRgbString(),
};
},
computed: {
url(): string {
const wellKnown = wellKnownServices.find(x => x[0] === this.host);
if (wellKnown) {
return wellKnown[1](this.username);
} else {
return `/${this.canonical}`;
}
},
canonical(): string {
return this.host === localHost ? `@${this.username}` : `@${this.username}@${toUnicode(this.host)}`;
},
isMe(): boolean {
return this.$i && (
`@${this.username}@${toUnicode(this.host)}` === `@${this.$i.username}@${toUnicode(localHost)}`.toLowerCase()
);
}
},
methods: {
toUnicode
}
});
</script>
<style lang="scss" scoped>
.ldlomzub {
display: inline-block;
padding: 4px 8px 4px 4px;
border-radius: 999px;
color: var(--mention);
&.isMe {
color: var(--mentionMe);
}
> .me {
pointer-events: none;
user-select: none;
font-size: 70%;
vertical-align: top;
}
> .icon {
width: 1.5em;
margin: 0 0.2em;
margin: 0 0.2em 0 0;
vertical-align: bottom;
border-radius: 100%;
}

View File

@@ -11,6 +11,7 @@ import MkGoogle from '@client/components/google.vue';
import MkSparkle from '@client/components/sparkle.vue';
import MkA from '@client/components/global/a.vue';
import { host } from '@client/config';
import { fnNameList } from '@/mfm/fn-name-list';
export default defineComponent({
props: {
@@ -46,7 +47,7 @@ export default defineComponent({
render() {
if (this.text == null || this.text == '') return;
const ast = (this.plain ? mfm.parsePlain : mfm.parse)(this.text);
const ast = (this.plain ? mfm.parsePlain : mfm.parse)(this.text, { fnNameList });
const validTime = (t: string | null | undefined) => {
if (t == null) return null;

View File

@@ -601,6 +601,12 @@ export default defineComponent({
});
},
toggleThreadMute(mute: boolean) {
os.apiWithDialog(mute ? 'notes/thread-muting/create' : 'notes/thread-muting/delete', {
noteId: this.appearNote.id
});
},
getMenu() {
let menu;
if (this.$i) {
@@ -657,6 +663,15 @@ export default defineComponent({
text: this.$ts.watch,
action: () => this.toggleWatch(true)
}) : undefined,
statePromise.then(state => state.isMutedThread ? {
icon: 'fas fa-comment-slash',
text: this.$ts.unmuteThread,
action: () => this.toggleThreadMute(false)
} : {
icon: 'fas fa-comment-slash',
text: this.$ts.muteThread,
action: () => this.toggleThreadMute(true)
}),
this.appearNote.userId == this.$i.id ? (this.$i.pinnedNoteIds || []).includes(this.appearNote.id) ? {
icon: 'fas fa-thumbtack',
text: this.$ts.unpin,

View File

@@ -576,6 +576,12 @@ export default defineComponent({
});
},
toggleThreadMute(mute: boolean) {
os.apiWithDialog(mute ? 'notes/thread-muting/create' : 'notes/thread-muting/delete', {
noteId: this.appearNote.id
});
},
getMenu() {
let menu;
if (this.$i) {
@@ -632,6 +638,15 @@ export default defineComponent({
text: this.$ts.watch,
action: () => this.toggleWatch(true)
}) : undefined,
statePromise.then(state => state.isMutedThread ? {
icon: 'fas fa-comment-slash',
text: this.$ts.unmuteThread,
action: () => this.toggleThreadMute(false)
} : {
icon: 'fas fa-comment-slash',
text: this.$ts.muteThread,
action: () => this.toggleThreadMute(true)
}),
this.appearNote.userId == this.$i.id ? (this.$i.pinnedNoteIds || []).includes(this.appearNote.id) ? {
icon: 'fas fa-thumbtack',
text: this.$ts.unpin,

View File

@@ -48,7 +48,7 @@
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue';
import { computed, defineComponent, toRef } from 'vue';
import MkButton from '@client/components/ui/button.vue';
import MkInput from '@client/components/form/input.vue';
import MkPagination from '@client/components/ui/pagination.vue';
@@ -112,7 +112,7 @@ export default defineComponent({
},
async mounted() {
this.$emit('info', this[symbols.PAGE_INFO]);
this.$emit('info', toRef(this, symbols.PAGE_INFO));
},
methods: {
@@ -168,6 +168,10 @@ export default defineComponent({
<style lang="scss" scoped>
.ogwlenmc {
> .local {
.empty {
margin: var(--margin);
}
.ldhfsamy {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
@@ -210,6 +214,10 @@ export default defineComponent({
}
> .remote {
.empty {
margin: var(--margin);
}
.ldhfsamy {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));

View File

@@ -26,7 +26,7 @@
</template>
<script lang="ts">
import { computed, defineAsyncComponent, defineComponent, nextTick, onMounted, reactive, ref, watch } from 'vue';
import { computed, defineAsyncComponent, defineComponent, isRef, nextTick, onMounted, reactive, ref, watch } from 'vue';
import { i18n } from '@client/i18n';
import MkSuperMenu from '@client/components/ui/super-menu.vue';
import FormGroup from '@client/components/debobigego/group.vue';
@@ -73,7 +73,13 @@ export default defineComponent({
const view = ref(null);
const el = ref(null);
const onInfo = (viewInfo) => {
childInfo.value = viewInfo;
if (isRef(viewInfo)) {
watch(viewInfo, () => {
childInfo.value = viewInfo.value;
}, { immediate: true });
} else {
childInfo.value = viewInfo;
}
};
const pageProps = ref({});

View File

@@ -15,5 +15,6 @@
navBg: '#fff',
panel: '#fff',
panelHeaderDivider: '@divider',
mentionMe: 'rgb(0, 179, 70)',
},
}