-
-
Notifications
You must be signed in to change notification settings - Fork 20
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: use oauth for login #29
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for nimbus-docs canceled.
|
✅ Deploy Preview for nimbus-town ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
The CI is failing because of a pnpm error, @anbraten can you check if you have installed the new dependency with the right command ? (You can check the contributing guide to see how it should be done.) |
This comment was marked as resolved.
This comment was marked as resolved.
@@ -15,7 +15,7 @@ if (import.meta.server && !route.path.startsWith('/settings')) { | |||
} | |||
|
|||
// We want to trigger rerendering the page when account changes | |||
const key = computed(() => `${currentUser.value?.server ?? currentServer.value}:${currentUser.value?.account.id || ''}`) | |||
const key = computed(() => currentUserDid.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: did is the globally unique id of a bsyk account.
@@ -1,5 +1,5 @@ | |||
<script setup lang="ts"> | |||
const { busy, oauth, singleInstanceServer } = useSignIn() | |||
const { busy, signIn, singleInstanceServer } = useSignIn() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: renamed oauth to signIn to not get confused with oauth-callback
const input = server.value.trim() | ||
if (input.startsWith('https://')) | ||
server.value = input.replace('https://', '') | ||
const input = handle.value.trim() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: removed quite some code here as you don't need to select a server with bsky as there is an integrated discovery system for a handle / did.
import type { mastodon } from 'masto' | ||
|
||
export function getDisplayName(account: mastodon.v1.Account, options?: { rich?: boolean }) { | ||
// TODO: remove once mastondon support was replaced | ||
export type Account = mastodon.v1.Account | ProfileViewDetailed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: to avoid too many changes I changed most of these functions to accept bsky and mastodon accounts for now.
if (fromServer !== server) | ||
loginTo(masto, { server }) | ||
if (fromServer !== server) { | ||
// loginTo(masto, did) // TODO: do we need to change accounts for links? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: This needs some further investigation later on as we don't know the server of a post we would always use the currently active did. Only issue might be that only another did which was used before has access to see a post / etc. Not sure how we would know this.
"@atcute/client": "^2.0.6", | ||
"@atcute/oauth-browser-client": "^1.0.7", | ||
"@atproto/api": "^0.13.18", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: For now using atcute lib for api calls and oauth and @atproto for types til the tsky lib exports them.
@@ -139,9 +142,9 @@ | |||
"sharp-ico": "^0.1.5", | |||
"simple-git-hooks": "^2.11.1", | |||
"tsx": "^4.19.2", | |||
"typescript": "^5.4.4", | |||
"typescript": "5.6.2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: Had to be pinned to avoid an error with vue-tsc
<template v-if="currentUser"> | ||
<p>Hello {{ currentUser?.profile.handle }}!</p> | ||
<p>Here you will see your timeline later on</p> | ||
</template> | ||
<template v-else> | ||
<p>You are currently not authenticated.</p> | ||
<p>Here you will see a public timeline later on</p> | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: for now only showing the currently active handle. In the next step this should be replace with a bsky feed.
// eslint-disable-next-line no-console | ||
console.log('todo, do we need to reload?') | ||
// setTimeout(() => { | ||
// window.location.reload() | ||
// }, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: as we do reload vue components in app.vue
with a computed on the current handle already this should probably be not necessary. Currently keeping it so we could debug with the console statement.
closes #28
Basic login support by entering handle / did. It uses
@atcute/oauth-browser-client
and@atcute/client
for now. The profile info is loaded after login.It's not perfect yet and some parts have been ignored for now to keep changes in this PR to a minimum. Thereby next tasks would be:
composables/users.ts
and remove mastodon related helpers