feat: offer GitHub login over HTTP when an OAuth app is configured
This commit is contained in:
1 parent
88f8e2f957
commit
63279125a5
19 files changed
+1752
-26
No files matched your search
@@ -1,6 +1,6 @@
|
||||
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
|
||||
|
||||
import type { APIKey, Account, AdminAccount, ErrorInfo, ImportedTrack, Member, MyListen, MyPlaylist, MyPlaylistItem, QQLoginType, QRLogin, QRLoginResult, RoomListing, SharedPlaylist, Source, SourceAccount, StoredMedia, Track } from '../realtime/protocol.gen'
|
||||
import type { APIKey, Account, AdminAccount, ErrorInfo, GitHubClient, GitHubIntent, ImportedTrack, Member, MyListen, MyPlaylist, MyPlaylistItem, QQLoginType, QRLogin, QRLoginResult, RoomListing, SharedPlaylist, Source, SourceAccount, StoredMedia, Track } from '../realtime/protocol.gen'
|
||||
|
||||
export interface AddMyPlaylistItemRequest {
|
||||
track: Track
|
||||
@@ -39,6 +39,12 @@ export interface AdminGetBilibiliCredentialResponse {
|
||||
set: boolean
|
||||
}
|
||||
|
||||
export interface AdminGetGithubCredentialResponse {
|
||||
callbackUrl: string
|
||||
clientId: string | null
|
||||
clientSecretSet: boolean
|
||||
}
|
||||
|
||||
export interface AdminGetNeteaseCredentialResponse {
|
||||
account: SourceAccount | null
|
||||
set: boolean
|
||||
@@ -77,6 +83,11 @@ export interface AdminResetAccountPasswordResponse {
|
||||
|
||||
export type AdminResetRoomApiKeyRequest = Record<string, never>
|
||||
|
||||
export interface AdminSetGithubCredentialRequest {
|
||||
clientId: string
|
||||
clientSecret: string
|
||||
}
|
||||
|
||||
export interface AdminSetYoutubeCredentialRequest {
|
||||
cookies: string
|
||||
}
|
||||
@@ -161,6 +172,17 @@ export interface CreateTicketResponse {
|
||||
|
||||
export type EnableListenRecordingRequest = Record<string, never>
|
||||
|
||||
export interface FinishGithubLoginRequest {
|
||||
code: string
|
||||
nonce: string
|
||||
}
|
||||
|
||||
export interface FinishGithubLoginResponse {
|
||||
account: Account
|
||||
member: Member
|
||||
memberToken?: string
|
||||
}
|
||||
|
||||
export interface GetMeResponse {
|
||||
account?: Account
|
||||
member: Member
|
||||
@@ -169,6 +191,7 @@ export interface GetMeResponse {
|
||||
|
||||
export interface GetSiteResponse {
|
||||
brandName: string
|
||||
githubLogin: boolean
|
||||
registrationOpen: boolean
|
||||
}
|
||||
|
||||
@@ -281,6 +304,21 @@ export interface ShareMyPlaylistResponse {
|
||||
shareId: string
|
||||
}
|
||||
|
||||
export interface StartGithubLoginRequest {
|
||||
client?: GitHubClient
|
||||
currentPassword?: string
|
||||
intent: GitHubIntent
|
||||
nonce: string
|
||||
}
|
||||
|
||||
export interface StartGithubLoginResponse {
|
||||
url: string
|
||||
}
|
||||
|
||||
export interface UnbindGithubRequest {
|
||||
currentPassword: string
|
||||
}
|
||||
|
||||
export interface UpdateMeRequest {
|
||||
email?: string
|
||||
name?: string
|
||||
@@ -350,6 +388,9 @@ export function httpClient(send: HttpSend) {
|
||||
adminGetYoutubeCredential: () => send<AdminGetYoutubeCredentialResponse>({ method: 'GET', path: '/api/admin/credentials/youtube', auth: 'admin' }),
|
||||
adminSetYoutubeCredential: (body: AdminSetYoutubeCredentialRequest) => send<void>({ method: 'PUT', path: '/api/admin/credentials/youtube', auth: 'admin', body }),
|
||||
adminDeleteYoutubeCredential: () => send<void>({ method: 'DELETE', path: '/api/admin/credentials/youtube', auth: 'admin' }),
|
||||
adminGetGithubCredential: () => send<AdminGetGithubCredentialResponse>({ method: 'GET', path: '/api/admin/credentials/github', auth: 'admin' }),
|
||||
adminSetGithubCredential: (body: AdminSetGithubCredentialRequest) => send<void>({ method: 'PUT', path: '/api/admin/credentials/github', auth: 'admin', body }),
|
||||
adminDeleteGithubCredential: () => send<void>({ method: 'DELETE', path: '/api/admin/credentials/github', auth: 'admin' }),
|
||||
adminListMedia: () => send<AdminListMediaResponse>({ method: 'GET', path: '/api/admin/media', auth: 'admin' }),
|
||||
adminDeleteMedia: (key: string) => send<void>({ method: 'DELETE', path: `/api/admin/media/${encodeURIComponent(key)}`, auth: 'admin' }),
|
||||
adminUpdateSite: (body: AdminUpdateSiteRequest) => send<AdminUpdateSiteResponse>({ method: 'PATCH', path: '/api/admin/site', auth: 'admin', body }),
|
||||
@@ -368,5 +409,8 @@ export function httpClient(send: HttpSend) {
|
||||
copySharedPlaylist: (shareId: string, body: CopySharedPlaylistRequest) => send<MyPlaylist>({ method: 'POST', path: `/api/shared-playlists/${encodeURIComponent(shareId)}/copies`, auth: 'member', body }),
|
||||
createPairingCode: () => send<CreatePairingCodeResponse>({ method: 'POST', path: '/api/account/pairing-codes', auth: 'member', body: {} }),
|
||||
redeemPairingCode: (body: RedeemPairingCodeRequest) => send<RedeemPairingCodeResponse>({ method: 'POST', path: '/api/sessions/pairing', auth: 'member', body }),
|
||||
startGithubLogin: (body: StartGithubLoginRequest) => send<StartGithubLoginResponse>({ method: 'POST', path: '/api/auth/github', auth: 'member', body }),
|
||||
finishGithubLogin: (body: FinishGithubLoginRequest) => send<FinishGithubLoginResponse>({ method: 'POST', path: '/api/auth/github/exchange', auth: 'member', body }),
|
||||
unbindGithub: (body: UnbindGithubRequest) => send<void>({ method: 'POST', path: '/api/account/github/removals', auth: 'member', body }),
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protocolgen from protocol/idl.json; DO NOT EDIT.
|
||||
|
||||
export const PROTOCOL_VERSION = '0023496d94e1b43f'
|
||||
export const PROTOCOL_VERSION = '6bee23791ffa52ad'
|
||||
|
||||
export interface APIKey {
|
||||
key: string
|
||||
@@ -50,6 +50,10 @@ export interface ErrorInfo {
|
||||
message: string
|
||||
}
|
||||
|
||||
export type GitHubClient = 'web' | 'app'
|
||||
|
||||
export type GitHubIntent = 'login' | 'bind' | 'verify'
|
||||
|
||||
export interface HelloRequest {
|
||||
protocolVersion: string
|
||||
roomId: string
|
||||
|
||||
Reference in new issue
Block a user