|
17 | 17 | };
|
18 | 18 |
|
19 | 19 | // get oauth configuration
|
20 |
| - umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.getOAuthConfiguration().then(function(response) { |
| 20 | + umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.getOAuthConfiguration().then(function (response) { |
21 | 21 | vm.oauthConfiguration = response;
|
22 | 22 | });
|
23 | 23 |
|
24 |
| - vm.onConnectClick = function() { |
| 24 | + vm.onConnectClick = function () { |
25 | 25 | vm.authorizationWindow = window.open(vm.oauthConfiguration.authorizationUrl,
|
26 | 26 | "GoogleSearchConsole_Authorize",
|
27 | 27 | "width=900,height=700,modal=yes,alwaysRaised=yes");
|
28 | 28 | }
|
29 | 29 |
|
30 |
| - vm.onRevokeToken = function() { |
| 30 | + vm.onRevokeToken = function () { |
31 | 31 | revokeToken();
|
32 | 32 | }
|
33 | 33 |
|
34 | 34 | vm.onInspect = function () {
|
35 | 35 |
|
36 | 36 | vm.loading = true;
|
37 | 37 |
|
| 38 | + // check if url is relative |
| 39 | + if (isRelativeUrl(vm.inspectionObj.inspectionUrl)) |
| 40 | + vm.inspectionObj.inspectionUrl = `${vm.inspectionObj.siteUrl}${vm.inspectionObj.inspectionUrl}`; |
| 41 | + |
38 | 42 | umbracoCmsIntegrationsGoogleSearchConsoleUrlInspectionToolResource.inspect(vm.inspectionObj.inspectionUrl, vm.inspectionObj.siteUrl, vm.inspectionObj.languageCode)
|
39 | 43 | .then(function (response) {
|
40 | 44 |
|
|
58 | 62 | });
|
59 | 63 | }
|
60 | 64 |
|
61 |
| - vm.onEdit = function() { |
| 65 | + vm.onEdit = function () { |
62 | 66 | vm.inspectionObj.multipleUrls = false;
|
63 | 67 | vm.inspectionObj.enabled = true;
|
64 | 68 | }
|
65 | 69 |
|
66 |
| - vm.onChangeInspectionUrl = function() { |
| 70 | + vm.onChangeInspectionUrl = function () { |
67 | 71 | vm.inspectionObj.languageCode =
|
68 | 72 | editorState.current.urls.find(p => p.text === vm.inspectionObj.inspectionUrl).culture;
|
69 | 73 | }
|
|
118 | 122 | vm.showResults = false;
|
119 | 123 | });
|
120 | 124 | }
|
| 125 | + |
| 126 | + function isRelativeUrl(url) { |
| 127 | + var regExp = new RegExp('^(?:[a-z]+:)?//', 'i'); |
| 128 | + return !regExp.test(url); |
| 129 | + } |
121 | 130 | }
|
122 | 131 |
|
123 | 132 | angular.module("umbraco")
|
|
0 commit comments