jbilcke-hf HF staff commited on
Commit
54bc655
1 Parent(s): b00b9a2

debugging oauth

Browse files
src/app/api/login.ts ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { NextResponse, NextRequest } from "next/server"
2
+
3
+ export async function GET(req: NextRequest) {
4
+ console.log("Received GET /api/login:", req.url)
5
+ return NextResponse.redirect("https://aitube.at")
6
+ }
7
+
8
+ export async function POST(req: NextRequest, res: NextResponse) {
9
+ const data = await req.json()
10
+ console.log(data)
11
+ console.log("Received POST /api/login:", req.url)
12
+ return NextResponse.redirect("https://aitube.at")
13
+ }
src/app/state/userCurrentUser.ts CHANGED
@@ -130,12 +130,10 @@ export function useCurrentUser({
130
  }, [isLoginRequired, huggingfaceApiKey, huggingfaceTemporaryApiKey, userId])
131
 
132
 
133
- const login = async (redirectUrlOrPath: string = "") => {
134
-
135
- const redirectUrl = redirectUrlOrPath[0] === "/"
136
- ? `https://jbilcke-hf-ai-tube.hf.space${redirectUrlOrPath || ""}`
137
- : redirectUrlOrPath ? redirectUrlOrPath
138
- : ""
139
 
140
  const oauthUrl = await oauthLoginUrl({
141
  /**
@@ -171,12 +169,12 @@ export function useCurrentUser({
171
  *
172
  * For Developer Applications, you can add any URL you want to the list of allowed redirect URIs at https://huggingface.co/settings/connected-applications.
173
  */
174
- redirectUrl,
175
 
176
  /**
177
  * State to pass to the OAuth provider, which will be returned in the call to `oauthLogin` after the redirect.
178
  */
179
- // state: ""
180
  })
181
 
182
  window.location.href = oauthUrl
 
130
  }, [isLoginRequired, huggingfaceApiKey, huggingfaceTemporaryApiKey, userId])
131
 
132
 
133
+ const login = async (
134
+ // used to redirect the user back to the route they were browsing
135
+ redirectTo: string = ""
136
+ ) => {
 
 
137
 
138
  const oauthUrl = await oauthLoginUrl({
139
  /**
 
169
  *
170
  * For Developer Applications, you can add any URL you want to the list of allowed redirect URIs at https://huggingface.co/settings/connected-applications.
171
  */
172
+ redirectUrl: "https://aitube.at/api/login",
173
 
174
  /**
175
  * State to pass to the OAuth provider, which will be returned in the call to `oauthLogin` after the redirect.
176
  */
177
+ state: JSON.stringify({ redirectTo })
178
  })
179
 
180
  window.location.href = oauthUrl
src/clap/types.ts CHANGED
@@ -1,7 +1,12 @@
1
 
2
  export type ClapSegmentCategory = "render" | "preview" | "characters" | "location" | "time" | "era" | "lighting" | "weather" | "action" | "music" | "sound" | "dialogue" | "style" | "camera" | "generic"
3
  export type ClapOutputType = "text" | "movement" | "image" | "video" | "audio"
4
- export type ClapSegmentStatus = "pending" | "completed" | "error"
 
 
 
 
 
5
 
6
  export type ClapAuthor =
7
  | "auto" // the element was edited automatically using basic if/else logical rules
 
1
 
2
  export type ClapSegmentCategory = "render" | "preview" | "characters" | "location" | "time" | "era" | "lighting" | "weather" | "action" | "music" | "sound" | "dialogue" | "style" | "camera" | "generic"
3
  export type ClapOutputType = "text" | "movement" | "image" | "video" | "audio"
4
+ export type ClapSegmentStatus =
5
+ | "to_generate"
6
+ | "to_interpolate"
7
+ | "to_upscale"
8
+ | "completed"
9
+ | "error"
10
 
11
  export type ClapAuthor =
12
  | "auto" // the element was edited automatically using basic if/else logical rules
src/lib/getInitialRenderedScene.ts CHANGED
@@ -2,7 +2,7 @@ import { RenderedScene } from "@/types/general"
2
 
3
  export const getInitialRenderedScene = (): RenderedScene => ({
4
  renderId: "",
5
- status: "pending",
6
  assetUrl: "",
7
  alt: "",
8
  error: "",
 
2
 
3
  export const getInitialRenderedScene = (): RenderedScene => ({
4
  renderId: "",
5
+ status: "to_generate",
6
  assetUrl: "",
7
  alt: "",
8
  error: "",
src/types/general.ts CHANGED
@@ -68,7 +68,10 @@ export interface ImageSegment {
68
  }
69
 
70
  export type RenderedSceneStatus =
71
- | "pending"
 
 
 
72
  | "completed"
73
  | "error"
74
 
 
68
  }
69
 
70
  export type RenderedSceneStatus =
71
+ | "pending" // for retro-compatibility only, but this is deprecated
72
+ | "to_generate"
73
+ | "to_interpolate"
74
+ | "to_upscale"
75
  | "completed"
76
  | "error"
77