From 60336be9dbcbb422d8195043362fafbf2d17bf05 Mon Sep 17 00:00:00 2001 From: Wang Yefu Date: Tue, 18 May 2021 14:34:47 +0800 Subject: [PATCH] fix(solution): sane default value for developer fields when tab is not activated --- .../fx-solution/appstudio/appstudio.ts | 19 ++++++++++++++----- .../plugins/solution/fx-solution/constants.ts | 5 +++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/packages/fx-core/src/plugins/solution/fx-solution/appstudio/appstudio.ts b/packages/fx-core/src/plugins/solution/fx-solution/appstudio/appstudio.ts index 4277e0d9582..bd55da17617 100644 --- a/packages/fx-core/src/plugins/solution/fx-solution/appstudio/appstudio.ts +++ b/packages/fx-core/src/plugins/solution/fx-solution/appstudio/appstudio.ts @@ -35,6 +35,9 @@ import { BOTS_TPL, COMPOSE_EXTENSIONS_TPL, TEAMS_APP_SHORT_NAME_MAX_LENGTH, + DEFAULT_DEVELOPER_WEBSITE_URL, + DEFAULT_DEVELOPER_TERM_OF_USE_URL, + DEFAULT_DEVELOPER_PRIVACY_URL, } from "../constants"; import axios, { AxiosInstance } from "axios"; @@ -396,11 +399,11 @@ export namespace AppStudio { if (botId) { manifest = replaceConfigValue(manifest, "botId", botId); } - manifest = replaceConfigValue( - manifest, - "baseUrl", - tabEndpoint ? tabEndpoint : "https://localhost:3000" - ); + + if (tabEndpoint) { + manifest = replaceConfigValue(manifest, "baseUrl", tabEndpoint); + } + manifest = replaceConfigValue(manifest, "appClientId", appId); manifest = replaceConfigValue(manifest, "appid", appId); manifest = replaceConfigValue( @@ -415,6 +418,12 @@ export namespace AppStudio { updatedManifest.validDomains?.push(domain); } + if (!tabEndpoint && updatedManifest.developer) { + updatedManifest.developer.websiteUrl = DEFAULT_DEVELOPER_WEBSITE_URL; + updatedManifest.developer.termsOfUseUrl = DEFAULT_DEVELOPER_TERM_OF_USE_URL; + updatedManifest.developer.privacyUrl = DEFAULT_DEVELOPER_PRIVACY_URL; + } + const appDefinition = convertToAppDefinition(updatedManifest, ignoreIcon); // For local debug teams app, the app name will have a suffix to differentiate from remote teams app // if the resulting short name length doesn't exceeds limit. diff --git a/packages/fx-core/src/plugins/solution/fx-solution/constants.ts b/packages/fx-core/src/plugins/solution/fx-solution/constants.ts index fd7d5a0c463..7d2df015ecd 100644 --- a/packages/fx-core/src/plugins/solution/fx-solution/constants.ts +++ b/packages/fx-core/src/plugins/solution/fx-solution/constants.ts @@ -289,3 +289,8 @@ export const CancelError = new UserError("UserCancel", "UserCancel", "Solution") // This is the max length specified in // https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json export const TEAMS_APP_SHORT_NAME_MAX_LENGTH = 30; + +// Default values for the developer fields in manifest. +export const DEFAULT_DEVELOPER_WEBSITE_URL = "https://www.example.com"; +export const DEFAULT_DEVELOPER_TERM_OF_USE_URL = "https://www.example.com/termofuse"; +export const DEFAULT_DEVELOPER_PRIVACY_URL = "https://www.example.com/privacy";