diff --git a/package.json b/package.json index 2b97dee..c0df6e5 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,11 @@ "type": "boolean", "default": false, "description": "Disable showing DevStar Home at startup" + }, + "devstar.devstarHomePage": { + "type": "string", + "default": "https://devstar.cn/devstar-home", + "description": "DevStar Home Page" } } } diff --git a/src/home.ts b/src/home.ts index 07e42ee..b0df8e3 100644 --- a/src/home.ts +++ b/src/home.ts @@ -8,16 +8,23 @@ export default class DSHome { private context: vscode.ExtensionContext; private remoteContainer: RemoteContainer; private user:User; - static defaultUrl = 'http://localhost:8080/test/index.html'; + private devstarHomePageUrl:string; constructor(context: vscode.ExtensionContext) { this.context = context; this.user = new User(context); this.remoteContainer = new RemoteContainer(this.user); + + const devstarHomePageUrl:string|undefined = vscode.workspace.getConfiguration('devstar').get('devstarHomePage') + if (undefined == devstarHomePageUrl || "" == devstarHomePageUrl) { + this.devstarHomePageUrl = "https://devstar.cn/devstar-home" + // this.devstarHomePageUrl = "http://localhost:3000/devstar-home" + } else { + this.devstarHomePageUrl = devstarHomePageUrl + } } - async toggle(url: string = DSHome.defaultUrl) { - console.log(url); + async toggle(devstarHomePageUrl: string = this.devstarHomePageUrl) { const panel = vscode.window.createWebviewPanel( 'homeWebview', 'Home', @@ -27,9 +34,7 @@ export default class DSHome { } ); - utils.fetch(url).then(async (content) => { - panel.webview.html = await this.getWebviewContent(content); - }) + panel.webview.html = await this.getWebviewContent(devstarHomePageUrl); panel.webview.onDidReceiveMessage( async (message) => { @@ -129,7 +134,99 @@ export default class DSHome { } - async getWebviewContent(content: string): Promise { - return `${content}` + async getWebviewContent(devstarHomePageUrl: string): Promise { + return ` + + + + + + + + DevStar Home + + + + + + + + + ` } } \ No newline at end of file