Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/invite #11

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2956,6 +2956,10 @@ export interface Locale extends ILocale {
* 添付画像のサムネイルをオリジナル画質にする
*/
"loadRawImages": string;
/**
* 猫化(nyaize)を強制的に無効にする
*/
"denyaize": string;
/**
* アニメーション画像を再生しない
*/
Expand Down Expand Up @@ -4908,6 +4912,10 @@ export interface Locale extends ILocale {
* リトライ
*/
"gameRetry": string;
/**
* QRコード
*/
"qrcode": string;
"_bubbleGame": {
/**
* 遊び方
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ enableHorizontalSwipe: "スワイプしてタブを切り替える"
loading: "読み込み中"
surrender: "やめる"
gameRetry: "リトライ"
qrcode: "QRコード"

_bubbleGame:
howToPlay: "遊び方"
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"lint": "pnpm typecheck && pnpm eslint"
},
"dependencies": {
"@chenfengyuan/vue-qrcode": "^2.0.0",
"@discordapp/twemoji": "15.0.2",
"@github/webauthn-json": "2.1.1",
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
Expand Down
14 changes: 14 additions & 0 deletions packages/frontend/src/components/MkInviteCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div :class="$style.buttons">
<MkButton v-if="!invite.used && !isExpired" primary rounded @click="copyInviteCode()"><i class="ti ti-copy"></i> {{ i18n.ts.copy }}</MkButton>
<MkButton v-if="!invite.used && !isExpired" primary rounded @click="copyInviteCodeAsLink()"><i class="ti ti-copy"></i> {{ i18n.ts.copyLink }}</MkButton>
<MkButton v-if="!invite.used || moderator" danger rounded @click="deleteCode()"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
</div>
<div v-if="!invite.used && !isExpired">
<div :class="$style.label">{{ i18n.ts.qrcode }}</div>
<vue-qrcode :value="inviteUrl" :options="option" tag="img"></vue-qrcode>
</div>
</div>
</MkFolder>
</template>
Expand All @@ -65,6 +70,7 @@ import MkButton from '@/components/MkButton.vue';
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import VueQrcode from "@chenfengyuan/vue-qrcode";

const props = defineProps<{
invite: Misskey.entities.InviteCode;
Expand All @@ -79,6 +85,8 @@ const isExpired = computed(() => {
return props.invite.expiresAt && new Date(props.invite.expiresAt) < new Date();
});

const inviteUrl = `${(new URL(window.location.href)).origin}/?invite=${props.invite.code}`;

function deleteCode() {
os.apiWithDialog('invite/delete', {
inviteId: props.invite.id,
Expand All @@ -90,6 +98,12 @@ function copyInviteCode() {
copyToClipboard(props.invite.code);
os.success();
}

function copyInviteCodeAsLink() {
copyToClipboard(inviteUrl);
os.success();
}

</script>

<style lang="scss" module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const buttonEl = shallowRef<HTMLElement>();

const emojiName = computed(() => props.reaction.replace(/:/g, '').replace(/@\./, ''));
const emoji = computed(() => customEmojisMap.get(emojiName.value) ?? getUnicodeEmoji(props.reaction));
const isCustomEmoji = computed(() => props.reaction.includes(':'));

const canToggle = computed(() => {
return !props.reaction.match(/@\w/) && $i && emoji.value && checkReactionPermissions($i, props.note, emoji.value);
Expand All @@ -77,7 +78,7 @@ async function toggleReaction() {
}
misskeyApi('notes/reactions/delete', {
noteId: props.note.id,
reaction: (isCustomEmoji.value) ? `:${emoji.value.name}:` : props.reaction,
reaction: (isCustomEmoji.value) ? `:${emojiName.value}:` : props.reaction,
});
} else {
sound.playMisskeySfx('reaction');
Expand Down
4 changes: 3 additions & 1 deletion packages/frontend/src/components/MkSignupDialog.form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ import { i18n } from '@/i18n.js';

const props = withDefaults(defineProps<{
autoSet?: boolean;
initialInvitationCode?: string;
}>(), {
autoSet: false,
initialInvitationCode: '',
});

const emit = defineEmits<{
Expand All @@ -111,7 +113,7 @@ const turnstile = ref<Captcha | undefined>();
const username = ref<string>('');
const password = ref<string>('');
const retypedPassword = ref<string>('');
const invitationCode = ref<string>('');
const invitationCode = ref<string>(props.initialInvitationCode);
const email = ref('');
const usernameState = ref<null | 'wait' | 'ok' | 'unavailable' | 'error' | 'invalid-format' | 'min-range' | 'max-range'>(null);
const emailState = ref<null | 'wait' | 'ok' | 'unavailable:used' | 'unavailable:format' | 'unavailable:disposable' | 'unavailable:banned' | 'unavailable:mx' | 'unavailable:smtp' | 'unavailable' | 'error'>(null);
Expand Down
6 changes: 5 additions & 1 deletion packages/frontend/src/components/MkSignupDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<XServerRules @done="isAcceptedServerRule = true" @cancel="dialog?.close()"/>
</template>
<template v-else>
<XSignup :autoSet="autoSet" @signup="onSignup" @signupEmailPending="onSignupEmailPending"/>
<XSignup :autoSet="autoSet" :initialInvitationCode="invitecodeParam" @signup="onSignup" @signupEmailPending="onSignupEmailPending"/>
</template>
</Transition>
</div>
Expand Down Expand Up @@ -55,6 +55,10 @@ const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();

const isAcceptedServerRule = ref(false);

// URLからinvitecodeパラメータを取得
const urlParams = new URLSearchParams(window.location.search);
const invitecodeParam = urlParams.get('invite') || '';

function onSignup(res: Misskey.entities.SigninResponse) {
emit('done', res);
dialog.value?.close();
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/src/components/global/MkCustomEmoji.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const importEmoji = async (emojiName) => {
if (!localCheckResponse) {
const emoji = (await misskeyApi('admin/emoji/list-remote', {
query: emojiName,
host: props.host,
})).find((_emoji) => _emoji.name === emojiName);
await os.apiWithDialog('admin/emoji/copy', {
emojiId: emoji.id,
Expand Down
Loading
Loading