mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Renamed web-app-port-ui to web-app-desktop
This commit is contained in:
		| @@ -155,7 +155,7 @@ class FilterModule(object): | ||||
|                 if directive == 'frame-ancestors': | ||||
|                     # Enable loading via ancestors | ||||
|                     if self.is_feature_enabled(applications, 'desktop', application_id): | ||||
|                         domain = domains.get('web-app-port-ui')[0] | ||||
|                         domain = domains.get('web-app-desktop')[0] | ||||
|                         sld_tld = ".".join(domain.split(".")[-2:])  # yields "example.com" | ||||
|                         tokens.append(f"{sld_tld}")                 # yields "*.example.com" | ||||
|                  | ||||
|   | ||||
| @@ -50,7 +50,7 @@ ports: | ||||
|       web-app-moodle: 8026 | ||||
|       web-app-taiga: 8027 | ||||
|       web-app-friendica: 8028 | ||||
|       web-app-port-ui: 8029 | ||||
|       web-app-desktop: 8029 | ||||
|       web-app-bluesky_api: 8030 | ||||
|       web-app-bluesky_web: 8031 | ||||
|       web-app-keycloak: 8032 | ||||
|   | ||||
| @@ -2,7 +2,7 @@ document.addEventListener('DOMContentLoaded', function () { | ||||
|   initIframeHandler( | ||||
|     '{{ PRIMARY_DOMAIN }}', | ||||
|     '{{ domain }}', | ||||
|     '{{ domains | get_url("web-app-port-ui", WEB_PROTOCOL) }}' | ||||
|     '{{ domains | get_url("web-app-desktop", WEB_PROTOCOL) }}' | ||||
|   ); | ||||
| }); | ||||
| {% if MODE_DEBUG | bool %} | ||||
|   | ||||
| @@ -26,4 +26,4 @@ galaxy_info: | ||||
| dependencies: | ||||
|   - web-svc-legal | ||||
|   - web-svc-asset | ||||
|   - web-app-port-ui | ||||
|   - web-app-desktop | ||||
| @@ -1,4 +1,4 @@ | ||||
| # PortUI | ||||
| # Desktop | ||||
| 
 | ||||
| ## Description | ||||
| 
 | ||||
| @@ -5,11 +5,11 @@ | ||||
|         ( | ||||
|           not (item.value.features['desktop'] | default(false) | bool) | ||||
|         ) | ||||
|         or (domains | get_domain(item.key)).endswith(domains | get_domain('web-app-port-ui')) | ||||
|         or (domains | get_domain(item.key)).endswith(domains | get_domain('web-app-desktop')) | ||||
|     fail_msg: > | ||||
|       Application {{ item.key }} | ||||
|       has domain {{ domains | get_domain(item.key) }} | ||||
|       but it does not end with {{ domains | get_domain('web-app-port-ui') }}! | ||||
|       but it does not end with {{ domains | get_domain('web-app-desktop') }}! | ||||
|   loop: "{{ applications  | ||||
|              | dict2items  | ||||
|              | selectattr('key', 'match', '^(web-app-|web-svc-)') | ||||
| @@ -2,4 +2,4 @@ | ||||
| - block: | ||||
|     - include_tasks: 01_core.yml | ||||
|     - include_tasks: utils/run_once.yml | ||||
|   when: run_once_web_app_port_ui is not defined | ||||
|   when: run_once_web_app_desktop is not defined | ||||
| @@ -17,4 +17,4 @@ | ||||
|       description: Reload the application | ||||
|       icon: | ||||
|         class: fa-solid fa-rotate-right | ||||
|       url:   "{{ WEB_PROTOCOL }}://{{ domains | get_domain('web-app-port-ui') }}" | ||||
|       url:   "{{ WEB_PROTOCOL }}://{{ domains | get_domain('web-app-desktop') }}" | ||||
| @@ -1,4 +1,4 @@ | ||||
| application_id:               "web-app-port-ui" | ||||
| application_id:               "web-app-desktop" | ||||
| docker_repository_address:    "https://github.com/kevinveenbirkenbach/port-ui" | ||||
| config_inventory_path:        "{{ inventory_dir }}/files/{{ inventory_hostname }}/docker/web-app-port-ui/config.yaml.j2" | ||||
| config_inventory_path:        "{{ inventory_dir }}/files/{{ inventory_hostname }}/docker/web-app-desktop/config.yaml.j2" | ||||
| docker_pull_git_repository:   true | ||||
| @@ -7,7 +7,7 @@ docker: | ||||
| features: | ||||
|   matomo:       true  # activate tracking | ||||
|   css:          true  # use custom infinito stile  | ||||
|   desktop:      true  # Enable in port-ui | ||||
|   desktop:      true  # Enable in desktop | ||||
|   logout:       false | ||||
| server: | ||||
|   csp: | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| # Unit Tests | ||||
|  | ||||
| This directory contains unit tests for various custom components in the project, such as the custom lookup plugin `docker_cards` used in the `web-app-port-ui` role. | ||||
| This directory contains unit tests for various custom components in the project, such as the custom lookup plugin `docker_cards` used in the `web-app-desktop` role. | ||||
|  | ||||
| ## Overview | ||||
|  | ||||
| @@ -31,7 +31,7 @@ You can run the tests using one of the following methods: | ||||
| ## How It Works | ||||
|  | ||||
| - **Setup:**   | ||||
|   The test script creates a temporary directory to simulate your roles folder. It then creates a sample role (`web-app-port-ui`) with a `README.md` file (containing a header for the title) and a `meta/main.yml` file (with the required metadata). | ||||
|   The test script creates a temporary directory to simulate your roles folder. It then creates a sample role (`web-app-desktop`) with a `README.md` file (containing a header for the title) and a `meta/main.yml` file (with the required metadata). | ||||
|  | ||||
| - **Execution:**   | ||||
|   Dummy variable values for `domains` and `applications` are provided (these are the variables the lookup plugin expects). The lookup plugin is then run, which processes the sample role and returns the card information. | ||||
|   | ||||
| @@ -22,7 +22,7 @@ class TestApplicationsIfGroupAndDeps(unittest.TestCase): | ||||
|             'web-svc-legal': {}, | ||||
|             'web-svc-file': {}, | ||||
|             'web-svc-asset': {}, | ||||
|             'web-app-port-ui': {}, | ||||
|             'web-app-desktop': {}, | ||||
|             'util-srv-corporate-identity': {}, | ||||
|         } | ||||
|  | ||||
|   | ||||
| @@ -182,7 +182,7 @@ class TestCspFilters(unittest.TestCase): | ||||
|         # Ensure feature enabled and domain set | ||||
|         self.apps['app1']['features']['desktop'] = True | ||||
|         # simulate a subdomain for the application | ||||
|         self.domains['web-app-port-ui'] = ['domain-example.com'] | ||||
|         self.domains['web-app-desktop'] = ['domain-example.com'] | ||||
|          | ||||
|         header = self.filter.build_csp_header(self.apps, 'app1', self.domains, web_protocol='https') | ||||
|         # Expect '*.domain-example.com' in the frame-ancestors directive | ||||
|   | ||||
| @@ -22,27 +22,27 @@ class TestDomainMappings(unittest.TestCase): | ||||
|         self.assertEqual(result, []) | ||||
|  | ||||
|     def test_app_without_domains(self): | ||||
|         apps = {'web-app-port-ui': {}} | ||||
|         apps = {'web-app-desktop': {}} | ||||
|         # no domains key → no mappings | ||||
|         result = self.filter.domain_mappings(apps, self.primary) | ||||
|         self.assertEqual(result, []) | ||||
|  | ||||
|     def test_empty_domains_cfg(self): | ||||
|         apps = {'web-app-port-ui': {'domains': {}}} | ||||
|         default = 'port-ui.example.com' | ||||
|         apps = {'web-app-desktop': {'domains': {}}} | ||||
|         default = 'desktop.example.com' | ||||
|         expected = [] | ||||
|         result = self.filter.domain_mappings(apps, self.primary) | ||||
|         self.assertEqual(result, expected) | ||||
|  | ||||
|     def test_explicit_aliases(self): | ||||
|         apps = { | ||||
|             'web-app-port-ui': { | ||||
|             'web-app-desktop': { | ||||
|                 'server':{ | ||||
|                     'domains': {'aliases': ['alias.com']} | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         default = 'port-ui.example.com' | ||||
|         default = 'desktop.example.com' | ||||
|         expected = [ | ||||
|             {'source': 'alias.com',    'target': default}, | ||||
|         ] | ||||
| @@ -52,21 +52,21 @@ class TestDomainMappings(unittest.TestCase): | ||||
|  | ||||
|     def test_canonical_not_default(self): | ||||
|         apps = { | ||||
|             'web-app-port-ui': { | ||||
|             'web-app-desktop': { | ||||
|                 'server':{ | ||||
|                     'domains': {'canonical': ['foo.com']} | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         expected = [ | ||||
|             {'source': 'port-ui.example.com', 'target': 'foo.com'} | ||||
|             {'source': 'desktop.example.com', 'target': 'foo.com'} | ||||
|         ] | ||||
|         result = self.filter.domain_mappings(apps, self.primary) | ||||
|         self.assertEqual(result, expected) | ||||
|  | ||||
|     def test_canonical_dict(self): | ||||
|         apps = { | ||||
|             'web-app-port-ui': { | ||||
|             'web-app-desktop': { | ||||
|                 'server':{ | ||||
|                     'domains': { | ||||
|                         'canonical': {'one': 'one.com', 'two': 'two.com'} | ||||
| @@ -76,14 +76,14 @@ class TestDomainMappings(unittest.TestCase): | ||||
|         } | ||||
|         # first canonical key 'one' → one.com | ||||
|         expected = [ | ||||
|             {'source': 'port-ui.example.com', 'target': 'one.com'} | ||||
|             {'source': 'desktop.example.com', 'target': 'one.com'} | ||||
|         ] | ||||
|         result = self.filter.domain_mappings(apps, self.primary) | ||||
|         self.assertEqual(result, expected) | ||||
|  | ||||
|     def test_multiple_apps(self): | ||||
|         apps = { | ||||
|             'web-app-port-ui': { | ||||
|             'web-app-desktop': { | ||||
|                 'server':{'domains': {'aliases': ['a1.com']}} | ||||
|             }, | ||||
|             'web-app-mastodon': { | ||||
| @@ -91,7 +91,7 @@ class TestDomainMappings(unittest.TestCase): | ||||
|             }, | ||||
|         } | ||||
|         expected = [ | ||||
|             {'source': 'a1.com',              'target': 'port-ui.example.com'}, | ||||
|             {'source': 'a1.com',              'target': 'desktop.example.com'}, | ||||
|             {'source': 'mastodon.example.com',    'target': 'c2.com'}, | ||||
|         ] | ||||
|         result = self.filter.domain_mappings(apps, self.primary) | ||||
| @@ -99,21 +99,21 @@ class TestDomainMappings(unittest.TestCase): | ||||
|          | ||||
|     def test_multiple_aliases(self): | ||||
|         apps = { | ||||
|             'web-app-port-ui': { | ||||
|             'web-app-desktop': { | ||||
|                 'server':{'domains': {'aliases': ['a1.com','a2.com']} | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         expected = [ | ||||
|             {'source': 'a1.com', 'target': 'port-ui.example.com'}, | ||||
|             {'source': 'a2.com', 'target': 'port-ui.example.com'} | ||||
|             {'source': 'a1.com', 'target': 'desktop.example.com'}, | ||||
|             {'source': 'a2.com', 'target': 'desktop.example.com'} | ||||
|         ] | ||||
|         result = self.filter.domain_mappings(apps, self.primary) | ||||
|         self.assertCountEqual(result, expected) | ||||
|  | ||||
|     def test_invalid_aliases_type(self): | ||||
|         apps = { | ||||
|             'web-app-port-ui': {'server':{'domains': {'aliases': 123}}} | ||||
|             'web-app-desktop': {'server':{'domains': {'aliases': 123}}} | ||||
|         } | ||||
|         with self.assertRaises(AnsibleFilterError): | ||||
|             self.filter.domain_mappings(apps, self.primary) | ||||
|   | ||||
| @@ -6,8 +6,8 @@ import tempfile | ||||
| import shutil | ||||
| import unittest | ||||
|  | ||||
| # Adjust the PYTHONPATH to include the lookup_plugins folder from the web-app-port-ui role. | ||||
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../../roles/web-app-port-ui/lookup_plugins')) | ||||
| # Adjust the PYTHONPATH to include the lookup_plugins folder from the web-app-desktop role. | ||||
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../../roles/web-app-desktop/lookup_plugins')) | ||||
|  | ||||
| from docker_cards import LookupModule | ||||
|  | ||||
| @@ -17,8 +17,8 @@ class TestDockerCardsLookup(unittest.TestCase): | ||||
|         # Create a temporary directory to simulate the roles directory. | ||||
|         self.test_roles_dir = tempfile.mkdtemp(prefix="test_roles_") | ||||
|  | ||||
|         # Create a sample role "web-app-port-ui" under that directory. | ||||
|         self.role_name = "web-app-port-ui" | ||||
|         # Create a sample role "web-app-desktop" under that directory. | ||||
|         self.role_name = "web-app-desktop" | ||||
|         self.role_dir = os.path.join(self.test_roles_dir, self.role_name) | ||||
|         os.makedirs(os.path.join(self.role_dir, "meta")) | ||||
|         os.makedirs(os.path.join(self.role_dir, "vars")) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user