Spaces:
Sleeping
Sleeping
Julian Bilcke commited on
Commit ·
b6516e1
1
Parent(s): 9009efd
let's make it sound less dramatic
Browse files
src/app/state/{userCurrentUser.ts → useCurrentUser.ts}
RENAMED
|
@@ -100,25 +100,25 @@ export function useCurrentUser({
|
|
| 100 |
|
| 101 |
// can be called many times, but won't do the API call if not necessary
|
| 102 |
const main = async (isLoginRequired: boolean) => {
|
|
|
|
|
|
|
| 103 |
try {
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
localStorage.
|
| 112 |
-
|
| 113 |
-
}
|
| 114 |
} catch (err) {
|
| 115 |
-
console.log("
|
| 116 |
}
|
| 117 |
|
| 118 |
console.log("useCurrentUser()")
|
| 119 |
const searchParams = new URLSearchParams(window.location.search);
|
| 120 |
|
| 121 |
-
|
| 122 |
console.log("debug:", {
|
| 123 |
"window.location.search:": window.location.search,
|
| 124 |
searchParams,
|
|
@@ -199,11 +199,15 @@ export function useCurrentUser({
|
|
| 199 |
state: JSON.stringify({ redirectTo })
|
| 200 |
})
|
| 201 |
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
// should we open this in a new tab?
|
| 209 |
window.location.href = oauthUrl
|
|
|
|
| 100 |
|
| 101 |
// can be called many times, but won't do the API call if not necessary
|
| 102 |
const main = async (isLoginRequired: boolean) => {
|
| 103 |
+
|
| 104 |
+
// DIY
|
| 105 |
try {
|
| 106 |
+
localStorage.setItem(
|
| 107 |
+
"huggingface.co:oauth:nonce",
|
| 108 |
+
localStorage.getItem("aitube.at:oauth:nonce") || ""
|
| 109 |
+
)
|
| 110 |
+
localStorage.removeItem("aitube.co:oauth:code_verifier")
|
| 111 |
+
localStorage.setItem(
|
| 112 |
+
"huggingface.co:oauth:code_verifier",
|
| 113 |
+
localStorage.getItem("aitube.at:oauth:code_verifier") || ""
|
| 114 |
+
)
|
|
|
|
| 115 |
} catch (err) {
|
| 116 |
+
console.log("no pending oauth flow to finish")
|
| 117 |
}
|
| 118 |
|
| 119 |
console.log("useCurrentUser()")
|
| 120 |
const searchParams = new URLSearchParams(window.location.search);
|
| 121 |
|
|
|
|
| 122 |
console.log("debug:", {
|
| 123 |
"window.location.search:": window.location.search,
|
| 124 |
searchParams,
|
|
|
|
| 199 |
state: JSON.stringify({ redirectTo })
|
| 200 |
})
|
| 201 |
|
| 202 |
+
// DIY
|
| 203 |
+
localStorage.setItem(
|
| 204 |
+
"aitube.at:oauth:nonce",
|
| 205 |
+
localStorage.getItem("huggingface.co:oauth:nonce") || ""
|
| 206 |
+
)
|
| 207 |
+
localStorage.setItem(
|
| 208 |
+
"huggingface.at:oauth:code_verifier",
|
| 209 |
+
localStorage.getItem("huggingface.co:oauth:code_verifier") || ""
|
| 210 |
+
)
|
| 211 |
|
| 212 |
// should we open this in a new tab?
|
| 213 |
window.location.href = oauthUrl
|
src/app/views/public-video-view/index.tsx
CHANGED
|
@@ -28,7 +28,7 @@ import { Input } from "@/components/ui/input"
|
|
| 28 |
import { localStorageKeys } from "@/app/state/localStorageKeys"
|
| 29 |
import { defaultSettings } from "@/app/state/defaultSettings"
|
| 30 |
import { getComments, submitComment } from "@/app/server/actions/comments"
|
| 31 |
-
import { useCurrentUser } from "@/app/state/
|
| 32 |
import { useLocalStorage } from "usehooks-ts"
|
| 33 |
|
| 34 |
export function PublicVideoView() {
|
|
|
|
| 28 |
import { localStorageKeys } from "@/app/state/localStorageKeys"
|
| 29 |
import { defaultSettings } from "@/app/state/defaultSettings"
|
| 30 |
import { getComments, submitComment } from "@/app/server/actions/comments"
|
| 31 |
+
import { useCurrentUser } from "@/app/state/useCurrentUser"
|
| 32 |
import { useLocalStorage } from "usehooks-ts"
|
| 33 |
|
| 34 |
export function PublicVideoView() {
|
src/app/views/user-account-view/index.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import { cn } from "@/lib/utils"
|
|
| 7 |
import { ChannelList } from "@/app/interface/channel-list"
|
| 8 |
|
| 9 |
import { getPrivateChannels } from "@/app/server/actions/ai-tube-hf/getPrivateChannels"
|
| 10 |
-
import { useCurrentUser } from "@/app/state/
|
| 11 |
import { Button } from "@/components/ui/button"
|
| 12 |
import { Input } from "@/components/ui/input"
|
| 13 |
|
|
|
|
| 7 |
import { ChannelList } from "@/app/interface/channel-list"
|
| 8 |
|
| 9 |
import { getPrivateChannels } from "@/app/server/actions/ai-tube-hf/getPrivateChannels"
|
| 10 |
+
import { useCurrentUser } from "@/app/state/useCurrentUser"
|
| 11 |
import { Button } from "@/components/ui/button"
|
| 12 |
import { Input } from "@/components/ui/input"
|
| 13 |
|