2022-12-28 06:29:42 +02:00
|
|
|
import * as os from '@/os';
|
|
|
|
import { instance } from '@/instance';
|
|
|
|
import { host } from '@/config';
|
|
|
|
import { i18n } from '@/i18n';
|
2023-01-13 07:22:53 +02:00
|
|
|
import { $i } from '@/account';
|
2022-12-28 06:29:42 +02:00
|
|
|
|
|
|
|
export function openInstanceMenu(ev: MouseEvent) {
|
|
|
|
os.popupMenu([{
|
|
|
|
text: instance.name ?? host,
|
|
|
|
type: 'label',
|
|
|
|
}, {
|
|
|
|
type: 'link',
|
|
|
|
text: i18n.ts.instanceInfo,
|
|
|
|
icon: 'ti ti-info-circle',
|
|
|
|
to: '/about',
|
|
|
|
}, {
|
|
|
|
type: 'link',
|
|
|
|
text: i18n.ts.customEmojis,
|
2022-12-31 13:36:49 +02:00
|
|
|
icon: 'ti ti-icons',
|
2022-12-28 06:29:42 +02:00
|
|
|
to: '/about#emojis',
|
|
|
|
}, {
|
|
|
|
type: 'link',
|
|
|
|
text: i18n.ts.federation,
|
|
|
|
icon: 'ti ti-whirl',
|
|
|
|
to: '/about#federation',
|
|
|
|
}, {
|
|
|
|
type: 'link',
|
|
|
|
text: i18n.ts.charts,
|
|
|
|
icon: 'ti ti-chart-line',
|
|
|
|
to: '/about#charts',
|
|
|
|
}, null, {
|
2023-03-18 07:30:16 +02:00
|
|
|
type: 'link',
|
|
|
|
text: i18n.ts.ads,
|
|
|
|
icon: 'ti ti-ad',
|
|
|
|
to: '/ads',
|
|
|
|
}, {
|
2022-12-28 06:29:42 +02:00
|
|
|
type: 'parent',
|
2022-12-28 06:34:47 +02:00
|
|
|
text: i18n.ts.tools,
|
|
|
|
icon: 'ti ti-tool',
|
2022-12-28 06:29:42 +02:00
|
|
|
children: [{
|
|
|
|
type: 'link',
|
|
|
|
to: '/scratchpad',
|
|
|
|
text: i18n.ts.scratchpad,
|
|
|
|
icon: 'ti ti-terminal-2',
|
|
|
|
}, {
|
|
|
|
type: 'link',
|
|
|
|
to: '/api-console',
|
|
|
|
text: 'API Console',
|
|
|
|
icon: 'ti ti-terminal-2',
|
2023-01-08 10:41:09 +02:00
|
|
|
}, {
|
|
|
|
type: 'link',
|
|
|
|
to: '/clicker',
|
|
|
|
text: '🍪👈',
|
|
|
|
icon: 'ti ti-cookie',
|
2023-01-15 13:52:53 +02:00
|
|
|
}, ($i && ($i.isAdmin || $i.policies.canInvite) && instance.disableRegistration) ? {
|
2023-01-13 07:22:53 +02:00
|
|
|
text: i18n.ts.invite,
|
|
|
|
icon: 'ti ti-user-plus',
|
|
|
|
action: () => {
|
|
|
|
os.api('invite').then(x => {
|
|
|
|
os.alert({
|
|
|
|
type: 'info',
|
|
|
|
text: x.code,
|
|
|
|
});
|
|
|
|
}).catch(err => {
|
|
|
|
os.alert({
|
|
|
|
type: 'error',
|
|
|
|
text: err,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2023-01-15 13:52:53 +02:00
|
|
|
} : undefined, ($i && ($i.isAdmin || $i.policies.canManageCustomEmojis)) ? {
|
2023-01-13 07:58:27 +02:00
|
|
|
type: 'link',
|
|
|
|
to: '/custom-emojis-manager',
|
|
|
|
text: i18n.ts.manageCustomEmojis,
|
|
|
|
icon: 'ti ti-icons',
|
2023-01-13 07:22:53 +02:00
|
|
|
} : undefined],
|
2022-12-28 06:34:47 +02:00
|
|
|
}, null, {
|
|
|
|
text: i18n.ts.help,
|
2023-04-22 02:00:37 +03:00
|
|
|
icon: 'ti ti-help-circle',
|
2023-01-09 06:39:16 +02:00
|
|
|
action: () => {
|
|
|
|
window.open('https://misskey-hub.net/help.html', '_blank');
|
|
|
|
},
|
2022-12-28 06:29:42 +02:00
|
|
|
}, {
|
|
|
|
type: 'link',
|
|
|
|
text: i18n.ts.aboutMisskey,
|
|
|
|
to: '/about-misskey',
|
|
|
|
}], ev.currentTarget ?? ev.target, {
|
|
|
|
align: 'left',
|
|
|
|
});
|
|
|
|
}
|