mirror of
https://github.com/misskey-dev/misskey
synced 2024-11-24 23:26:35 +09:00
Improve ad
This commit is contained in:
parent
5b250c15f8
commit
47fa7bb22a
@ -758,6 +758,10 @@ low: "低"
|
|||||||
emailNotConfiguredWarning: "メールアドレスの設定がされていません。"
|
emailNotConfiguredWarning: "メールアドレスの設定がされていません。"
|
||||||
ratio: "比率"
|
ratio: "比率"
|
||||||
|
|
||||||
|
_ad:
|
||||||
|
back: "戻る"
|
||||||
|
reduceFrequencyOfThisAd: "この広告の表示頻度を下げる"
|
||||||
|
|
||||||
_forgotPassword:
|
_forgotPassword:
|
||||||
enterEmail: "アカウントに登録したメールアドレスを入力してください。そのアドレス宛てに、パスワードリセット用のリンクが送信されます。"
|
enterEmail: "アカウントに登録したメールアドレスを入力してください。そのアドレス宛てに、パスワードリセット用のリンクが送信されます。"
|
||||||
ifNoEmail: "メールアドレスを登録していない場合は、管理者までお問い合わせください。"
|
ifNoEmail: "メールアドレスを登録していない場合は、管理者までお問い合わせください。"
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
<div class="menu" v-else>
|
<div class="menu" v-else>
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div>Ads by {{ host }}</div>
|
<div>Ads by {{ host }}</div>
|
||||||
<!--<MkButton>{{ $ts.stopThisAd }}</MkButton>-->
|
<!--<MkButton class="button" primary>{{ $ts._ad.like }}</MkButton>-->
|
||||||
<button class="_textButton" @click="toggleMenu">{{ $ts.close }}</button>
|
<MkButton v-if="ad.ratio !== 0" class="button" @click="reduceFrequency">{{ $ts._ad.reduceFrequencyOfThisAd }}</MkButton>
|
||||||
|
<button class="_textButton" @click="toggleMenu">{{ $ts._ad.back }}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -22,6 +23,8 @@ import { defineComponent, ref } from 'vue';
|
|||||||
import { Instance, instance } from '@client/instance';
|
import { Instance, instance } from '@client/instance';
|
||||||
import { host } from '@client/config';
|
import { host } from '@client/config';
|
||||||
import MkButton from '@client/components/ui/button.vue';
|
import MkButton from '@client/components/ui/button.vue';
|
||||||
|
import { defaultStore } from '@client/store';
|
||||||
|
import * as os from '@client/os';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
@ -50,10 +53,15 @@ export default defineComponent({
|
|||||||
return props.specify as Instance['ads'][number];
|
return props.specify as Instance['ads'][number];
|
||||||
}
|
}
|
||||||
|
|
||||||
let ads = instance.ads.filter(ad => props.prefer.includes(ad.place));
|
const allAds = instance.ads.map(ad => defaultStore.state.mutedAds.includes(ad.id) ? {
|
||||||
|
...ad,
|
||||||
|
ratio: 0
|
||||||
|
} : ad);
|
||||||
|
|
||||||
|
let ads = allAds.filter(ad => props.prefer.includes(ad.place));
|
||||||
|
|
||||||
if (ads.length === 0) {
|
if (ads.length === 0) {
|
||||||
ads = instance.ads.filter(ad => ad.place === 'square');
|
ads = allAds.filter(ad => ad.place === 'square');
|
||||||
}
|
}
|
||||||
|
|
||||||
const lowPriorityAds = ads.filter(ad => ad.ratio === 0);
|
const lowPriorityAds = ads.filter(ad => ad.ratio === 0);
|
||||||
@ -82,11 +90,23 @@ export default defineComponent({
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const chosen = ref(choseAd());
|
||||||
|
|
||||||
|
const reduceFrequency = () => {
|
||||||
|
if (chosen.value == null) return;
|
||||||
|
if (defaultStore.state.mutedAds.includes(chosen.value.id)) return;
|
||||||
|
defaultStore.push('mutedAds', chosen.value.id);
|
||||||
|
os.success();
|
||||||
|
chosen.value = choseAd();
|
||||||
|
showMenu.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ad: choseAd(),
|
ad: chosen,
|
||||||
showMenu,
|
showMenu,
|
||||||
toggleMenu,
|
toggleMenu,
|
||||||
host,
|
host,
|
||||||
|
reduceFrequency,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -170,6 +190,10 @@ export default defineComponent({
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
border: solid 1px var(--divider);
|
border: solid 1px var(--divider);
|
||||||
|
|
||||||
|
> .button {
|
||||||
|
margin: 8px auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ export type Instance = {
|
|||||||
category: string;
|
category: string;
|
||||||
}[];
|
}[];
|
||||||
ads: {
|
ads: {
|
||||||
|
id: string;
|
||||||
ratio: number;
|
ratio: number;
|
||||||
place: string;
|
place: string;
|
||||||
url: string;
|
url: string;
|
||||||
|
@ -55,6 +55,10 @@ export const defaultStore = markRaw(new Storage('base', {
|
|||||||
where: 'account',
|
where: 'account',
|
||||||
default: []
|
default: []
|
||||||
},
|
},
|
||||||
|
mutedAds: {
|
||||||
|
where: 'account',
|
||||||
|
default: [] as string[]
|
||||||
|
},
|
||||||
|
|
||||||
menu: {
|
menu: {
|
||||||
where: 'deviceAccount',
|
where: 'deviceAccount',
|
||||||
|
@ -509,6 +509,7 @@ export default define(meta, async (ps, me) => {
|
|||||||
maxNoteTextLength: Math.min(instance.maxNoteTextLength, DB_MAX_NOTE_TEXT_LENGTH),
|
maxNoteTextLength: Math.min(instance.maxNoteTextLength, DB_MAX_NOTE_TEXT_LENGTH),
|
||||||
emojis: await Emojis.packMany(emojis),
|
emojis: await Emojis.packMany(emojis),
|
||||||
ads: ads.map(ad => ({
|
ads: ads.map(ad => ({
|
||||||
|
id: ad.id,
|
||||||
url: ad.url,
|
url: ad.url,
|
||||||
place: ad.place,
|
place: ad.place,
|
||||||
ratio: ad.ratio,
|
ratio: ad.ratio,
|
||||||
|
Loading…
Reference in New Issue
Block a user