mirror of
https://github.com/gradio-app/gradio.git
synced 2025-04-12 12:40:29 +08:00
Fix auth when connecting via HTTP (#3223)
* Fix + test * Remove print statements + fix import for 3.7 * CHANGELOG * Remove more print statements * Add 60 second timeout for uploading data * Fix test * Add unsecure token * Undo diff * Add CHANGELOG * Fix on main * remove __gradio_loader__ --------- Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
This commit is contained in:
parent
3530a86433
commit
9b2119f297
@ -72,6 +72,7 @@ By [@dawoodkhan82](https://github.com/dawoodkhan82) in [PR 3165](https://github.
|
||||
* The `change` event is now triggered when users click the 'Clear All' button of the multiselect DropDown component by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3195](https://github.com/gradio-app/gradio/pull/3195)
|
||||
* Support Chinese pinyin in Dataframe by [@aliabid94](https://github.com/aliabid94) in [PR 3206](https://github.com/gradio-app/gradio/pull/3206)
|
||||
* The `clear` event is now triggered when images are cleared by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3218](https://github.com/gradio-app/gradio/pull/3218)
|
||||
* Fix bug where auth cookies where not sent when connecting to an app via http by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3223](https://github.com/gradio-app/gradio/pull/3223)
|
||||
|
||||
## Documentation Changes:
|
||||
* Sort components in docs by alphabetic order by [@aliabd](https://github.com/aliabd) in [PR 3152](https://github.com/gradio-app/gradio/pull/3152)
|
||||
|
@ -148,7 +148,9 @@ class App(FastAPI):
|
||||
@app.get("/user")
|
||||
@app.get("/user/")
|
||||
def get_current_user(request: fastapi.Request) -> Optional[str]:
|
||||
token = request.cookies.get("access-token")
|
||||
token = request.cookies.get("access-token") or request.cookies.get(
|
||||
"access-token-unsecure"
|
||||
)
|
||||
return app.tokens.get(token)
|
||||
|
||||
@app.get("/login_check")
|
||||
@ -196,6 +198,9 @@ class App(FastAPI):
|
||||
samesite="none",
|
||||
secure=True,
|
||||
)
|
||||
response.set_cookie(
|
||||
key="access-token-unsecure", value=token, httponly=True
|
||||
)
|
||||
return response
|
||||
else:
|
||||
raise HTTPException(status_code=400, detail="Incorrect credentials.")
|
||||
|
3
ui/globals.d.ts
vendored
3
ui/globals.d.ts
vendored
@ -5,9 +5,6 @@ declare global {
|
||||
launchGradioFromSpaces: Function;
|
||||
gradio_config: Config;
|
||||
scoped_css_attach: (link: HTMLLinkElement) => void;
|
||||
__gradio_loader__: Array<{
|
||||
$set: (args: any) => any;
|
||||
}>;
|
||||
__is_colab__: boolean;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
export let app_mode: boolean;
|
||||
export let is_space: boolean;
|
||||
|
||||
window.__gradio_loader__[id].$set({ status: "complete" });
|
||||
let username = "";
|
||||
let password = "";
|
||||
let incorrect_credentials = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user