This commit is contained in:
Julien Calixte
2026-03-10 16:33:24 +01:00
parent 1135afb359
commit af49b233ef
2 changed files with 10 additions and 7 deletions

View File

@@ -1,11 +1,11 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue' import { ref } from "vue"
import { useATProtoLogin } from '@/hooks/useATProtoLogin.hook' import { useATProtoLogin } from "@/hooks/useATProtoLogin.hook"
const { handle, isLoggedIn, signIn, signOut } = useATProtoLogin() const { handle, isLoggedIn, signIn, signOut } = useATProtoLogin()
const inputHandle = ref('') const inputHandle = ref("")
const onSignIn = () => { const onSignIn = () => {
if (inputHandle.value) { if (inputHandle.value) {
@@ -24,7 +24,7 @@ const onSignIn = () => {
v-model="inputHandle" v-model="inputHandle"
class="input input-sm" class="input input-sm"
type="text" type="text"
placeholder="yourhandle.bsky.social" placeholder="alice.bsky.social"
@keyup.enter="onSignIn" @keyup.enter="onSignIn"
/> />
<button class="btn btn-sm" @click="onSignIn">Sign in with Bluesky</button> <button class="btn btn-sm" @click="onSignIn">Sign in with Bluesky</button>

View File

@@ -1,9 +1,12 @@
import { BrowserOAuthClient, buildLoopbackClientId } from '@atproto/oauth-client-browser' import {
BrowserOAuthClient,
buildLoopbackClientId,
} from "@atproto/oauth-client-browser"
const getClientId = () => const getClientId = () =>
import.meta.env.DEV import.meta.env.DEV
? buildLoopbackClientId(new URL(window.location.origin)) ? buildLoopbackClientId(new URL(window.location.origin))
: 'https://remanso.space/client-metadata.json' : "https://remanso.space/client-metadata.json"
let clientPromise: Promise<BrowserOAuthClient> | null = null let clientPromise: Promise<BrowserOAuthClient> | null = null
@@ -11,7 +14,7 @@ export const getOAuthClient = (): Promise<BrowserOAuthClient> => {
if (!clientPromise) { if (!clientPromise) {
clientPromise = BrowserOAuthClient.load({ clientPromise = BrowserOAuthClient.load({
clientId: getClientId(), clientId: getClientId(),
handleResolver: 'https://bsky.social', handleResolver: "https://bsky.social",
}) })
} }
return clientPromise return clientPromise