Merge branch 'main' into next
This commit is contained in:
@ -146,7 +146,7 @@
|
||||
"slate-hyperscript": "0.77.0",
|
||||
"slate-react": "0.91.10",
|
||||
"stream-browserify": "3.0.0",
|
||||
"styled-components": "5.3.8",
|
||||
"styled-components": "5.3.9",
|
||||
"symbol-observable": "4.0.0",
|
||||
"unified": "10.1.2",
|
||||
"unist-util-visit": "4.1.2",
|
||||
@ -188,12 +188,12 @@
|
||||
"@types/create-react-class": "15.6.3",
|
||||
"@types/fs-extra": "11.0.1",
|
||||
"@types/is-hotkey": "0.1.7",
|
||||
"@types/jest": "29.4.0",
|
||||
"@types/jest": "29.4.1",
|
||||
"@types/js-yaml": "4.0.5",
|
||||
"@types/jwt-decode": "2.2.1",
|
||||
"@types/lodash": "4.14.191",
|
||||
"@types/minimatch": "5.1.2",
|
||||
"@types/node": "16.18.14",
|
||||
"@types/node": "16.18.16",
|
||||
"@types/node-fetch": "2.6.2",
|
||||
"@types/react": "18.0.28",
|
||||
"@types/react-color": "3.0.6",
|
||||
@ -203,8 +203,8 @@
|
||||
"@types/styled-components": "5.1.26",
|
||||
"@types/url-join": "4.0.1",
|
||||
"@types/uuid": "9.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "5.54.1",
|
||||
"@typescript-eslint/parser": "5.54.1",
|
||||
"@typescript-eslint/eslint-plugin": "5.55.0",
|
||||
"@typescript-eslint/parser": "5.55.0",
|
||||
"axios": "1.3.4",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-loader": "9.1.2",
|
||||
@ -230,7 +230,7 @@
|
||||
"eslint-plugin-react": "7.32.2",
|
||||
"eslint-plugin-react-hooks": "4.6.0",
|
||||
"eslint-plugin-unicorn": "46.0.0",
|
||||
"execa": "7.0.0",
|
||||
"execa": "7.1.0",
|
||||
"fs-extra": "11.1.0",
|
||||
"gitlab": "14.2.2",
|
||||
"http-server": "14.1.1",
|
||||
@ -251,7 +251,7 @@
|
||||
"rimraf": "4.4.0",
|
||||
"simple-git": "3.17.0",
|
||||
"source-map-loader": "4.0.1",
|
||||
"style-loader": "3.3.1",
|
||||
"style-loader": "3.3.2",
|
||||
"to-string-loader": "1.2.0",
|
||||
"ts-jest": "29.0.5",
|
||||
"tsconfig-paths-webpack-plugin": "4.0.1",
|
||||
|
@ -18,29 +18,6 @@ export class NetlifyError {
|
||||
}
|
||||
}
|
||||
|
||||
const PROVIDERS = {
|
||||
github: {
|
||||
width: 960,
|
||||
height: 600,
|
||||
},
|
||||
gitlab: {
|
||||
width: 960,
|
||||
height: 600,
|
||||
},
|
||||
gitea: {
|
||||
width: 960,
|
||||
height: 600,
|
||||
},
|
||||
bitbucket: {
|
||||
width: 960,
|
||||
height: 500,
|
||||
},
|
||||
email: {
|
||||
width: 500,
|
||||
height: 400,
|
||||
},
|
||||
} as const;
|
||||
|
||||
class Authenticator {
|
||||
private site_id: string | null;
|
||||
private base_url: string;
|
||||
@ -55,7 +32,7 @@ class Authenticator {
|
||||
}
|
||||
|
||||
handshakeCallback(
|
||||
options: { provider?: keyof typeof PROVIDERS },
|
||||
options: { provider?: string | undefined },
|
||||
cb: (error: Error | NetlifyError | null, data?: User) => void,
|
||||
) {
|
||||
const fn = (e: { data: string; origin: string }) => {
|
||||
@ -69,7 +46,7 @@ class Authenticator {
|
||||
}
|
||||
|
||||
authorizeCallback(
|
||||
options: { provider?: keyof typeof PROVIDERS },
|
||||
options: { provider?: string | undefined },
|
||||
cb: (error: Error | NetlifyError | null, data?: User) => void,
|
||||
) {
|
||||
const fn = (e: { data: string; origin: string }) => {
|
||||
@ -109,7 +86,7 @@ class Authenticator {
|
||||
|
||||
authenticate(
|
||||
options: {
|
||||
provider?: keyof typeof PROVIDERS;
|
||||
provider?: string | undefined;
|
||||
scope?: string;
|
||||
login?: boolean;
|
||||
beta_invite?: string;
|
||||
@ -137,9 +114,6 @@ class Authenticator {
|
||||
);
|
||||
}
|
||||
|
||||
const conf = PROVIDERS[provider] || PROVIDERS.github;
|
||||
const left = screen.width / 2 - conf.width / 2;
|
||||
const top = screen.height / 2 - conf.height / 2;
|
||||
window.addEventListener('message', this.handshakeCallback(options, cb), false);
|
||||
let url = `${this.base_url}/${this.auth_endpoint}?provider=${options.provider}&site_id=${siteID}`;
|
||||
if (options.scope) {
|
||||
@ -154,17 +128,13 @@ class Authenticator {
|
||||
if (options.invite_code) {
|
||||
url += '&invite_code=' + options.invite_code;
|
||||
}
|
||||
this.authWindow = window.open(
|
||||
url,
|
||||
'Netlify Authorization',
|
||||
`width=${conf.width}, height=${conf.height}, top=${top}, left=${left}`,
|
||||
);
|
||||
this.authWindow = window.open(url, 'Netlify Authorization');
|
||||
this.authWindow?.focus();
|
||||
}
|
||||
|
||||
refresh(
|
||||
options: {
|
||||
provider: keyof typeof PROVIDERS;
|
||||
provider: string;
|
||||
refresh_token?: string;
|
||||
},
|
||||
cb?: (error: Error | NetlifyError | null, data?: User) => void,
|
||||
|
Reference in New Issue
Block a user