From 0f9011d6c4f30eecdb0febe012b3d4c3fba2dace Mon Sep 17 00:00:00 2001 From: Luis Nabergoi <> Date: Sat, 24 Jun 2023 16:24:05 +0200 Subject: [PATCH 1/5] Changes in SequentConfig to define only path and not domain in Base URL --- sequent-ui/repo.yml | 44 +++++++++++++-------------- sequent-ui/templates/SequentConfig.js | 6 ++++ 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/sequent-ui/repo.yml b/sequent-ui/repo.yml index eee17c51..144566b9 100644 --- a/sequent-ui/repo.yml +++ b/sequent-ui/repo.yml @@ -58,7 +58,7 @@ dest: /home/ui_user/{{ item }}/SequentConfig.js owner: ui_user group: ui_user - mode: '0600' + mode: "0600" with_items: - admin-console - election-portal @@ -70,34 +70,34 @@ replace: dest: /home/ui_user/admin-console/SequentConfig.js regexp: " timeoutSeconds:.*" - replace: ' timeoutSeconds: {{config.iam.admin_auth_token_expiration_seconds}},' + replace: " timeoutSeconds: {{config.iam.admin_auth_token_expiration_seconds}}," - name: sequent-ui, setting admin timeout correctly in admin-console, 2 become: true become_user: ui_user replace: dest: /home/ui_user/admin-console/SequentConfig.js - regexp: "expires:.*" - replace: ' expires: {{ (config.iam.admin_auth_token_expiration_seconds / 60) | int }},' + regexp: "expires:.*" + replace: " expires: {{ (config.iam.admin_auth_token_expiration_seconds / 60) | int }}," -- name: sequent-ui, modifying admin-console SequentConfig.js for securing the api calls - become: true - become_user: ui_user - replace: - dest: /home/ui_user/admin-console/SequentConfig.js - regexp: '{{ item.regexp }}' - replace: '{{ item.replace }}' - with_items: - - regexp: 'baseUrl:.*$' - replace: 'baseUrl: "https://{{config.ballot_box.domain}}/admin-api/elections/api/",' - - regexp: 'publicURL:.*$' - replace: 'publicURL: "https://{{config.ballot_box.domain}}/admin-api/elections/public/",' - - regexp: 'authAPI:.*$' - replace: 'authAPI: "https://{{config.ballot_box.domain}}/admin-api/iam/api/",' - - regexp: 'dnieUrl:.*$' - replace: 'dnieUrl: "https://{{config.ballot_box.domain}}/admin-api/iam/api/authmethod/dnie/auth/",' - - regexp: 'electionsAPI:.*$' - replace: 'electionsAPI: "https://{{config.ballot_box.domain}}/admin-api/elections/api/",' +#- name: sequent-ui, modifying admin-console SequentConfig.js for securing the api calls +# become: true +# become_user: ui_user +# replace: +# dest: /home/ui_user/admin-console/SequentConfig.js +# regexp: '{{ item.regexp }}' +# replace: '{{ item.replace }}' +# with_items: +# - regexp: 'baseUrl:.*$' +# replace: 'baseUrl: "https://{{config.ballot_box.domain}}/admin-api/elections/api/",' +# - regexp: 'publicURL:.*$' +# replace: 'publicURL: "https://{{config.ballot_box.domain}}/admin-api/elections/public/",' +# - regexp: 'authAPI:.*$' +# replace: 'authAPI: "https://{{config.ballot_box.domain}}/admin-api/iam/api/",' +# - regexp: 'dnieUrl:.*$' +# replace: 'dnieUrl: "https://{{config.ballot_box.domain}}/admin-api/iam/api/authmethod/dnie/auth/",' +# - regexp: 'electionsAPI:.*$' +# replace: 'electionsAPI: "https://{{config.ballot_box.domain}}/admin-api/elections/api/",' # this is not slow because yarn caches dependencies - name: sequent-ui, removing node_modules directory to start fresh diff --git a/sequent-ui/templates/SequentConfig.js b/sequent-ui/templates/SequentConfig.js index 50d00b56..0d96d817 100644 --- a/sequent-ui/templates/SequentConfig.js +++ b/sequent-ui/templates/SequentConfig.js @@ -429,6 +429,12 @@ var SequentConfigData = { angular.module('SequentConfig', []) .factory('ConfigService', function() { + baseUrl = $location.protocol() + "://" + $location.host; + SequentConfigData.publicURL = baseUrl + SequentConfigData.publicURL; + SequentConfigData.electionsAPI = baseUrl + SequentConfigData.electionsAPI; + SequentConfigData.dnieUrl = baseUrl + SequentConfigData.dnieUrl; + SequentConfigData.authAPI = baseUrl + SequentConfigData.authAPI; + SequentConfigData.baseUrl = baseUrl + SequentConfigData.baseUrl; return SequentConfigData; }); From 2174944b2ec9fbfde32dd94d3dbd4f188142a03c Mon Sep 17 00:00:00 2001 From: Luis Nabergoi <> Date: Sat, 24 Jun 2023 16:30:39 +0200 Subject: [PATCH 2/5] Changes in SequentConfig to define only path and not domain in Base URL --- sequent-ui/templates/SequentConfig.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sequent-ui/templates/SequentConfig.js b/sequent-ui/templates/SequentConfig.js index 0d96d817..0d7e288d 100644 --- a/sequent-ui/templates/SequentConfig.js +++ b/sequent-ui/templates/SequentConfig.js @@ -28,7 +28,7 @@ var SequentConfigData = { // 'https://foo/api/v3/' and always ends in '/'. base: '', theme: "{{ config.sequent_ui.theme }}", - baseUrl: "https://{{config.ballot_box.domain}}/elections/api/", + baseUrl: "/elections/api/", freeAuthId: 1, // Configurable Sign Up link @@ -57,10 +57,10 @@ var SequentConfigData = { preventSiteTranslation: {% if config.sequent_ui.prevent_site_translation %}true{% else %}false{% endif %}, // AuthApi base url - authAPI: "https://{{config.ballot_box.domain}}/iam/api/", - dnieUrl: "https://{{config.ballot_box.domain}}/iam/api/authmethod/dnie/auth/", + authAPI: "/iam/api/", + dnieUrl: "/iam/api/authmethod/dnie/auth/", // Agora Elections base url - electionsAPI: "https://{{config.ballot_box.domain}}/elections/api/", + electionsAPI: "/elections/api/", // Agora Admin help url helpUrl: "{{ config.sequent_ui.technology.documentation }}", @@ -285,7 +285,7 @@ var SequentConfigData = { {% if config.sequent_ui.custom_public_download_url %} publicURL: "{{ config.sequent_ui.custom_public_download_url }}", {% else %} - publicURL: "https://{{config.ballot_box.domain}}/elections/public/", + publicURL: "/elections/public/", {% endif %} // if we are in debug mode or not From 3d4beee30378b0e1aaea55c5bc7f3cd307df8d87 Mon Sep 17 00:00:00 2001 From: Luis Nabergoi <> Date: Sat, 24 Jun 2023 17:14:52 +0200 Subject: [PATCH 3/5] Changes in SequentConfig to define only path and not domain in Base URL --- sequent-ui/templates/SequentConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequent-ui/templates/SequentConfig.js b/sequent-ui/templates/SequentConfig.js index 0d7e288d..84a11d4f 100644 --- a/sequent-ui/templates/SequentConfig.js +++ b/sequent-ui/templates/SequentConfig.js @@ -428,7 +428,7 @@ var SequentConfigData = { }; angular.module('SequentConfig', []) - .factory('ConfigService', function() { + .factory('ConfigService', function($location) { baseUrl = $location.protocol() + "://" + $location.host; SequentConfigData.publicURL = baseUrl + SequentConfigData.publicURL; SequentConfigData.electionsAPI = baseUrl + SequentConfigData.electionsAPI; From 70519cc661f7adade4691f3bb425b3b79f0e1012 Mon Sep 17 00:00:00 2001 From: Luis Nabergoi <> Date: Mon, 26 Jun 2023 09:57:57 +0200 Subject: [PATCH 4/5] Changes in SequentConfig to define only path and not domain in Base URL --- sequent-ui/repo.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sequent-ui/repo.yml b/sequent-ui/repo.yml index 144566b9..020d8fba 100644 --- a/sequent-ui/repo.yml +++ b/sequent-ui/repo.yml @@ -80,24 +80,24 @@ regexp: "expires:.*" replace: " expires: {{ (config.iam.admin_auth_token_expiration_seconds / 60) | int }}," -#- name: sequent-ui, modifying admin-console SequentConfig.js for securing the api calls -# become: true -# become_user: ui_user -# replace: -# dest: /home/ui_user/admin-console/SequentConfig.js -# regexp: '{{ item.regexp }}' -# replace: '{{ item.replace }}' -# with_items: -# - regexp: 'baseUrl:.*$' -# replace: 'baseUrl: "https://{{config.ballot_box.domain}}/admin-api/elections/api/",' -# - regexp: 'publicURL:.*$' -# replace: 'publicURL: "https://{{config.ballot_box.domain}}/admin-api/elections/public/",' -# - regexp: 'authAPI:.*$' -# replace: 'authAPI: "https://{{config.ballot_box.domain}}/admin-api/iam/api/",' -# - regexp: 'dnieUrl:.*$' -# replace: 'dnieUrl: "https://{{config.ballot_box.domain}}/admin-api/iam/api/authmethod/dnie/auth/",' -# - regexp: 'electionsAPI:.*$' -# replace: 'electionsAPI: "https://{{config.ballot_box.domain}}/admin-api/elections/api/",' +- name: sequent-ui, modifying admin-console SequentConfig.js for securing the api calls + become: true + become_user: ui_user + replace: + dest: /home/ui_user/admin-console/SequentConfig.js + regexp: "{{ item.regexp }}" + replace: "{{ item.replace }}" + with_items: + - regexp: "baseUrl:.*$" + replace: 'baseUrl: "/admin-api/elections/api/",' + - regexp: "publicURL:.*$" + replace: 'publicURL: "/admin-api/elections/public/",' + - regexp: "authAPI:.*$" + replace: 'authAPI: "/admin-api/iam/api/",' + - regexp: "dnieUrl:.*$" + replace: 'dnieUrl: "/admin-api/iam/api/authmethod/dnie/auth/",' + - regexp: "electionsAPI:.*$" + replace: 'electionsAPI: "/admin-api/elections/api/",' # this is not slow because yarn caches dependencies - name: sequent-ui, removing node_modules directory to start fresh From a1cc3cd4db7ccf01e8faa3df63ba27bd50dbed67 Mon Sep 17 00:00:00 2001 From: Luis Nabergoi <> Date: Mon, 26 Jun 2023 15:29:19 +0200 Subject: [PATCH 5/5] Define BaseUrl variable 'var' --- sequent-ui/templates/SequentConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sequent-ui/templates/SequentConfig.js b/sequent-ui/templates/SequentConfig.js index 84a11d4f..083f9a17 100644 --- a/sequent-ui/templates/SequentConfig.js +++ b/sequent-ui/templates/SequentConfig.js @@ -429,7 +429,7 @@ var SequentConfigData = { angular.module('SequentConfig', []) .factory('ConfigService', function($location) { - baseUrl = $location.protocol() + "://" + $location.host; + var baseUrl = $location.protocol() + "://" + $location.host; SequentConfigData.publicURL = baseUrl + SequentConfigData.publicURL; SequentConfigData.electionsAPI = baseUrl + SequentConfigData.electionsAPI; SequentConfigData.dnieUrl = baseUrl + SequentConfigData.dnieUrl;