-
Notifications
You must be signed in to change notification settings - Fork 588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hook up webflow auth during credential checks #94
Changes from 15 commits
6108777
db06fca
6590351
5a1a708
33d5ff5
d605f65
04219f0
3c4c30d
5b198d5
3856af5
7c64a68
87e21ae
f6f7799
1b51607
ea59abb
7f1873f
4e49ad6
cb7a3d2
d62e444
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,4 +332,5 @@ ASALocalRun/ | |
|
||
out | ||
node_modules | ||
media | ||
media | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
export interface IHostConfiguration { | ||
host: string; | ||
username: string | undefined; | ||
token: string | undefined; | ||
} | ||
|
||
export const HostHelper = class { | ||
public static getApiHost(host: IHostConfiguration | vscode.Uri): vscode.Uri { | ||
const hostUri: vscode.Uri = host instanceof vscode.Uri ? host : vscode.Uri.parse(host.host); | ||
if (hostUri.authority === 'github.com') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it possible for there to be a case mismatch? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmmmm, good question. possibly, yes, I can test that quick |
||
return vscode.Uri.parse('https://api.github.com'); | ||
} else { | ||
return vscode.Uri.parse(`${hostUri.scheme}://${hostUri.authority}`); | ||
} | ||
} | ||
|
||
public static getApiPath(host: IHostConfiguration | vscode.Uri, path: string): string { | ||
const hostUri: vscode.Uri = host instanceof vscode.Uri ? host : vscode.Uri.parse(host.host); | ||
if (hostUri.authority === 'github.com') { | ||
return path; | ||
} else { | ||
return `/api/v3${path}`; | ||
} | ||
} | ||
}; | ||
|
||
export interface IConfiguration extends IHostConfiguration { | ||
onDidChange: vscode.Event<IConfiguration>; | ||
} | ||
|
||
export class Configuration implements IConfiguration { | ||
public username: string | undefined; | ||
public token: string | undefined; | ||
public onDidChange: vscode.Event<IConfiguration>; | ||
private _emitter: vscode.EventEmitter<IConfiguration>; | ||
|
||
constructor(public host: string) { | ||
this._emitter = new vscode.EventEmitter<IConfiguration>(); | ||
this.onDidChange = this._emitter.event; | ||
} | ||
|
||
public update(username: string | undefined, token: string | undefined, raiseEvent: boolean = true): void { | ||
if (username !== this.username || token !== this.token) { | ||
this.username = username; | ||
this.token = token; | ||
if (raiseEvent) { | ||
this._emitter.fire(this); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can also add a
"properties"
property within items, which helps intellisense in the settings editorsomething like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool, didn't know that, thanks!