Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
addExtPoints({ theme: 'application-themes' });
angular.module('shell', ['blimpKit', 'platformShell']).controller('ApplicationController', ($scope) => {});
</script>
<analytics></analytics>
<theme></theme>
</body>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,11 @@ export function getBrandingJs() {
},
logo: '${Configurations.get(BRANDING_LOGO, BRANDING_LOGO_DEFAULT)}',
theme: '${Configurations.get(BRANDING_THEME, BRANDING_THEME_DEFAULT)}',
prefix: '${Configurations.get(BRANDING_PREFIX, BRANDING_PREFIX_DEFAULT)}'
prefix: '${Configurations.get(BRANDING_PREFIX, BRANDING_PREFIX_DEFAULT)}',
analytics: '${Configurations.get(BRANDING_ANALYTICS, '')}',
};`;
}

export function getKeyPrefix() {
return Configurations.get(BRANDING_PREFIX, BRANDING_PREFIX_DEFAULT);
}

export function getAnalyticsLink() {
return Configurations.get(BRANDING_ANALYTICS, '');
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { request, response } from 'sdk/http';
import { registry } from 'sdk/platform';
import { uuid } from 'sdk/utils';
import { getBrandingJs, getKeyPrefix, getAnalyticsLink } from '/platform-branding/branding.mjs';
import { getBrandingJs, getKeyPrefix } from '/platform-branding/branding.mjs';

const COOKIE_PREFIX = `${getKeyPrefix()}.ljs.`;

Expand Down Expand Up @@ -190,14 +190,11 @@ function getScriptList(scriptId) {
'/platform-core/ui/platform/layout.js',
];
case 'shell-js':
const shell = [
return [
...baseJs,
cookies,
'/platform-core/ui/platform/shell.js',
getAnalyticsLink(),
];
if (!shell[shell.length - 1]) shell.pop();
return shell;
case 'file-upload-js':
return [
'/es5-shim/4.6.7/es5-shim.min.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
console.error('You must provide one of the following: "viewData", "perspectiveData", "editorData", "shellData"');
} else angular.module('platformView', ['platformExtensions', 'platformTheming'])
.constant('clientOS', { isMac: () => navigator.userAgent.includes('Mac') })
.config(($sceDelegateProvider) => {
$sceDelegateProvider.resourceUrlWhitelist(['self', 'https://www.googletagmanager.com/gtag/js**']);
})
Comment on lines +16 to +18

Check warning

Code scanning / CodeQL

Missing explicit dependency injection Warning

This function has no explicit dependency injections, but
this function
has an explicit dependency injection.

Copilot Autofix

AI 7 months ago

To fix the issue, we will replace the implicit dependency injection in the function on line 16 with explicit annotations. This involves wrapping the dependency name ($sceDelegateProvider) and the function in an array. The array's first element will be the dependency name as a string, and the second element will be the function itself. This ensures that the dependency injection works correctly even after minification.


Suggested changeset 1
components/ui/platform-core/src/main/resources/META-INF/dirigible/platform-core/ui/platform/view.js

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/components/ui/platform-core/src/main/resources/META-INF/dirigible/platform-core/ui/platform/view.js b/components/ui/platform-core/src/main/resources/META-INF/dirigible/platform-core/ui/platform/view.js
--- a/components/ui/platform-core/src/main/resources/META-INF/dirigible/platform-core/ui/platform/view.js
+++ b/components/ui/platform-core/src/main/resources/META-INF/dirigible/platform-core/ui/platform/view.js
@@ -15,5 +15,5 @@
     .constant('clientOS', { isMac: () => navigator.userAgent.includes('Mac') })
-    .config(($sceDelegateProvider) => {
+    .config(['$sceDelegateProvider', ($sceDelegateProvider) => {
         $sceDelegateProvider.resourceUrlWhitelist(['self', 'https://www.googletagmanager.com/gtag/js**']);
-    })
+    }])
     .factory('baseHttpInterceptor', () => {
EOF
@@ -15,5 +15,5 @@
.constant('clientOS', { isMac: () => navigator.userAgent.includes('Mac') })
.config(($sceDelegateProvider) => {
.config(['$sceDelegateProvider', ($sceDelegateProvider) => {
$sceDelegateProvider.resourceUrlWhitelist(['self', 'https://www.googletagmanager.com/gtag/js**']);
})
}])
.factory('baseHttpInterceptor', () => {
Copilot is powered by AI and may make mistakes. Always verify output.
.factory('baseHttpInterceptor', () => {
let csrfToken = null;
return {
Expand Down Expand Up @@ -182,4 +185,19 @@
} else throw Error('configTitle: missing view data');
},
template: '{{::label}}'
})).directive('analytics', ($window) => ({
restrict: 'E',
replace: true,
transclude: false,
link: (scope) => {
scope.gtag = getBrandingInfo().analytics;
if (scope.gtag) {
scope.link = `https://www.googletagmanager.com/gtag/js?id=${scope.gtag}`;
$window.dataLayer = $window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', scope.gtag);
}
},
template: '<script ng-if="::gtag" async ng-src="{{ ::link }}"></script>'
}));

Check warning

Code scanning / CodeQL

Missing explicit dependency injection Warning

This function has no explicit dependency injections, but
this function
has an explicit dependency injection.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<script type="text/javascript">
angular.module('shell', ['blimpKit', 'platformShell']).controller('ShellController', ($scope) => { });
</script>

<analytics></analytics>
<theme></theme>
</body>

Expand Down
Loading