diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-12 15:20:46 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-24 18:18:41 +0100 |
commit | f43db2f46ee50bacb402a6ef42d768694c2bc9a8 (patch) | |
tree | bce2574e94d48e8602387615a07ee691e98e23e4 /shared/extra-utils/miscs | |
parent | cae2df6bdc3c3590df32bf7431a617177be30429 (diff) | |
download | PeerTube-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/extra-utils/miscs')
-rw-r--r-- | shared/extra-utils/miscs/sql.ts | 9 |
1 files changed, 9 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 | ||
133 | function 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 | |||
133 | export { | 141 | export { |
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, |