From 068110a683bcc476dd2dc531eaf3194e0328f01f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Thu, 7 Sep 2023 14:33:43 +0200 Subject: [PATCH 1/8] add basic server to serve GUI files --- .gitignore | 3 +- angular.json | 15 +++- lib/Zonemaster/GUI.pm | 136 +++++++++++++++++++++++++++++ lib/auto/share/dist/Zonemaster-GUI | 1 + package.json | 2 +- scripts/create_manifest.js | 25 ++++++ scripts/zonemaster-gui | 6 ++ share/templates/index.html.tt | 54 ++++++++++++ src/environments/common.ts | 2 +- 9 files changed, 237 insertions(+), 7 deletions(-) create mode 100644 lib/Zonemaster/GUI.pm create mode 120000 lib/auto/share/dist/Zonemaster-GUI create mode 100644 scripts/create_manifest.js create mode 100644 scripts/zonemaster-gui create mode 100644 share/templates/index.html.tt diff --git a/.gitignore b/.gitignore index 05f12ffa..25c33aba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. # compiled output -/dist +/share/dist +/share/manifest.json /dist-electron /release-builds /tmp diff --git a/angular.json b/angular.json index 14f8c1fb..dcac70dd 100644 --- a/angular.json +++ b/angular.json @@ -39,7 +39,7 @@ "allowedCommonJsDependencies": [ "file-saver" ], - "outputPath": "dist", + "outputPath": "share/dist", "index": "src/index.html", "main": "src/main.ts", "tsConfig": "src/tsconfig.app.json", @@ -49,8 +49,8 @@ "src/.htaccess" ], "styles": [ - "node_modules/fork-awesome/css/fork-awesome.min.css", - "src/styles.scss" + "src/styles.scss", + "node_modules/fork-awesome/css/fork-awesome.min.css" ], "scripts": [], "aot": true, @@ -72,7 +72,14 @@ }, "production": { "localize": true, - "optimization": true, + "optimization": { + "scripts": true, + "styles": { + "minify": true, + "inlineCritical": false + }, + "fonts": true + }, "outputHashing": "all", "sourceMap": false, "namedChunks": false, diff --git a/lib/Zonemaster/GUI.pm b/lib/Zonemaster/GUI.pm new file mode 100644 index 00000000..7fe77bcc --- /dev/null +++ b/lib/Zonemaster/GUI.pm @@ -0,0 +1,136 @@ +package Zonemaster::GUI; + +use strict; +use warnings; + +use Dancer2; +use Carp; +use Data::Dumper; +use I18N::AcceptLanguage; +use TOML::Tiny qw(from_toml); +use File::Slurp qw( read_file ); +use File::ShareDir qw( dist_dir ); + + +our $VERSION = '0.0.0'; + +# Generate configuration +get '/:lang/app.config.json' => sub { + send_as JSON => config->{client_config} +}; + +# Serve additional assets +get '/:lang/additional/**' => sub { + my ( $path ) = splat; + + if ( grep /^\.{2,}$/, @{$path} ) { + pass; + } else { + if ( defined config->{additional_assets_directory} ) { + send_file( path( config->{additional_assets_directory}, @{$path} ), system_path => 1 ); + } + } +}; + +# Serve localized GUI assets, serve index.html for all other requests under /:lang +get '/:lang/?**?' => sub { + my $lang = route_parameters->get('lang'); + my ( $path ) = splat; + my $filename = path( 'dist', $lang, @{$path} ); + + if ( ! grep { $_ eq $lang } @{config->{enabled_languages}} ) { + pass; + } else { + if (-f path( config->{public_dir}, $filename )) { + send_file $filename; + } else { + template 'index.html', { + styles => config->{static_resources}->{styles}, + scripts => config->{static_resources}->{scripts}, + baseurl => join('/', config->{base_url}, $lang, ""), + lang => $lang, + }; + } + } +}; + +# For all other request, redirect based on the browser prefered language +get '/**?' => sub { + my ( $path ) = splat; + my $accept_language = request_header 'Accept-Language'; + my $acceptor = I18N::AcceptLanguage->new( defaultLanguage => config->{default_language}); + my $lang = $acceptor->accepts($accept_language, config->{enabled_languages}); + + redirect uri_for( join('/', config->{base_url}, $lang, @{$path}) ); +}; + +sub build_app { + my $config_file_name = $ENV{ZONEMASTER_GUI_CONFIG_FILE} // "zonemaster-gui.toml"; + my $config_file = read_file $config_file_name; + my $config = from_toml($config_file); + my $install_directory = dist_dir('Zonemaster-GUI'); + + if (! exists $config->{general}->{default_language}) { + croak "Please set `default_language` in configuration file."; + } + + if (! exists $config->{general}->{enabled_languages}) { + croak "Please set `enabled_languages` in configuration file."; + } + + my $base_url = $config->{general}->{base_url} // ''; + + set ( + public_dir => $install_directory, + static_handler => false, + template => 'template_toolkit', + views => path($install_directory, 'templates'), + base_url => $base_url, + default_language => $config->{general}->{default_language}, + enabled_languages => [ @{$config->{general}->{enabled_languages}} ], + ); + + my %client_config; + while( my ($key, $value) = each %{$config->{client}} ) { + $key =~ s/_([[:alpha:]])/\U$1/g; + $client_config{$key} = $value; + } + + $client_config{defaultLanguage} = $config->{general}->{default_language}; + $client_config{enabledLanguages} = $config->{general}->{enabled_languages}; + + set client_config => \%client_config; + + my $manifest_file = read_file path($install_directory, "manifest.json"); + my $static_resources = decode_json($manifest_file); + my %final_static_resources; + + my @additional_styles = map { join('/', 'additional', $_) } @{$config->{customization}->{additional_styles}}; + my @additional_scripts = map { join('/', 'additional', $_) } @{$config->{customization}->{additional_scripts}}; + + my $override_default_style = $config->{general}->{override_default_style} // 0; + + $final_static_resources{styles} = + $override_default_style ? + \@additional_styles : + [ @{$static_resources->{styles}}, @additional_styles ]; + + $final_static_resources{scripts} = [ @{$static_resources->{scripts}}, @additional_scripts ]; + + set ( + static_resources => \%final_static_resources, + additional_assets_directory => $config->{customization}->{additional_assets_directory}, + ); + + if ( exists $config->{customization}->{template_override_directory} ) { + set engines => { + template => { + template_toolkit => { + include_path => $config->{customization}->{template_override_directory} + } + } + } + } + + return to_app; +} diff --git a/lib/auto/share/dist/Zonemaster-GUI b/lib/auto/share/dist/Zonemaster-GUI new file mode 120000 index 00000000..9d936b86 --- /dev/null +++ b/lib/auto/share/dist/Zonemaster-GUI @@ -0,0 +1 @@ +../../../../share \ No newline at end of file diff --git a/package.json b/package.json index 4e0fcfce..e35e5ef5 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "ng": "ng", "start": "ng serve", - "build": "node scripts/faq.js && ng build --configuration production", + "build": "node scripts/faq.js && ng build --configuration production && node scripts/create_manifest.js ", "release": "npm run build && node scripts/create_release.js", "lint": "ng lint", "e2e": "playwright test", diff --git a/scripts/create_manifest.js b/scripts/create_manifest.js new file mode 100644 index 00000000..4585861f --- /dev/null +++ b/scripts/create_manifest.js @@ -0,0 +1,25 @@ +const fs = require('fs'); + +fs.readdir('./share/dist/en', (err, files) => { + const manifest = { + styles: [], + scripts: [], + }; + + files.forEach(file => { + if (file.endsWith('.css')) { + manifest.styles.push(file); + } else if(file.endsWith('.js')) { + manifest.scripts.push(file); + } + }); + + + fs.writeFile('./share/manifest.json', JSON.stringify(manifest), err => { + if (err) { + console.error(err) + } else { + console.log('manifest.json written') + } + }) + }); diff --git a/scripts/zonemaster-gui b/scripts/zonemaster-gui new file mode 100644 index 00000000..dc2cd125 --- /dev/null +++ b/scripts/zonemaster-gui @@ -0,0 +1,6 @@ +#!/usr/bin/env perl +use Dancer2; +use Zonemaster::GUI; + +Zonemaster::GUI::build_app; +start; diff --git a/share/templates/index.html.tt b/share/templates/index.html.tt new file mode 100644 index 00000000..5adeb477 --- /dev/null +++ b/share/templates/index.html.tt @@ -0,0 +1,54 @@ + + + + + Zonemaster + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [% FOREACH file_name IN styles %] + + [% END %] + + + +
+ Loading +
+
+ + + + +[% FOREACH file_name IN scripts %] + +[% END %] + + diff --git a/src/environments/common.ts b/src/environments/common.ts index 95aff299..e3f281c5 100644 --- a/src/environments/common.ts +++ b/src/environments/common.ts @@ -17,6 +17,6 @@ export const common = { 'sv': 'Svenska' }, enabledLanguages: [ 'da', 'en', 'es', 'fi', 'fr', 'nb', 'sv' ], - configUrl: 'assets/app.config.json', + configUrl: 'app.config.json', pollingInterval: 5 * 1000, } From 9bfc5af8c2deed05dd63544de170df504aba1ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Mon, 18 Dec 2023 12:19:54 +0100 Subject: [PATCH 2/8] remove unused script --- compress.js | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 compress.js diff --git a/compress.js b/compress.js deleted file mode 100644 index 40c4daf5..00000000 --- a/compress.js +++ /dev/null @@ -1,17 +0,0 @@ -const brotli = require('brotli') -const fs = require('fs') - -const brotliSettings = { - extension: 'br', - skipLarger: true, - mode: 1, // 0 = generic, 1 = text, 2 = font (WOFF2) - quality: 10, // 0 - 11, - lgwin: 12 // default -} - -fs.readdirSync('dist/').forEach(file => { - if (file.endsWith('.js') || file.endsWith('.css') || file.endsWith('.html')) { - const result = brotli.compress(fs.readFileSync('dist/' + file), brotliSettings) - fs.writeFileSync('dist/' + file + '.br', result) - } -}) From d6ce027dfe0fb1c5f3ac7064bb621cc30957aca6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Mon, 18 Dec 2023 12:21:44 +0100 Subject: [PATCH 3/8] add packaging --- .gitignore | 28 +++++++++++++++-- MANIFEST.SKIP | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile.PL | 21 +++++++++++++ 3 files changed, 131 insertions(+), 3 deletions(-) create mode 100644 MANIFEST.SKIP create mode 100644 Makefile.PL diff --git a/.gitignore b/.gitignore index 25c33aba..e7bd1338 100644 --- a/.gitignore +++ b/.gitignore @@ -59,8 +59,30 @@ src/assets/faqs/gui-faq-*.html tests_output/ .e2e-chrome-profile/ -# Emacs backup files -*~ - # Generated by e2e /test-results + +/Makefile +Makefile.old +Build +Build.bat +META.* +MYMETA.* +.build/ +_build/ +cover_db/ +blib/ +.lwpcookies +.last_cover_stats +nytprof.out +pod2htm*.tmp +pm_to_blib +Zonemaster-* +Zonemaster-*.tar.gz +MANIFEST +inc + +# Ignore Emacs and other backup files +*.bak +*~ +.*.swp diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP new file mode 100644 index 00000000..2ae5a3ef --- /dev/null +++ b/MANIFEST.SKIP @@ -0,0 +1,85 @@ +^.angular/ +^.github/ +^.tmp/ +^additional/ +^dist/ +^docs/ +^e2e/ +^lib/auto/ +^inc/ +^node_modules/ +^src/ +^scripts/[^/]*\.js$ +^share/dist/[a-z]{2}/assets/app\.config(\.sample)?\.json$ +^test-results/ + +^\.browserslistrc$ +^\.editorconfig$ +^\.gitignore$ +^angular\.json$ +^package\.json$ +^package-lock\.json$ +^playwright\.config\.ts$ +^proxy\.conf\.json$ +^proxy\.disabled\.conf\.json$ +^tsconfig\.json$ +^zonemaster-gui\.toml$ + + +#!start included /usr/share/perl/5.20/ExtUtils/MANIFEST.SKIP +# Avoid version control files. +\bRCS\b +\bCVS\b +\bSCCS\b +,v$ +\B\.svn\b +\B\.git\b +\B\.gitignore\b +\b_darcs\b +\B\.cvsignore$ + +# Avoid VMS specific MakeMaker generated files +\bDescrip.MMS$ +\bDESCRIP.MMS$ +\bdescrip.mms$ + +# Avoid Makemaker generated and utility files. +\bMANIFEST\.bak +^Makefile$ +\bblib/ +\bMakeMaker-\d +\bpm_to_blib\.ts$ +\bpm_to_blib$ +\bblibdirs\.ts$ # 6.18 through 6.25 generated this + +# Avoid Module::Build generated and utility files. +\bBuild$ +\b_build/ +\bBuild.bat$ +\bBuild.COM$ +\bBUILD.COM$ +\bbuild.com$ + +# Avoid temp and backup files. +~$ +\.old$ +\#$ +\b\.# +\.bak$ +\.tmp$ +\.# +\.rej$ + +# Avoid OS-specific files/dirs +# Mac OSX metadata +\B\.DS_Store +# Mac OSX SMB mount metadata files +\B\._ + +# Avoid Devel::Cover and Devel::CoverX::Covered files. +\bcover_db\b +\bcovered\b + +# Avoid MYMETA files +^MYMETA\. +#!end included /usr/share/perl/5.20/ExtUtils/MANIFEST.SKIP diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 00000000..80929c7c --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,21 @@ +use inc::Module::Install; +use Module::Install::Share; + +name 'Zonemaster-GUI'; +all_from 'lib/Zonemaster/GUI.pm'; +repository 'https://github.com/zonemaster/zonemaster-gui'; +bugtracker 'https://github.com/zonemaster/zonemaster-gui/issues'; + +requires + 'Dancer2' => 0, + 'I18N::AcceptLanguage' => 0, + 'TOML::Tiny' => 0, + 'File::ShareDir' => 0, + 'File::Slurp' => 0, + ; + +install_script 'scripts/zonemaster-gui'; + +install_share; + +WriteAll From 9449966162276241af51786468efb322d15e1b65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Mon, 18 Dec 2023 12:22:14 +0100 Subject: [PATCH 4/8] update configuration structure --- lib/Zonemaster/GUI.pm | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/Zonemaster/GUI.pm b/lib/Zonemaster/GUI.pm index 7fe77bcc..4265ae2e 100644 --- a/lib/Zonemaster/GUI.pm +++ b/lib/Zonemaster/GUI.pm @@ -5,7 +5,6 @@ use warnings; use Dancer2; use Carp; -use Data::Dumper; use I18N::AcceptLanguage; use TOML::Tiny qw(from_toml); use File::Slurp qw( read_file ); @@ -68,7 +67,7 @@ sub build_app { my $config_file_name = $ENV{ZONEMASTER_GUI_CONFIG_FILE} // "zonemaster-gui.toml"; my $config_file = read_file $config_file_name; my $config = from_toml($config_file); - my $install_directory = dist_dir('Zonemaster-GUI'); + my $install_directory = $config->{general}->{install_directory} // dist_dir('Zonemaster-GUI'); if (! exists $config->{general}->{default_language}) { croak "Please set `default_language` in configuration file."; @@ -99,6 +98,35 @@ sub build_app { $client_config{defaultLanguage} = $config->{general}->{default_language}; $client_config{enabledLanguages} = $config->{general}->{enabled_languages}; + if (exists $config->{client}->{api_endpoint}) { + $client_config{apiEndpoint} = $config->{client}->{api_endpoint}; + } + + if (exists $config->{client}->{polling_interval}) { + $client_config{pollingInterval} = $config->{client}->{polling_interval}; + } + + if (exists $config->{customization}->{msg_banner}) { + $client_config{msgBanner} = $config->{customization}->{msg_banner}; + } + + if (exists $config->{customization}->{contact_address}) { + $client_config{contactAddress} = $config->{customization}->{contact_address}; + } + + if (exists $config->{customization}->{logo_url}) { + $client_config{logoUrl} = $config->{customization}->{logo_url}; + } + + if (exists $config->{customization}->{footer_logo}) { + $client_config{footerLogo} = $config->{customization}->{footer_logo}; + } + + if (exists $config->{customization}->{footer_logo_alt}) { + $client_config{footerLogo} = $config->{customization}->{footer_logo_alt}; + } + + set client_config => \%client_config; my $manifest_file = read_file path($install_directory, "manifest.json"); From 34be3c70f3dbbe6d6868dc6c07efa7c71a5e0beb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Mon, 18 Dec 2023 12:22:48 +0100 Subject: [PATCH 5/8] add example configuration --- zonemaster-gui.example.toml | 80 +++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 zonemaster-gui.example.toml diff --git a/zonemaster-gui.example.toml b/zonemaster-gui.example.toml new file mode 100644 index 00000000..ba498225 --- /dev/null +++ b/zonemaster-gui.example.toml @@ -0,0 +1,80 @@ +[general] + +# Base URL must be striped from path by reverse proxy +# Default value: "" +#base_url = "/zonemaster" + +# Directory where are GUI files are installed, replace by discovery using file share_dir +# Default value is discovered using File::ShareDir::dist_dir +#install_directory = "/usr/local/share/zonemaster/zonemaster-gui" + +# If defined, a directory that will be included as template source directory. +# Usefull to create template overrides. +# Default templates are in ${general.install_directory}/templates +# Default value: "" +#template_override_directory = "/var/lib/zonemaster/zonemaster-gui/templates" + +# The GUI default language to redirect to if language is unknown or unsupported +# Must be set +default_language = "en" + +# The list of accepted language +# Accepted language code are ["da", "en", "es", "fi", "fr", "nb", "sv"] +# Must be set +enabled_languages = ["da", "en", "es", "fi", "fr", "nb", "sv"] + +[customization] + +# A message to display to the user, if empty or undefined no banner will be shown. +# HTML formatting is supported (such as tag), characters such as &>< need to be written as HTML entities to be properly rendered. +# Default value: "" +#msg_banner = "" + +# The contact email address displayed in the footer. +# Default value: "contact@zonemaster.net" +#contact_address = "contact@zonemaster.net" + +# URL of the Zonemaster logo in the header +# Default value: "assets/images/zonemaster_logo_2021_color.png" +#logo_url = "additionnal/zonemaster.png" + +# If defined, a URL to a logo to be included in the footer. +# Default value: "" +#footer_logo = "additional/footer.png" + +# The alternative text to the footer logo. +# Set it if you have set `customization.footer_logo`. +# Default value: "" +#footer_logo_alt = "" + +# The directory where additional scripts and style sheets are placed. +# File in the additional assets directory can be requested using the URL ${languageCode}/additional/${pathToFile} +# Must be set if any kind of additional assets are used. +#additional_assets_directory = "/var/lib/zonemaster/zonemaster-gui/additional" + +# A list of additional style to be included. +# File names must be relative to `general.additional_assets_directory` and can contain query strings. +# The files will be included in the index.html file after the default styles. +#additional_styles = [ "my-orgnatisation-theme.css?v=1.3" ] + +# A list of additional scripts to be included. +# File names must be relative to `general.additional_assets_directory` and can contain query strings. +# The files will be included in the index.html file after the default scripts. +#additional_scripts = [ "new-feature.js?v=0.1" ] + +# If true, default style will not be injected, only the additional styles +# Default value: false +#override_default_style = true + +[client] + +# The URL to use to contact the Zonemaster Backend RPCAPI, default "/api". +# It could be either a full URL to use an API endpoint not located on the same origin as the one +# serving the GUI or just a path, like the default value, when both the API and GUI are served +# from the same origin. +# Default value: "/api" +#api_endpoint = "/api" + +# Time between each test progress query in millisecond. +# Default value: 5000 (5 seconds) +#polling_interval = 5000 From 93985f7b02253ba5cfb3d7870272af7059751af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Mon, 18 Dec 2023 13:36:01 +0100 Subject: [PATCH 6/8] fix config --- lib/Zonemaster/GUI.pm | 2 +- zonemaster-gui.example.toml | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Zonemaster/GUI.pm b/lib/Zonemaster/GUI.pm index 4265ae2e..6b471c8a 100644 --- a/lib/Zonemaster/GUI.pm +++ b/lib/Zonemaster/GUI.pm @@ -136,7 +136,7 @@ sub build_app { my @additional_styles = map { join('/', 'additional', $_) } @{$config->{customization}->{additional_styles}}; my @additional_scripts = map { join('/', 'additional', $_) } @{$config->{customization}->{additional_scripts}}; - my $override_default_style = $config->{general}->{override_default_style} // 0; + my $override_default_style = $config->{customization}->{override_default_style} // 0; $final_static_resources{styles} = $override_default_style ? diff --git a/zonemaster-gui.example.toml b/zonemaster-gui.example.toml index ba498225..6c2eaf9a 100644 --- a/zonemaster-gui.example.toml +++ b/zonemaster-gui.example.toml @@ -4,16 +4,10 @@ # Default value: "" #base_url = "/zonemaster" -# Directory where are GUI files are installed, replace by discovery using file share_dir +# Directory where are Zonemaster GUI files are installed # Default value is discovered using File::ShareDir::dist_dir #install_directory = "/usr/local/share/zonemaster/zonemaster-gui" -# If defined, a directory that will be included as template source directory. -# Usefull to create template overrides. -# Default templates are in ${general.install_directory}/templates -# Default value: "" -#template_override_directory = "/var/lib/zonemaster/zonemaster-gui/templates" - # The GUI default language to redirect to if language is unknown or unsupported # Must be set default_language = "en" @@ -47,6 +41,11 @@ enabled_languages = ["da", "en", "es", "fi", "fr", "nb", "sv"] # Default value: "" #footer_logo_alt = "" +# If defined, a directory that will be included as template source directory, usefull to create template overrides. +# Default templates are in ${general.install_directory}/templates +# Default value: "" +#template_override_directory = "/var/lib/zonemaster/zonemaster-gui/templates" + # The directory where additional scripts and style sheets are placed. # File in the additional assets directory can be requested using the URL ${languageCode}/additional/${pathToFile} # Must be set if any kind of additional assets are used. From 13a7b16722a78b066751683f59327a7b3201bc4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Mon, 18 Dec 2023 17:33:38 +0100 Subject: [PATCH 7/8] fix e2e tests --- e2e/zonemaster-gui.test.toml | 5 +++++ playwright.config.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 e2e/zonemaster-gui.test.toml diff --git a/e2e/zonemaster-gui.test.toml b/e2e/zonemaster-gui.test.toml new file mode 100644 index 00000000..3e9c5abb --- /dev/null +++ b/e2e/zonemaster-gui.test.toml @@ -0,0 +1,5 @@ +[general] +default_language = "en" +enabled_languages = ["da", "en", "es", "fi", "fr", "nb", "sv"] + +# All client config are hardcoded in environment.tests.js diff --git a/playwright.config.ts b/playwright.config.ts index 29904ae1..96c606d1 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -4,7 +4,7 @@ const config: PlaywrightTestConfig = { testDir: 'e2e', testMatch: 'e2e/*.e2e-spec.ts', webServer: { - command: 'ng build --configuration=tests --localize && node scripts/test_server.js', + command: 'ng build --configuration=tests --localize && node scripts/create_manifest.js && ZONEMASTER_GUI_CONFIG_FILE=e2e/zonemaster-gui.test.toml plackup ./scripts/zonemaster-gui --port 4201 --access-log zonemaster-gui.test.log', port: 4201, reuseExistingServer: true, }, From a03392736ad30fa47669f59aa6e2f0e0a3547065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Berthaud-M=C3=BCller?= Date: Mon, 18 Dec 2023 17:38:16 +0100 Subject: [PATCH 8/8] remove unused files from assets --- MANIFEST.SKIP | 2 ++ angular.json | 4 ++-- src/.htaccess | 13 ------------- src/assets/app.config.sample.json | 11 ----------- 4 files changed, 4 insertions(+), 26 deletions(-) delete mode 100644 src/.htaccess delete mode 100644 src/assets/app.config.sample.json diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP index 2ae5a3ef..2ddcf860 100644 --- a/MANIFEST.SKIP +++ b/MANIFEST.SKIP @@ -24,6 +24,8 @@ ^proxy\.disabled\.conf\.json$ ^tsconfig\.json$ ^zonemaster-gui\.toml$ +.log$ +^Zonemaster-.+\.tar\.gz$ #!start included /usr/share/perl/5.20/ExtUtils/MANIFEST.SKIP diff --git a/angular.json b/angular.json index dcac70dd..4cb49104 100644 --- a/angular.json +++ b/angular.json @@ -45,8 +45,8 @@ "tsConfig": "src/tsconfig.app.json", "polyfills": "src/polyfills.ts", "assets": [ - "src/assets", - "src/.htaccess" + "src/assets/favicon", + "src/assets/images" ], "styles": [ "src/styles.scss", diff --git a/src/.htaccess b/src/.htaccess deleted file mode 100644 index 9b1feb96..00000000 --- a/src/.htaccess +++ /dev/null @@ -1,13 +0,0 @@ - - Options Indexes FollowSymLinks - RewriteEngine On - RewriteBase / - -# If an existing asset or directory is requested go to it as it is - RewriteCond %{REQUEST_FILENAME} -f [OR] - RewriteCond %{REQUEST_FILENAME} -d - RewriteRule ^ - [L] - -# If the requested resource doesn't exist, use index.html - RewriteRule ^ /index.html - diff --git a/src/assets/app.config.sample.json b/src/assets/app.config.sample.json deleted file mode 100644 index 4166df6b..00000000 --- a/src/assets/app.config.sample.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "apiEndpoint": "/api", - "contactAddress": "contact@zonemaster.net", - "defaultLanguage": "en", - "enabledLanguages": [ "da", "en", "es", "fi", "fr", "nb", "sv" ], - "logoUrl": "assets/images/zonemaster_logo_2021_color.png", - "msgBanner": "", - "pollingInterval": 5000, - "footerLogo": "", - "footerLogoAlt": "" -}