aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-12 15:20:46 +0100
committerChocobozzz <me@florianbigard.com>2021-03-24 18:18:41 +0100
commitf43db2f46ee50bacb402a6ef42d768694c2bc9a8 (patch)
treebce2574e94d48e8602387615a07ee691e98e23e4 /shared
parentcae2df6bdc3c3590df32bf7431a617177be30429 (diff)
downloadPeerTube-f43db2f46ee50bacb402a6ef42d768694c2bc9a8.tar.gz
PeerTube-f43db2f46ee50bacb402a6ef42d768694c2bc9a8.tar.zst
PeerTube-f43db2f46ee50bacb402a6ef42d768694c2bc9a8.zip
Refactor auth flow
Reimplement some node-oauth2-server methods to remove hacky code needed by our external login workflow
Diffstat (limited to 'shared')
-rw-r--r--shared/extra-utils/miscs/sql.ts9
-rw-r--r--shared/extra-utils/server/servers.ts1
2 files changed, 10 insertions, 0 deletions
diff --git a/shared/extra-utils/miscs/sql.ts b/shared/extra-utils/miscs/sql.ts
index 345e5bc16..35e493456 100644
--- a/shared/extra-utils/miscs/sql.ts
+++ b/shared/extra-utils/miscs/sql.ts
@@ -130,6 +130,14 @@ function setActorFollowScores (internalServerNumber: number, newScore: number) {
130 return seq.query(`UPDATE "actorFollow" SET "score" = ${newScore}`, options) 130 return seq.query(`UPDATE "actorFollow" SET "score" = ${newScore}`, options)
131} 131}
132 132
133function setTokenField (internalServerNumber: number, accessToken: string, field: string, value: string) {
134 const seq = getSequelize(internalServerNumber)
135
136 const options = { type: QueryTypes.UPDATE }
137
138 return seq.query(`UPDATE "oAuthToken" SET "${field}" = '${value}' WHERE "accessToken" = '${accessToken}'`, options)
139}
140
133export { 141export {
134 setVideoField, 142 setVideoField,
135 setPlaylistField, 143 setPlaylistField,
@@ -139,6 +147,7 @@ export {
139 setPluginLatestVersion, 147 setPluginLatestVersion,
140 selectQuery, 148 selectQuery,
141 deleteAll, 149 deleteAll,
150 setTokenField,
142 updateQuery, 151 updateQuery,
143 setActorFollowScores, 152 setActorFollowScores,
144 closeAllSequelize, 153 closeAllSequelize,
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts
index 08d05ef36..779a3cc36 100644
--- a/shared/extra-utils/server/servers.ts
+++ b/shared/extra-utils/server/servers.ts
@@ -37,6 +37,7 @@ interface ServerInfo {
37 customConfigFile?: string 37 customConfigFile?: string
38 38
39 accessToken?: string 39 accessToken?: string
40 refreshToken?: string
40 videoChannel?: VideoChannel 41 videoChannel?: VideoChannel
41 42
42 video?: { 43 video?: {