From b21aa42aaa0199f80665ce955c29887f64f41233 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Thu, 26 Jan 2023 14:39:19 -0500 Subject: [PATCH] add static link --- .devcontainer/Caddyfile | 8 ++++++-- .gitignore | 1 + audon-fe/src/locales/en.yaml | 5 ++++- audon-fe/src/locales/ja.yaml | 5 ++++- audon-fe/src/router/index.js | 22 ---------------------- audon-fe/src/stores/mastodon.js | 7 +++++++ audon-fe/src/views/HomeView.vue | 14 +++++++++++++- 7 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.devcontainer/Caddyfile b/.devcontainer/Caddyfile index f66d147..e6c844b 100644 --- a/.devcontainer/Caddyfile +++ b/.devcontainer/Caddyfile @@ -5,10 +5,14 @@ audon.localhost { path /app/* /api/* /storage/* /u/* } handle @backend { - reverse_proxy devcontainer:8100 + reverse_proxy devcontainer:8100 { + flush_interval -1 + } } handle { - reverse_proxy devcontainer:5173 + reverse_proxy devcontainer:5173 { + flush_interval -1 + } } } diff --git a/.gitignore b/.gitignore index e194ad2..f8c06c5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ # Go workspace file go.work +__debug_bin ### Node ### # Logs diff --git a/audon-fe/src/locales/en.yaml b/audon-fe/src/locales/en.yaml index 1f5442c..78e9c9d 100644 --- a/audon-fe/src/locales/en.yaml +++ b/audon-fe/src/locales/en.yaml @@ -25,6 +25,9 @@ editRoom: "Room Edit" comingFuture: "Coming with future update!" processing: "Processing now...
Keep this window open!" lostWarning: "Unsaved data will be lost if you leave the page, are you sure?" +staticLink: + title: "Your Static Link" + hint: "Other can join to your room via this link while you're hosting." form: title: "Title" titleRequired: "Room title required" @@ -46,7 +49,7 @@ roomReady: header: "Your room is ready!" message: "Your room \"{title}\" is now ready. Share the following URL with other participants." errors: - offline: "This user is offline now." + offline: "This user is not hosting now." invalidAddress: "Invalid address" serverNotFound: "Instance not found" notFound: "{value} not found" diff --git a/audon-fe/src/locales/ja.yaml b/audon-fe/src/locales/ja.yaml index 49820f7..f6116b3 100644 --- a/audon-fe/src/locales/ja.yaml +++ b/audon-fe/src/locales/ja.yaml @@ -25,6 +25,9 @@ editRoom: "部屋の編集" comingFuture: "今後のアップデートで追加予定" processing: "処理中です。
画面を閉じないでください。" lostWarning: "この画面を閉じると保存前の内容が失われます。構いませんか?" +staticLink: + title: "固定リンク" + hint: "プロフィール欄などに固定しておくと、あなたが部屋をホストしたとき他の人はこのリンクを使って参加できます。" form: title: "タイトル" titleRequired: "部屋の名前を入力してください" @@ -46,7 +49,7 @@ roomReady: header: "お部屋の用意ができました!" message: "{title} を作りました。参加者に以下の URL を共有してください。" errors: - offline: "このユーザーは現在オフラインです。" + offline: "このユーザーは現在ホスト中ではありません。" invalidAddress: "アドレスが有効ではありません" serverNotFound: "サーバーが見つかりません" notFound: "{value} が見つかりません" diff --git a/audon-fe/src/router/index.js b/audon-fe/src/router/index.js index c72d103..55523cf 100644 --- a/audon-fe/src/router/index.js +++ b/audon-fe/src/router/index.js @@ -2,7 +2,6 @@ import { createRouter, createWebHistory } from "vue-router"; import LoginView from "../views/LoginView.vue"; import RoomView from "../views/RoomView.vue"; import ErrorView from "../views/ErrorView.vue"; -import axios from "axios"; const router = createRouter({ history: createWebHistory(import.meta.env.BASE_URL), @@ -49,27 +48,6 @@ const router = createRouter({ }, component: RoomView, }, - { - path: "/u/:webfinger", - name: "currentHosting", - meta: { - noauth: true, - }, - redirect: async (to) => { - try { - const resp = await axios.get(`/u/${to.params.webfinger}`); - if (resp.status === 302) { - return { - name: "room", - params: { id: resp.headers.location }, - }; - } - } catch (error) { - console.log(error); - } - return { name: "notfound" }; - }, - }, ], }); diff --git a/audon-fe/src/stores/mastodon.js b/audon-fe/src/stores/mastodon.js index f2df163..83bc837 100644 --- a/audon-fe/src/stores/mastodon.js +++ b/audon-fe/src/stores/mastodon.js @@ -24,6 +24,13 @@ export const useMastodonStore = defineStore("mastodon", { } return ""; }, + myStaticLink() { + if (this.oauth.audon?.webfinger) { + const url = new URL(location.href); + return `${url.origin}/u/@${this.oauth.audon.webfinger}`; + } + return ""; + } }, actions: { async fetchToken() { diff --git a/audon-fe/src/views/HomeView.vue b/audon-fe/src/views/HomeView.vue index f734f1f..78acb4e 100644 --- a/audon-fe/src/views/HomeView.vue +++ b/audon-fe/src/views/HomeView.vue @@ -2,10 +2,12 @@ import { useMastodonStore } from "../stores/mastodon"; import axios from "axios"; import { some } from "lodash-es"; +import { mdiLinkVariant } from "@mdi/js"; export default { setup() { return { + mdiLinkVariant, donStore: useMastodonStore(), }; }, @@ -49,7 +51,7 @@ export default { {{ $t("logout") }} -
+
+
+ + +

{{ $t("staticLink.hint") }}

+
+