mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 16:02:28 +00:00
fix: refresh token on login and regularly
This commit is contained in:
@@ -536,6 +536,20 @@ paths:
|
||||
schema:
|
||||
type: string
|
||||
|
||||
/users/refresh_token:
|
||||
get:
|
||||
summary: refresh the current token
|
||||
operationId: refreshUserToken
|
||||
tags:
|
||||
- user
|
||||
responses:
|
||||
"200":
|
||||
description: free usage
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
|
||||
/users/usage:
|
||||
get:
|
||||
summary: get current usage outside of premium workspaces
|
||||
@@ -5672,7 +5686,19 @@ components:
|
||||
language:
|
||||
type: string
|
||||
enum:
|
||||
[python3, deno, go, bash, postgresql, mysql, bigquery, snowflake, graphql, nativets, bun]
|
||||
[
|
||||
python3,
|
||||
deno,
|
||||
go,
|
||||
bash,
|
||||
postgresql,
|
||||
mysql,
|
||||
bigquery,
|
||||
snowflake,
|
||||
graphql,
|
||||
nativets,
|
||||
bun,
|
||||
]
|
||||
kind:
|
||||
type: string
|
||||
enum: [script, failure, trigger, command, approval]
|
||||
@@ -5737,7 +5763,19 @@ components:
|
||||
language:
|
||||
type: string
|
||||
enum:
|
||||
[python3, deno, go, bash, postgresql, mysql, bigquery, snowflake, graphql, nativets, bun]
|
||||
[
|
||||
python3,
|
||||
deno,
|
||||
go,
|
||||
bash,
|
||||
postgresql,
|
||||
mysql,
|
||||
bigquery,
|
||||
snowflake,
|
||||
graphql,
|
||||
nativets,
|
||||
bun,
|
||||
]
|
||||
kind:
|
||||
type: string
|
||||
enum: [script, failure, trigger, command, approval]
|
||||
@@ -5907,7 +5945,19 @@ components:
|
||||
language:
|
||||
type: string
|
||||
enum:
|
||||
[python3, deno, go, bash, postgresql, mysql, bigquery, snowflake, graphql, nativets, bun]
|
||||
[
|
||||
python3,
|
||||
deno,
|
||||
go,
|
||||
bash,
|
||||
postgresql,
|
||||
mysql,
|
||||
bigquery,
|
||||
snowflake,
|
||||
graphql,
|
||||
nativets,
|
||||
bun,
|
||||
]
|
||||
email:
|
||||
type: string
|
||||
visible_to_owner:
|
||||
@@ -5997,7 +6047,19 @@ components:
|
||||
language:
|
||||
type: string
|
||||
enum:
|
||||
[python3, deno, go, bash, postgresql, mysql, bigquery, snowflake, graphql, nativets, bun]
|
||||
[
|
||||
python3,
|
||||
deno,
|
||||
go,
|
||||
bash,
|
||||
postgresql,
|
||||
mysql,
|
||||
bigquery,
|
||||
snowflake,
|
||||
graphql,
|
||||
nativets,
|
||||
bun,
|
||||
]
|
||||
is_skipped:
|
||||
type: boolean
|
||||
email:
|
||||
@@ -6426,7 +6488,19 @@ components:
|
||||
language:
|
||||
type: string
|
||||
enum:
|
||||
[python3, deno, go, bash, postgresql, mysql, bigquery, snowflake, graphql, nativets, bun]
|
||||
[
|
||||
python3,
|
||||
deno,
|
||||
go,
|
||||
bash,
|
||||
postgresql,
|
||||
mysql,
|
||||
bigquery,
|
||||
snowflake,
|
||||
graphql,
|
||||
nativets,
|
||||
bun,
|
||||
]
|
||||
tag:
|
||||
type: string
|
||||
kind:
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
} catch {}
|
||||
}
|
||||
|
||||
const allWorkspaces = $usersWorkspaceStore?.workspaces
|
||||
const allWorkspaces = $usersWorkspaceStore?.workspaces.filter((x) => x.id != 'admins')
|
||||
|
||||
if (allWorkspaces?.length == 1) {
|
||||
$workspaceStore = allWorkspaces[0].id
|
||||
|
||||
@@ -124,11 +124,24 @@
|
||||
console.error('Caught unhandled promise rejection without message', event.reason, event)
|
||||
}
|
||||
}
|
||||
setLicense()
|
||||
|
||||
if ($page.url.pathname != '/user/login') {
|
||||
setUserWorkspaceStore()
|
||||
loadUser()
|
||||
setLicense()
|
||||
interval = setInterval(async () => {
|
||||
UserService.refreshUserToken()
|
||||
}
|
||||
|
||||
let i = 0
|
||||
interval = setInterval(async () => {
|
||||
if ($page.url.pathname != '/user/login') {
|
||||
i += 1
|
||||
|
||||
// every 1 hour
|
||||
if (i % 12 == 0) {
|
||||
UserService.refreshUserToken()
|
||||
}
|
||||
|
||||
try {
|
||||
const workspace = $workspaceStore
|
||||
const user = $userStore
|
||||
@@ -140,8 +153,9 @@
|
||||
} catch (e) {
|
||||
console.error('Could not refresh user', e)
|
||||
}
|
||||
}, 300000)
|
||||
}
|
||||
}
|
||||
// every 5 minues
|
||||
}, 300000)
|
||||
})
|
||||
|
||||
onDestroy(() => {
|
||||
|
||||
Reference in New Issue
Block a user