This commit is contained in:
syuilo 2025-08-26 14:22:53 +09:00
parent 05cc8047fa
commit d5475d1ff6
7 changed files with 16 additions and 15 deletions

View File

@ -52,7 +52,7 @@ import { prefer } from '@/preferences.js';
type Ad = (typeof instance)['ads'][number]; type Ad = (typeof instance)['ads'][number];
const props = defineProps<{ const props = defineProps<{
preferForms: string[]; preferForms?: string[];
specify?: Ad; specify?: Ad;
}>(); }>();
@ -71,7 +71,7 @@ const choseAd = (): Ad | null => {
ratio: 0, ratio: 0,
} : ad); } : ad);
let ads = allAds.filter(ad => props.preferForms.includes(ad.place)); let ads = props.preferForms ? allAds.filter(ad => props.preferForms!.includes(ad.place)) : allAds;
if (ads.length === 0) { if (ads.length === 0) {
ads = allAds.filter(ad => ad.place === 'square'); ads = allAds.filter(ad => ad.place === 'square');

View File

@ -140,15 +140,15 @@ function toggleDayOfWeek(ad, index) {
function add() { function add() {
ads.value.unshift({ ads.value.unshift({
id: null, id: '',
memo: '', memo: '',
place: 'square', place: 'square',
priority: 'middle', priority: 'middle',
ratio: 1, ratio: 1,
url: '', url: '',
imageUrl: null, imageUrl: '',
expiresAt: null, expiresAt: new Date().toISOString(),
startsAt: null, startsAt: new Date().toISOString(),
dayOfWeek: 0, dayOfWeek: 0,
}); });
} }
@ -160,7 +160,7 @@ function remove(ad) {
}).then(({ canceled }) => { }).then(({ canceled }) => {
if (canceled) return; if (canceled) return;
ads.value = ads.value.filter(x => x !== ad); ads.value = ads.value.filter(x => x !== ad);
if (ad.id == null) return; if (ad.id === '') return;
os.apiWithDialog('admin/ad/delete', { os.apiWithDialog('admin/ad/delete', {
id: ad.id, id: ad.id,
}).then(() => { }).then(() => {
@ -170,7 +170,7 @@ function remove(ad) {
} }
function save(ad) { function save(ad) {
if (ad.id == null) { if (ad.id === '') {
misskeyApi('admin/ad/create', { misskeyApi('admin/ad/create', {
...ad, ...ad,
expiresAt: new Date(ad.expiresAt).getTime(), expiresAt: new Date(ad.expiresAt).getTime(),
@ -207,7 +207,7 @@ function save(ad) {
} }
function more() { function more() {
misskeyApi('admin/ad/list', { untilId: ads.value.reduce((acc, ad) => ad.id != null ? ad : acc).id, publishing: publishing }).then(adsResponse => { misskeyApi('admin/ad/list', { untilId: ads.value.reduce((acc, ad) => ad.id !== '' ? ad : acc).id, publishing: publishing }).then(adsResponse => {
if (adsResponse == null) return; if (adsResponse == null) return;
ads.value = ads.value.concat(adsResponse.map(r => { ads.value = ads.value.concat(adsResponse.map(r => {
const exdate = new Date(r.expiresAt); const exdate = new Date(r.expiresAt);

View File

@ -75,14 +75,15 @@ onMounted(async () => {
if (!$i) return; if (!$i) return;
try { try {
session.value = await misskeyApi('auth/session/show', { const result = await misskeyApi('auth/session/show', {
token: props.token, token: props.token,
}); });
session.value = result;
// //
if (session.value.app.isAuthorized) { if (result.app.isAuthorized) {
await misskeyApi('auth/accept', { await misskeyApi('auth/accept', {
token: session.value.token, token: result.token,
}); });
accepted(); accepted();
} else { } else {

View File

@ -312,6 +312,7 @@ const headerActions = computed(() => [{
handler: add, handler: add,
}, { }, {
icon: 'ti ti-dots', icon: 'ti ti-dots',
text: i18n.ts.more,
handler: menu, handler: menu,
}]); }]);

View File

@ -161,7 +161,7 @@ async function _fetch_() {
}, },
raw: res.data, raw: res.data,
}; };
} catch (err) { } catch (err: any) {
switch (err.message.toLowerCase()) { switch (err.message.toLowerCase()) {
case 'this theme is already installed': case 'this theme is already installed':
errorKV.value = { errorKV.value = {

View File

@ -34,6 +34,7 @@ const props = defineProps<{
const password = ref(''); const password = ref('');
async function save() { async function save() {
if (props.token == null) return;
await os.apiWithDialog('reset-password', { await os.apiWithDialog('reset-password', {
token: props.token, token: props.token,
password: password.value, password: password.value,

View File

@ -159,8 +159,6 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<div v-if="expandedBlockItems.includes(item.id)" :class="$style.userItemSub"> <div v-if="expandedBlockItems.includes(item.id)" :class="$style.userItemSub">
<div>Blocked at: <MkTime :time="item.createdAt" mode="detail"/></div> <div>Blocked at: <MkTime :time="item.createdAt" mode="detail"/></div>
<div v-if="item.expiresAt">Period: {{ new Date(item.expiresAt).toLocaleString() }}</div>
<div v-else>Period: {{ i18n.ts.indefinitely }}</div>
</div> </div>
</div> </div>
</div> </div>