Skip to content

Commit

Permalink
revert misskey-web ui (partially)
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih committed Apr 7, 2023
1 parent 4c1e13d commit ae22b5b
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 366 deletions.
8 changes: 0 additions & 8 deletions packages/backend/src/server/web/ClientServerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,14 +476,6 @@ export class ClientServerService {
}
});

// Note Embed
fastify.get<{ Params: { note: string; } }>('/notes/:note/embed', async (request, reply) => {
reply.removeHeader('X-Frame-Options');
reply.header("X-Robots-Tag", "noindex");

return await renderBase(reply);
});

// Page
fastify.get<{ Params: { user: string; page: string; } }>('/@:user/pages/:page', async (request, reply) => {
const { username, host } = Acct.parse(request.params.user);
Expand Down
2 changes: 0 additions & 2 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"eventemitter3": "5.0.0",
"gsap": "3.11.5",
"idb-keyval": "6.2.0",
"iframe-resizer": "^4.3.6",
"insert-text-at-cursor": "0.3.0",
"is-file-animated": "1.0.2",
"json5": "2.2.3",
Expand Down Expand Up @@ -98,7 +97,6 @@
"@types/estree": "1.0.0",
"@types/gulp": "4.0.10",
"@types/gulp-rename": "2.0.1",
"@types/iframe-resizer": "^3.5.9",
"@types/matter-js": "0.18.2",
"@types/micromatch": "3.1.1",
"@types/node": "18.15.11",
Expand Down
107 changes: 28 additions & 79 deletions packages/frontend/src/components/MkNoteDetailed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@
<div class="username"><MkAcct :user="appearNote.user"/></div>
<MkInstanceTicker v-if="showTicker" class="ticker" :instance="appearNote.user.instance"/>
</div>
<div v-if="embed" class="instance-info">
<button v-click-anime class="_button" @click="openInstanceMenu">
<img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" class="icon"/>
</button>
</div>
</header>
<div class="main">
<div class="body">
Expand Down Expand Up @@ -96,54 +91,32 @@
</MkA>
</div>
<MkReactionsViewer ref="reactionsViewer" :note="appearNote"/>
<template v-if="embed">
<MkA class="button _button" :to="notePage(appearNote)">
<i class="ti ti-arrow-back-up"></i>
<p v-if="appearNote.repliesCount > 0" class="count">{{ appearNote.repliesCount }}</p>
</MkA>
<MkA v-if="canRenote" class="button _button" :to="notePage(appearNote)">
<i class="ti ti-repeat"></i>
<p v-if="appearNote.renoteCount > 0" class="count">{{ appearNote.renoteCount }}</p>
</MkA>
<MkA v-if="appearNote.myReaction == null" class="button _button" :to="notePage(appearNote)">
<i v-if="appearNote.reactionAcceptance === 'likeOnly'" class="ti ti-heart"></i>
<i v-else class="ti ti-plus"></i>
</MkA>
<MkA v-if="appearNote.myReaction != null" class="button _button reacted" :to="notePage(appearNote)">
<i class="ti ti-minus"></i>
</MkA>
<MkA v-if="defaultStore.state.showClipButtonInNoteFooter" class="button _button" :to="notePage(appearNote)">
<i class="ti ti-paperclip"></i>
</MkA>
</template>
<template v-else>
<button class="button _button" @click="reply()">
<i class="ti ti-arrow-back-up"></i>
<p v-if="appearNote.repliesCount > 0" class="count">{{ appearNote.repliesCount }}</p>
</button>
<button
v-if="canRenote"
ref="renoteButton"
class="button _button"
@mousedown="renote()"
>
<i class="ti ti-repeat"></i>
<p v-if="appearNote.renoteCount > 0" class="count">{{ appearNote.renoteCount }}</p>
</button>
<button v-else class="button _button" disabled>
<i class="ti ti-ban"></i>
</button>
<button v-if="appearNote.myReaction == null" ref="reactButton" class="button _button" @mousedown="react()">
<i v-if="appearNote.reactionAcceptance === 'likeOnly'" class="ti ti-heart"></i>
<i v-else class="ti ti-plus"></i>
</button>
<button v-if="appearNote.myReaction != null" ref="reactButton" class="button _button reacted" @click="undoReact(appearNote)">
<i class="ti ti-minus"></i>
</button>
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" class="button _button" @mousedown="clip()">
<i class="ti ti-paperclip"></i>
</button>
</template>
<button class="button _button" @click="reply()">
<i class="ti ti-arrow-back-up"></i>
<p v-if="appearNote.repliesCount > 0" class="count">{{ appearNote.repliesCount }}</p>
</button>
<button
v-if="canRenote"
ref="renoteButton"
class="button _button"
@mousedown="renote()"
>
<i class="ti ti-repeat"></i>
<p v-if="appearNote.renoteCount > 0" class="count">{{ appearNote.renoteCount }}</p>
</button>
<button v-else class="button _button" disabled>
<i class="ti ti-ban"></i>
</button>
<button v-if="appearNote.myReaction == null" ref="reactButton" class="button _button" @mousedown="react()">
<i v-if="appearNote.reactionAcceptance === 'likeOnly'" class="ti ti-heart"></i>
<i v-else class="ti ti-plus"></i>
</button>
<button v-if="appearNote.myReaction != null" ref="reactButton" class="button _button reacted" @click="undoReact(appearNote)">
<i class="ti ti-minus"></i>
</button>
<button v-if="defaultStore.state.showClipButtonInNoteFooter" ref="clipButton" class="button _button" @mousedown="clip()">
<i class="ti ti-paperclip"></i>
</button>
<button ref="menuButton" class="button _button" @mousedown="menu()">
<i class="ti ti-dots"></i>
</button>
Expand Down Expand Up @@ -185,8 +158,6 @@ import { defaultStore, noteViewInterruptors } from '@/store';
import { reactionPicker } from '@/scripts/reaction-picker';
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
import { $i } from '@/account';
import { instance } from '@/instance';
import { openInstanceMenu } from '@/ui/_common_/common';
import { i18n } from '@/i18n';
import { getNoteClipMenu, getNoteMenu } from '@/scripts/get-note-menu';
import { useNoteCapture } from '@/scripts/use-note-capture';
Expand All @@ -199,7 +170,6 @@ import MkRippleEffect from '@/components/MkRippleEffect.vue';
const props = defineProps<{
note: misskey.entities.Note;
pinned?: boolean;
embed?: boolean;
}>();
const inChannel = inject('inChannel', null);
Expand Down Expand Up @@ -408,12 +378,12 @@ function onContextmenu(ev: MouseEvent): void {
ev.preventDefault();
react();
} else {
os.contextMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, embed: props.embed }), ev).then(focus);
os.contextMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted }), ev).then(focus);
}
}
function menu(viaKeyboard = false): void {
os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, embed: props.embed }), menuButton.value, {
os.popupMenu(getNoteMenu({ note: note, translating, translation, menuButton, isDeleted }), menuButton.value, {
viaKeyboard,
}).then(focus);
}
Expand Down Expand Up @@ -494,10 +464,6 @@ if (appearNote.replyId) {
&:hover > .article > .main > .footer > .button {
opacity: 1;
&:hover {
text-decoration: none;
}
}
> .reply-to {
Expand Down Expand Up @@ -612,19 +578,6 @@ if (appearNote.replyId) {
word-wrap: anywhere;
}
}
> .instance-info {
flex-shrink: 0;
padding-left: 16px;
width: 39px;
height: 39px;
img {
width: 100%;
height: auto;
border-radius: 4px;
}
}
}
> .main {
Expand Down Expand Up @@ -781,10 +734,6 @@ if (appearNote.replyId) {
width: 50px;
height: 50px;
}
> .instance-info {
width: 33px;
height: 33px;
}
}
> .main {
Expand Down
91 changes: 31 additions & 60 deletions packages/frontend/src/components/global/MkA.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { url } from '@/config';
import { popout as popout_ } from '@/scripts/popout';
import { i18n } from '@/i18n';
import { useRouter } from '@/router';
import { MenuItem } from '@/types/menu';
const props = withDefaults(defineProps<{
to: string;
Expand All @@ -34,60 +33,37 @@ const active = $computed(() => {
return resolved.route.name === router.currentRoute.value.name;
});
function onContextmenu(ev : Event) {
function onContextmenu(ev) {
const selection = window.getSelection();
if ((selection && selection.toString() !== '')) return;
let contextMenuItem: MenuItem[] = [];
if (router.currentRoute.value.name?.toLowerCase().includes("embed")) {
contextMenuItem = [{
type: 'label',
text: props.to,
}, {
icon: 'ti ti-external-link',
text: i18n.ts.openInNewTab,
action: () => {
window.open(props.to, '_blank');
},
}, {
icon: 'ti ti-link',
text: i18n.ts.copyLink,
action: () => {
copyToClipboard(`${url}${props.to}`);
},
}];
} else {
contextMenuItem = [{
type: 'label',
text: props.to,
}, {
icon: 'ti ti-app-window',
text: i18n.ts.openInWindow,
action: () => {
os.pageWindow(props.to);
},
}, {
icon: 'ti ti-player-eject',
text: i18n.ts.showInPage,
action: () => {
router.push(props.to, 'forcePage');
},
}, null, {
icon: 'ti ti-external-link',
text: i18n.ts.openInNewTab,
action: () => {
window.open(props.to, '_blank');
},
}, {
icon: 'ti ti-link',
text: i18n.ts.copyLink,
action: () => {
copyToClipboard(`${url}${props.to}`);
},
}];
}
os.contextMenu(contextMenuItem, ev);
if (selection && selection.toString() !== '') return;
os.contextMenu([{
type: 'label',
text: props.to,
}, {
icon: 'ti ti-app-window',
text: i18n.ts.openInWindow,
action: () => {
os.pageWindow(props.to);
},
}, {
icon: 'ti ti-player-eject',
text: i18n.ts.showInPage,
action: () => {
router.push(props.to, 'forcePage');
},
}, null, {
icon: 'ti ti-external-link',
text: i18n.ts.openInNewTab,
action: () => {
window.open(props.to, '_blank');
},
}, {
icon: 'ti ti-link',
text: i18n.ts.copyLink,
action: () => {
copyToClipboard(`${url}${props.to}`);
},
}], ev);
}
function openWindow() {
Expand All @@ -103,11 +79,6 @@ function popout() {
}
function nav(ev: MouseEvent) {
if (router.currentRoute.value.name?.toLowerCase().includes("embed")) {
window.open(props.to, '_blank');
return;
}
if (props.behavior === 'browser') {
location.href = props.to;
return;
Expand All @@ -127,4 +98,4 @@ function nav(ev: MouseEvent) {
router.push(props.to, ev.ctrlKey ? 'forcePage' : null);
}
</script>
</script>
1 change: 0 additions & 1 deletion packages/frontend/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ try {
} catch (err) {}

const app = createApp(
window.location.href.includes("/embed") ? defineAsyncComponent(() => import('@/ui/embed.vue')) :
window.location.search === '?zen' ? defineAsyncComponent(() => import('@/ui/zen.vue')) :
!$i ? defineAsyncComponent(() => import('@/ui/visitor.vue')) :
ui === 'deck' ? defineAsyncComponent(() => import('@/ui/deck.vue')) :
Expand Down
Loading

0 comments on commit ae22b5b

Please sign in to comment.