diff --git a/README.md b/README.md index 3326dfa..c483060 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This project is intended to be integrated as a bundle to the installation of your map.apps manager. ## Installation Guide -**Requirement: map.apps 4.14** +**Requirement: map.apps 4.17** Before you add the Bundle to your manager, please configure the user and the topic property in the manifest.json to point to your GitHub account. Topic can be left empty. You will have to add a released bundle.jar/zip as a bundle in your map.apps manager. diff --git a/RELEASE.md b/RELEASE.md index 21716f2..9de489e 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,4 @@ +✅ Tested for map.apps 4.20.0 / Linie 4 ✅ Tested for map.apps 4.18.3 / Linie 4 #### Release Notes diff --git a/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js b/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js index 7ebc01c..043d551 100644 --- a/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js +++ b/src/main/js/bundles/mapapps-github-manager/BundleDetailsController.js @@ -14,8 +14,11 @@ * limitations under the License. */ import Hash from "ct/Hash"; -import apprt_request from "apprt-request"; +import { apprtFetch, apprtFetchJson } from "apprt-fetch"; import { replace } from "apprt-core/string-replace"; +import { sourceId } from "source-info!"; +import { loggerForName } from "apprt-core/Logger"; +const LOG = loggerForName(sourceId); export default class BundleDetailsController { // injected @@ -117,8 +120,10 @@ export default class BundleDetailsController { async _lookupAvailableTags(repositoryName) { const tagsUrl = "https://api.github.com/repos/conterra/" + repositoryName + "/releases"; try { - const response = await apprt_request(tagsUrl, { jsonp: true }); - const releases = response.data.filter((release) => !release.name.includes("SNAPSHOT")); + const data = await apprtFetchJson(tagsUrl, { + proxyMode: "force-off" + }); + const releases = data.filter((release) => !release.name.includes("SNAPSHOT")); releases.sort((a, b) => b.name.replace(/\d+/g, (n) => +n + 100000).localeCompare(a.name.replace(/\d+/g, (n) => +n + 100000)) ); @@ -191,10 +196,10 @@ export default class BundleDetailsController { } } - _downloadArchive(url) { - return apprt_request(url, { - handleAs: "blob" - }); + async _downloadArchive(url) { + // Currently throws a CORS error (from GitHub) and then uses the map.apps proxy. + const response = await apprtFetch(url, { checkStatus: true }); + return await response.blob(); } async _uploadBundle(blob, itemName) { @@ -205,8 +210,11 @@ export default class BundleDetailsController { formData.append("file", blob, fileName); formData.append("f", "json"); try { - await apprt_request.post(url, { - data: formData + await apprtFetch(url, { + method: "POST", + body: formData, + checkStatus: true, + proxyMode: "force-off" }); this.buttonWidget.set("disabled", false); this.buttonWidget.set("iconClass", "icon-sign-success"); @@ -216,6 +224,7 @@ export default class BundleDetailsController { this.detailWindow.close(); }, 1500); } catch (e) { + LOG.error("Failed to upload bundle", e); this.detailWindow.set("content", this.i18n.integrationFailed); } } diff --git a/src/main/js/bundles/mapapps-github-manager/BundleStore.js b/src/main/js/bundles/mapapps-github-manager/BundleStore.js index 52993bc..71f4ec2 100644 --- a/src/main/js/bundles/mapapps-github-manager/BundleStore.js +++ b/src/main/js/bundles/mapapps-github-manager/BundleStore.js @@ -15,7 +15,7 @@ */ import { AsyncInMemoryStore } from "store-api/InMemoryStore"; import TypeFormat from "ct/util/TypeFormat"; -import apprt_request from "apprt-request"; +import { apprtFetchJson } from "apprt-fetch"; import stringEscape from "apprt-core/string-escape"; export default class BundleStoreFactory { @@ -49,8 +49,8 @@ async function fetchBundlesFromGitHub(target, user, topic) { } url = url + "&per_page=100"; try { - const data = await apprt_request(url, { - useProxy: false, + const data = await apprtFetchJson(url, { + proxyMode: "force-off", headers: { Accept: "application/vnd.github.mercy-preview+json" } diff --git a/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue b/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue index 942408d..871acfb 100644 --- a/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue +++ b/src/main/js/bundles/mapapps-github-manager/BundleTopWidget.vue @@ -112,10 +112,10 @@ class="hidden-xs-and-down" > diff --git a/src/main/js/bundles/mapapps-github-manager/manifest.json b/src/main/js/bundles/mapapps-github-manager/manifest.json index dd46ca9..60805b4 100644 --- a/src/main/js/bundles/mapapps-github-manager/manifest.json +++ b/src/main/js/bundles/mapapps-github-manager/manifest.json @@ -16,7 +16,7 @@ "dataform": "^4.17.0", "dataview": "^4.17.0", "apprt-vue": "^4.17.0", - "apprt-request": "^4.17.0", + "apprt-fetch": "^4.17.0", "apprt-core": "^4.17.0", "apprt-vuetify": "^4.17.0", "store-api": "^4.17.0" @@ -111,7 +111,10 @@ { "name": "GithubBundlesDataView", "impl": "dataview/DataView", - "provides": ["dijit.Widget", "mapapps-github-manager.GithubBundlesDataView"], + "provides": [ + "dijit.Widget", + "mapapps-github-manager.GithubBundlesDataView" + ], "propertiesConstructor": true, "properties": { "id": "githubBundlesDataView", @@ -181,7 +184,10 @@ { "name": "BundlesDataViewController", "impl": "dataview/DataViewController", - "provides": ["ct.framework.api.EventHandler", "mapapps-github-manager.BundlesDataViewController"], + "provides": [ + "ct.framework.api.EventHandler", + "mapapps-github-manager.BundlesDataViewController" + ], "properties": { "Event-Topics": [ { @@ -217,7 +223,10 @@ }, { "name": "BundleDetailsController", - "provides": ["ct.framework.api.EventHandler", "mapapps-github-manager.BundleDetailsController"], + "provides": [ + "ct.framework.api.EventHandler", + "mapapps-github-manager.BundleDetailsController" + ], "properties": { "uploadTarget": "@@applicationURL.noscheme@@/resources/jsregistry/upload", "Event-Topics": [