mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-25 14:57:43 -05:00
refac
This commit is contained in:
1 parent
e9bfa82d00
commit
2be04aa5e2
3 files changed
+6
-3
No files matched your search
@@ -168,7 +168,7 @@
|
||||
<div class="mt-3">
|
||||
{#if shareMode === 'continue'}
|
||||
<p class="mb-3 text-xs text-base-500">
|
||||
{$i18n.t('People who can reply can also use this chat’s own machine.')}
|
||||
{$i18n.t('People who can reply may get access to this chat’s machine and files.')}
|
||||
</p>
|
||||
{/if}
|
||||
<AccessControl
|
||||
|
||||
@@ -2632,7 +2632,7 @@
|
||||
"pending": "",
|
||||
"Pending": "",
|
||||
"People also need access to the models this router model uses.": "",
|
||||
"People who can reply can also use this chat’s own machine.": "",
|
||||
"People who can reply may get access to this chat’s machine and files.": "",
|
||||
"People with access can run commands and see every file on this machine.": "",
|
||||
"per": "",
|
||||
"Permission denied when accessing media devices": "",
|
||||
|
||||
@@ -30,6 +30,7 @@ const validateCredentials = () => {
|
||||
|
||||
let pickerApiLoaded = false;
|
||||
let oauthToken: string | null = null;
|
||||
let oauthTokenExpiresAt = 0;
|
||||
let initialized = false;
|
||||
|
||||
export const loadGoogleDriveApi = () => {
|
||||
@@ -69,7 +70,7 @@ export const loadGoogleAuthApi = () => {
|
||||
};
|
||||
|
||||
export const getAuthToken = async () => {
|
||||
if (!oauthToken) {
|
||||
if (!oauthToken || Date.now() >= oauthTokenExpiresAt) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const tokenClient = google.accounts.oauth2.initTokenClient({
|
||||
client_id: CLIENT_ID,
|
||||
@@ -77,6 +78,8 @@ export const getAuthToken = async () => {
|
||||
callback: (response: any) => {
|
||||
if (response.access_token) {
|
||||
oauthToken = response.access_token;
|
||||
// Renew a minute before the token expires
|
||||
oauthTokenExpiresAt = Date.now() + (response.expires_in - 60) * 1000;
|
||||
resolve(oauthToken);
|
||||
} else {
|
||||
reject(new Error('Failed to get access token'));
|
||||
|
||||
Reference in new issue
Block a user