This commit is contained in:
Vinicius Fortuna 2022-03-09 21:48:27 +00:00
parent 87feca5bb9
commit c764fef8dd
9 changed files with 15 additions and 14 deletions

2
.gitignore vendored
View file

@ -1,5 +1,5 @@
.DS_Store
/build
/build/
node_modules/
/src/server_manager/install_scripts/do_install_script.ts
/src/server_manager/install_scripts/gcp_install_script.ts

View file

@ -23,7 +23,8 @@
"clean": "rm -rf src/*/node_modules/ build/ node_modules/ src/server_manager/install_scripts/do_install_script.ts src/server_manager/install_scripts/gcp_install_script.ts third_party/shellcheck/download/",
"lint": "npm run lint:sh && npm run lint:ts",
"lint:sh": "bash ./scripts/shellcheck.sh",
"lint:ts": "npx tslint 'src/**/*.ts' -e '**/node_modules/**'"
"lint:ts": "npx tslint 'src/**/*.ts' -e '**/node_modules/**'",
"test": "npm run lint && npm run action metrics_server/test && npm run action sentry_webhook/build && npm run action server_manager/test && npm run action shadowbox/test"
},
"workspaces": [
"src/*"

View file

@ -579,7 +579,6 @@ export class RestApiClient {
* @see https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
*/
getUserInfo(): Promise<UserInfo> {
const parameters = new Map<string, string>([['access_token', this.accessToken]]);
return this.fetchAuthenticated(
'POST', new URL('https://openidconnect.googleapis.com/v1/userinfo'), this.GCP_HEADERS);
}
@ -607,13 +606,14 @@ export class RestApiClient {
*
* @param token - A refresh token or access token
*/
private async revokeGcpToken(token: string): Promise<void> {
const headers = new Map<string, string>(
[['Host', 'oauth2.googleapis.com'], ['Content-Type', 'application/x-www-form-urlencoded']]);
const parameters = new Map<string, string>([['token', token]]);
return this.fetchUnauthenticated(
'GET', new URL('https://oauth2.googleapis.com/revoke'), headers, parameters);
}
// TODO(fortuna): use this to revoke the access token on account disconnection.
// private async revokeGcpToken(token: string): Promise<void> {
// const headers = new Map<string, string>(
// [['Host', 'oauth2.googleapis.com'], ['Content-Type', 'application/x-www-form-urlencoded']]);
// const parameters = new Map<string, string>([['token', token]]);
// return this.fetchUnauthenticated(
// 'GET', new URL('https://oauth2.googleapis.com/revoke'), headers, parameters);
// }
// tslint:disable-next-line:no-any
private async fetchAuthenticated<T>(method: string, url: URL, headers: Map<string, string>, parameters?: Map<string, string>, data?: any): Promise<T> {

View file

@ -35,7 +35,7 @@ import type {DisplayAccessKey, ServerView} from './ui_components/outline-server-
// The Outline DigitalOcean team's referral code:
// https://www.digitalocean.com/help/referral-program/
const UNUSED_DIGITALOCEAN_REFERRAL_CODE = '5ddb4219b716';
//const UNUSED_DIGITALOCEAN_REFERRAL_CODE = '5ddb4219b716';
const CHANGE_KEYS_PORT_VERSION = '1.0.0';
const DATA_LIMITS_VERSION = '1.1.0';

View file

@ -60,12 +60,14 @@ export class CloudAccounts implements accounts.CloudAccounts {
/** See {@link CloudAccounts#disconnectDigitalOceanAccount} */
disconnectDigitalOceanAccount(): void {
// TODO(fortuna): Revoke access token.
this.digitalOceanAccount = null;
this.save();
}
/** See {@link CloudAccounts#disconnectGcpAccount} */
disconnectGcpAccount(): void {
// TODO(fortuna): Revoke access token.
this.gcpAccount = null;
this.save();
}

View file

@ -14,7 +14,6 @@
limitations under the License.
*/
import {format} from 'path';
import * as formatting from './data_formatting';
describe('formatBytesParts', () => {

View file

@ -13,7 +13,6 @@
// limitations under the License.
import {InMemoryStorage} from '../infrastructure/memory_storage';
import {Surveys} from '../model/survey';
import {OutlineSurveys} from './survey';

View file

@ -9,5 +9,6 @@
"experimentalDecorators":true,
"allowJs": true,
"resolveJsonModule": true,
"noUnusedLocals": true,
}
}

View file

@ -25,7 +25,6 @@
"no-reference": true,
"no-require-imports": true,
"no-unused-expression": true,
"no-unused-variable": [true, {"ignore-pattern": "^UNUSED"}],
"no-use-before-declare": false,
"no-var-keyword": true,
"object-literal-shorthand": true,