From 800d2d60b2e98b777e09dfda7b3bf49cb9547680 Mon Sep 17 00:00:00 2001 From: Roy R Date: Tue, 4 Jan 2022 13:16:57 -0500 Subject: [PATCH 01/17] Add audit github action. --- .github/workflows/audit.yml | 41 +++++++++++++++++++++++++++++++++++++ package.json | 4 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/audit.yml diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 000000000..f6c575e8a --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,41 @@ +name: Audit + +on: [pull_request] + +env: + WEBAPP_NAME: ninjawars # set this to your application's name + WEBAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root + NODE_VERSION: "16.13.1" # set this to the node version to use + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_READ_TOKEN }} + CI: false +jobs: + lighthouseci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: ${{ env.NODE_VERSION }} + #always-auth: true + #registry-url: "https://npm.pkg.github.com" + - name: Yarn packages audit + run: yarn npm audit + continue-on-error: true + - name: Install, configure, install the lighthouse auditor + run: | + # Check the node version + node --version + corepack enable + # Install the project, then... + # yarn workspaces run init-project + yarn init-project + yarn install --immutable + #yarn bootstrap + - name: Build + run: | + # Stop eslint from failing the build + rm .eslintrc.json + yarn build + - name: Run Lighthouse audit + run: npx @lhci/cli@0.4.0 autorun diff --git a/package.json b/package.json index 8dd87f44c..5eddf0617 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,12 @@ "doc": "docs" }, "scripts": { + "init-project": "echo 'no-op for now'", "lint": "eslint --ext .jsx,.js deploy/www/js", "prepare-unit-test-ci": "echo 'no-op for now'", "start": "yarn time && make build && yarn time", "post-deploy": "php deploy/deployed_scripts/resetcache.php", + "build": "make build", "watch": "livereload ./deploy/* ./deploy/www/* ./deploy/templates/* ./deploy/lib/control/* --debug", "security-check": "yarn audit", "time": "node -e \"console.log( new Date().toISOString() );\"", @@ -41,7 +43,7 @@ "url": "https://github.com/BitLucid/ninjawars/issues" }, "engines": { - "node": ">=16.0.0" + "node": ">=16.13.0" }, "homepage": "https://github.com/BitLucid/ninjawars#readme", "devDependencies": { From cb3612c50193b2a2843f26c80ad50a048f48a0e4 Mon Sep 17 00:00:00 2001 From: Roy R Date: Tue, 4 Jan 2022 14:29:42 -0500 Subject: [PATCH 02/17] Create static build process for index and intro pages. --- .github/workflows/audit.yml | 11 +++++- .lighthouserc.js | 47 +++++++++++++++++++++++ Makefile | 3 ++ deploy/conf/nw.local.nginx | 18 ++++----- deploy/lib/plugins/function.cachebust.php | 2 +- deploy/resources.build.php | 15 ++++---- deploy/resources.template.php | 3 +- deploy/www/intro-controller.php | 44 +++++++++++++++++++++ package.json | 1 + 9 files changed, 124 insertions(+), 20 deletions(-) create mode 100644 .lighthouserc.js create mode 100644 deploy/www/intro-controller.php diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index f6c575e8a..b6a90eb26 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -37,5 +37,12 @@ jobs: # Stop eslint from failing the build rm .eslintrc.json yarn build - - name: Run Lighthouse audit - run: npx @lhci/cli@0.4.0 autorun + - name: Audit URLs using Lighthouse + uses: treosh/lighthouse-ci-action@v8 + with: + urls: | + http://localhost:7474/ + http://localhost:7474/intro + budgetPath: ./.budget.json # test performance budgets + uploadArtifacts: true # save results as an action artifacts + temporaryPublicStorage: true # upload lighthouse report to the temporary storage diff --git a/.lighthouserc.js b/.lighthouserc.js new file mode 100644 index 000000000..9dca473fe --- /dev/null +++ b/.lighthouserc.js @@ -0,0 +1,47 @@ +module.exports = { + ci: { + collect: { + staticDistDir: 'deploy/www', + isSinglePageApplication: true, + numberOfRuns: 1 + }, + upload: { + // target: 'filesystem' + target: 'temporary-public-storage' + }, + assert: { + "preset": "lighthouse:no-pwa", // Change this to "lighthouse:recommended" when we move to a PWA in the future + assertions: { + "maskable-icon": "off", + "service-worker": "off", + "tap-targets": "off", + "apple-touch-icon": "off", + "first-contentful-paint": ['warn', { minScore: 0.9 }], + "interactive": ['warn', { minScore: 0.9 }], + "last-contentful-paint": ['warn'], + "largest-contentful-paint": ['warn'], + "first-meaningful-paint": ['warn'], + "label": ['warn'], + "max-potential-fid": ['warn', { minScore: 0.9 }], + //"render-blocking-resources": ['warn', { minScore: 0.4 }], + "speed-index": ['warn', { minScore: 0.9 }], + "mainthread-work-breakdown": ['warn', { minScore: 0.9 }], + "legacy-javascript": ['warn', { auditRan: 1 }], + "duplicated-javascript": ['warn'], + "unused-javascript": ['warn', { maxLength: 4 }], + "unminified-javascript": ['warn'], + "uses-long-cache-ttl": ['warn', { maxLength: 13 }], + "uses-rel-preconnect": ['warn'], + "render-blocking-resources": ['error', { maxLength: 2 }], + "font-size": ['warn'], + "bootup-time": ['warn', { minScore: 0.65 }], + "button-name": ['warn', { minScore: 0.65 }], + "link-name": ['warn', { minScore: 0.65 }], + "color-contrast": ['warn', { minScore: 0.65 }], + "robots-txt": ['warn'], + "first-cpu-idle": ['warn', { minScore: 0.85 }], + "meta-description": ['warn'], + } + }, + } +} diff --git a/Makefile b/Makefile index 98367dd79..05807fa38 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,9 @@ build: dep @ln -sf "$(RELATIVE_COMPONENTS)jquery-linkify/jquery.linkify.js" "$(JS)" @ln -sf "$(RELATIVE_VENDOR)twbs/bootstrap/dist/css/bootstrap.min.css" "$(CSS)" @ln -sf "$(RELATIVE_VENDOR)twbs/bootstrap/dist/js/bootstrap.min.js" "$(JS)" + php deploy/www/intro-controller.php > deploy/www/intro.html + php deploy/www/front-controller.php > deploy/www/index.html + @echo "Built front controller to static deploy/www/index.html file and deploy/www/intro.html file" rm -rf ./deploy/templates/compiled/* ./deploy/templates/cache/* mkdir -p ./deploy/templates/compiled ./deploy/templates/cache ./deploy/resources/logs/ chmod -R ugo+rwX ./deploy/templates/compiled ./deploy/templates/cache diff --git a/deploy/conf/nw.local.nginx b/deploy/conf/nw.local.nginx index 4d317627a..2cad0340f 100644 --- a/deploy/conf/nw.local.nginx +++ b/deploy/conf/nw.local.nginx @@ -39,15 +39,15 @@ server { try_files $uri =404; } - location = /intro { - add_header X-Frame-Options SAMEORIGIN; - try_files intro.html =404; - } - - location = / { - add_header X-Frame-Options SAMEORIGIN; - try_files index.html =404; - } + #location = /intro { + # add_header X-Frame-Options SAMEORIGIN; + # try_files intro.html =404; + #} + + #location = / { + # add_header X-Frame-Options SAMEORIGIN; + # try_files index.html =404; + #} location / { #default fallback of everything else block diff --git a/deploy/lib/plugins/function.cachebust.php b/deploy/lib/plugins/function.cachebust.php index 5bb6b21c1..b2b6ce384 100644 --- a/deploy/lib/plugins/function.cachebust.php +++ b/deploy/lib/plugins/function.cachebust.php @@ -8,7 +8,7 @@ function smarty_function_cachebust($p_params) { $file = ROOT."/www/$p_params[file]"; - if (is_file($file)) { + if (is_file($file) && HASH_ASSET_PATHS) { $mtime = filemtime($file); $pathParts = pathinfo($p_params['file']); return $pathParts['dirname'].'/'.$pathParts['filename'].".$mtime.".$pathParts['extension']; diff --git a/deploy/resources.build.php b/deploy/resources.build.php index fdc262129..f138671e4 100644 --- a/deploy/resources.build.php +++ b/deploy/resources.build.php @@ -6,12 +6,13 @@ define('DATABASE_USE_PASSWORD', false); // *** Whether to specify password to pdo at all. Generally true only on live define('DATABASE_USE_PORT', false); // *** Whether to specify port to pdo at all. Generally true only on live define('DATABASE_USE_HOST', false); // *** Whether to specify HOST to pdo at all. Generally true only on live -define('DATABASE_HOST', "localhost"); // *** The host to connect to for the database, localhost by default -define('DATABASE_PORT', "5432"); // *** The port number to connect on. -define('DATABASE_USER', "postgres"); // *** The user that should connect to the database -define('DATABASE_PASSWORD', "unused_in_build"); // *** The password for the database connection, trust on dev -define('DATABASE_NAME', "nw"); // *** The name of the database to connect to, nw on dev -define('OFFLINE', false); // *** Controls if remote or local resources are used +define('DATABASE_HOST', "localhost"); // *** The host to connect to for the database, localhost by default +define('DATABASE_PORT', "5432"); // *** The port number to connect on. +define('DATABASE_USER', "postgres"); // *** The user that should connect to the database +define('DATABASE_PASSWORD', "unused_in_build"); // *** The password for the database connection, trust on dev +define('DATABASE_NAME', "nw"); // *** The name of the database to connect to, nw on dev +define('OFFLINE', true); // *** Controls if remote or local resources are used +define('HASH_ASSET_PATHS', false); // *** Controls if cachebusting hash strings for assets like images are used define('DEBUG', true); // *** Shorter debugging constant name, set as false on live. define('SERVER_ROOT', realpath(__DIR__).'/'); // *** The root deployment directory of the game // Generally for the install purposes the SERVER_ROOT should correspond to /srv/ninjawars/deploy/ @@ -28,7 +29,7 @@ define('FACEBOOK_APP_ID', '30479872633'); // Non-confidential id for the facebook app define('FACEBOOK_APP_SECRET', 'mooMooIAmACow'); // Secret! string for facebook login auth stuff. -define('TRAP_ERRORS', true); // Whether to use the global error handler & oops page, true on live. +define('TRAP_ERRORS', false); // Whether to use the global error handler & oops page, true on live. define('TEMPLATE_LIBRARY_PATH', SERVER_ROOT.'vendor/smarty/smarty/libs/Smarty.class.php'); // Path to Smarty 3 diff --git a/deploy/resources.template.php b/deploy/resources.template.php index 3a7430b96..3d53bbb27 100644 --- a/deploy/resources.template.php +++ b/deploy/resources.template.php @@ -11,7 +11,8 @@ define('DATABASE_USER', __DB_USER__); // *** The user that should connect to the database define('DATABASE_NAME', __DB_NAME__); // *** The name of the database to connect to define('DATABASE_PASSWORD', __DB_PASS__); // *** The password for the database connection -define('OFFLINE', __OFFLINE__); // *** Controls if remote or local resources are used +define('OFFLINE', __OFFLINE__); // *** Controls if remote or local resources are used +define('HASH_ASSET_PATHS', true); // *** Controls if cachebusting hash strings for assets like images are used define('DEBUG', __DEBUG__); // *** Shorter debugging constant name, set as false on live. define('SERVER_ROOT', __SERVER_ROOT__); // *** The root deployment directory of the game // Generally for the install purposes the SERVER_ROOT should correspond to /srv/ninjawars/deploy/ diff --git a/deploy/www/intro-controller.php b/deploy/www/intro-controller.php new file mode 100644 index 000000000..22e60e31c --- /dev/null +++ b/deploy/www/intro-controller.php @@ -0,0 +1,44 @@ +get('player_id'); + return $player_id ? Player::find($player_id) : null; + }; + + $container['session'] = function ($c) { + return SessionFactory::getSession(); + }; + + // Update the activity of the page viewer in the database. + RequestWrapper::init(); + + // get the request information to parse the route + $response = Router::route(Request::create( + '/intro', + 'GET', + ), $container); + + if ($response instanceof Response) { + $response->send(); + } else { + throw new \RuntimeException('Route returned something other than a Response'); + } +} catch (RouteNotFoundException $e) { + Router::respond404(); +} diff --git a/package.json b/package.json index 5eddf0617..989d5a74d 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "start": "yarn time && make build && yarn time", "post-deploy": "php deploy/deployed_scripts/resetcache.php", "build": "make build", + "serve": "yarn dlx serve deploy/www/ -p 7474", "watch": "livereload ./deploy/* ./deploy/www/* ./deploy/templates/* ./deploy/lib/control/* --debug", "security-check": "yarn audit", "time": "node -e \"console.log( new Date().toISOString() );\"", From 9b5607b5b90cc4573c3742963a725ddd63dfb552 Mon Sep 17 00:00:00 2001 From: Roy R Date: Tue, 4 Jan 2022 14:47:43 -0500 Subject: [PATCH 03/17] Still yarn install during audit. --- .github/workflows/audit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index b6a90eb26..f3f9fc442 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -27,6 +27,9 @@ jobs: # Check the node version node --version corepack enable + yarn install --immutable + # I guess this is still required? + # corepack enable should have made this unnecessary # Install the project, then... # yarn workspaces run init-project yarn init-project From 0bfdb45594f57d30b58aa6a8d64dce7f9f19bc6a Mon Sep 17 00:00:00 2001 From: Roy R Date: Tue, 4 Jan 2022 14:48:03 -0500 Subject: [PATCH 04/17] Unit test cachebust more permissively. --- deploy/tests/unit/SmartyPluginUnitTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/tests/unit/SmartyPluginUnitTest.php b/deploy/tests/unit/SmartyPluginUnitTest.php index 5caf397dc..160abadbf 100644 --- a/deploy/tests/unit/SmartyPluginUnitTest.php +++ b/deploy/tests/unit/SmartyPluginUnitTest.php @@ -17,9 +17,9 @@ class SmartyPluginUnitTest extends \PHPUnit\Framework\TestCase { public const URL = 'https://localhost.com/go/?query=string'; public function testCachebustPositive() { - $result = smarty_function_cachebust(['file'=>self::EXISTING_FILE]); - $this->assertNotEquals(self::EXISTING_FILE, $result); + $result = smarty_function_cachebust(['file' => self::EXISTING_FILE]); $this->assertGreaterThan(strlen(self::EXISTING_FILE), strlen($result)); + $this->assertContains(self::EXISTING_FILE, $result); } public function testCachebustNegative() { From 2b6e4824c18c3407402e435c30cf62903b86d59f Mon Sep 17 00:00:00 2001 From: Roy R Date: Tue, 4 Jan 2022 14:57:48 -0500 Subject: [PATCH 05/17] Test green if hash not added to file, as long as it generally contains the initial part of the path still. --- deploy/tests/unit/SmartyPluginUnitTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/deploy/tests/unit/SmartyPluginUnitTest.php b/deploy/tests/unit/SmartyPluginUnitTest.php index 160abadbf..b126d4509 100644 --- a/deploy/tests/unit/SmartyPluginUnitTest.php +++ b/deploy/tests/unit/SmartyPluginUnitTest.php @@ -18,7 +18,6 @@ class SmartyPluginUnitTest extends \PHPUnit\Framework\TestCase { public function testCachebustPositive() { $result = smarty_function_cachebust(['file' => self::EXISTING_FILE]); - $this->assertGreaterThan(strlen(self::EXISTING_FILE), strlen($result)); $this->assertContains(self::EXISTING_FILE, $result); } From b099111ece1a7525765bf8c2d6be71389e96a2bf Mon Sep 17 00:00:00 2001 From: Roy R Date: Sun, 9 Jan 2022 19:30:28 -0500 Subject: [PATCH 06/17] init-project is just an echo for now --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 989d5a74d..396a8d88f 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "doc": "docs" }, "scripts": { - "init-project": "echo 'no-op for now'", + "init-project": "echo 'no-op for config'", "lint": "eslint --ext .jsx,.js deploy/www/js", "prepare-unit-test-ci": "echo 'no-op for now'", "start": "yarn time && make build && yarn time", From 291df18f40c7844b360e2e029cfa9221be452873 Mon Sep 17 00:00:00 2001 From: Roy R Date: Fri, 14 Jan 2022 22:54:58 -0500 Subject: [PATCH 07/17] Update audit.yml --- .github/workflows/audit.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index f3f9fc442..29492dec9 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -27,13 +27,12 @@ jobs: # Check the node version node --version corepack enable - yarn install --immutable - # I guess this is still required? # corepack enable should have made this unnecessary # Install the project, then... # yarn workspaces run init-project yarn init-project yarn install --immutable + # I guess even with corepack the yarn install is still required? #yarn bootstrap - name: Build run: | From cfcb16b4ad6d64fced39e97d0ce03ef4e335614b Mon Sep 17 00:00:00 2001 From: Roy R Date: Tue, 4 Jan 2022 16:08:17 -0500 Subject: [PATCH 08/17] Bump ratchet due to intro script being in www now. --- Makefile | 1 - deploy/tests/functional/test_ratchets.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 05807fa38..869c66389 100644 --- a/Makefile +++ b/Makefile @@ -145,7 +145,6 @@ check-for-syntax-errors: @find "./deploy/www/" -name "*.php" -exec php -l {} \;|grep -v "No syntax errors" || true test-unit: check-for-syntax-errors - @$(TEST_RUNNER) $(CC_FLAG) --testsuite Unit test-quick: check-for-syntax-errors diff --git a/deploy/tests/functional/test_ratchets.py b/deploy/tests/functional/test_ratchets.py index 3942b86f8..9334f2b6c 100644 --- a/deploy/tests/functional/test_ratchets.py +++ b/deploy/tests/functional/test_ratchets.py @@ -10,7 +10,7 @@ class TestRatchets: and checks the overall SLOC of the project ''' control_php = 37 - www_php = 1 + www_php = 2 plus_minus = 6 ''' Rough file counts in pertinent directories ''' From b928ba65cd6edaf4d483e869135582a99a6368ae Mon Sep 17 00:00:00 2001 From: Roy R Date: Sun, 23 Jan 2022 15:24:46 -0500 Subject: [PATCH 09/17] Update build slightly, and run in php.yml workflow, make build in the php github action. --- .github/workflows/php.yml | 5 +++++ Makefile | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4de75e3a6..9346f38f4 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -56,6 +56,11 @@ jobs: # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" # Docs: https://getcomposer.org/doc/articles/scripts.md + - name: Run build + run: | + ln -s ./resources.build.php ./deploy/resources.php + make build + - name: Run test suite run: | ln -s ./resources.build.php ./deploy/resources.php diff --git a/Makefile b/Makefile index 869c66389..630ee3f04 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,12 @@ endif build: dep mkdir -p $(JS) + @echo "Don't forget to update nginx configs as necessary." + @echo "Including updating the php to retain login sessions longer." + cp -upn ./deploy/resources.build.php ./deploy/resources.php + echo "Note that this does not overwrite existing resources.php" + php ./deploy/check.php + echo "Check that the webserver user has permissions to the script!" @ln -sf "$(RELATIVE_COMPONENTS)jquery/jquery.min.js" "$(JS)" @ln -sf "$(RELATIVE_COMPONENTS)jquery/jquery.min.map" "$(JS)" @ln -sf "$(RELATIVE_COMPONENTS)jquery-timeago/jquery.timeago.js" "$(JS)" From a1b2f8ecdea8ce79b0332b92cf89c32fcdc1c5bc Mon Sep 17 00:00:00 2001 From: Roy R Date: Thu, 23 Jun 2022 15:50:51 -0400 Subject: [PATCH 10/17] Fix bad cachebust assertion. --- deploy/tests/unit/SmartyPluginUnitTest.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy/tests/unit/SmartyPluginUnitTest.php b/deploy/tests/unit/SmartyPluginUnitTest.php index b126d4509..4845d47b9 100644 --- a/deploy/tests/unit/SmartyPluginUnitTest.php +++ b/deploy/tests/unit/SmartyPluginUnitTest.php @@ -18,7 +18,8 @@ class SmartyPluginUnitTest extends \PHPUnit\Framework\TestCase { public function testCachebustPositive() { $result = smarty_function_cachebust(['file' => self::EXISTING_FILE]); - $this->assertContains(self::EXISTING_FILE, $result); + $this->assertNotEmpty($result); + $this->assertStringContainsString(self::EXISTING_FILE, $result); } public function testCachebustNegative() { From 3be7f6da525163024be13dad0108a8187de0af57 Mon Sep 17 00:00:00 2001 From: Roy R Date: Thu, 23 Jun 2022 17:32:10 -0400 Subject: [PATCH 11/17] gitignore the static build html files. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index dcca8f12d..96baf5224 100644 --- a/.gitignore +++ b/.gitignore @@ -100,3 +100,5 @@ karma.conf.js .php-cs-fixer.cache deploy/www/index.html deploy/www/intro.html +deploy/www/login.html +deploy/www/signup.html From 0a3cb05be71b315f24258deb6172dff8c7f520da Mon Sep 17 00:00:00 2001 From: Roy R Date: Thu, 23 Jun 2022 18:41:57 -0400 Subject: [PATCH 12/17] Remove database connection check from build. --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 630ee3f04..989af98b5 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,6 @@ build: dep @echo "Including updating the php to retain login sessions longer." cp -upn ./deploy/resources.build.php ./deploy/resources.php echo "Note that this does not overwrite existing resources.php" - php ./deploy/check.php echo "Check that the webserver user has permissions to the script!" @ln -sf "$(RELATIVE_COMPONENTS)jquery/jquery.min.js" "$(JS)" @ln -sf "$(RELATIVE_COMPONENTS)jquery/jquery.min.map" "$(JS)" From a86543420bef94fcdf9095d4129c274b47cd2ad6 Mon Sep 17 00:00:00 2001 From: Roy R Date: Fri, 24 Jun 2022 00:53:20 -0400 Subject: [PATCH 13/17] Split integration from file tests. --- Makefile | 4 ++++ deploy/check.php | 30 +++++++----------------------- deploy/checkbase.php | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 deploy/checkbase.php diff --git a/Makefile b/Makefile index 989af98b5..2020f25f5 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ build: dep @ln -sf "$(RELATIVE_COMPONENTS)jquery-linkify/jquery.linkify.js" "$(JS)" @ln -sf "$(RELATIVE_VENDOR)twbs/bootstrap/dist/css/bootstrap.min.css" "$(CSS)" @ln -sf "$(RELATIVE_VENDOR)twbs/bootstrap/dist/js/bootstrap.min.js" "$(JS)" + make check-base php deploy/www/intro-controller.php > deploy/www/intro.html php deploy/www/front-controller.php > deploy/www/index.html @echo "Built front controller to static deploy/www/index.html file and deploy/www/intro.html file" @@ -53,6 +54,9 @@ dep: check: pre-test +check-base: + php deploy/checkbase.php + js-deps: node -v corepack enable diff --git a/deploy/check.php b/deploy/check.php index 39ae4725e..9def67c63 100644 --- a/deploy/check.php +++ b/deploy/check.php @@ -1,39 +1,23 @@ Date: Tue, 19 Jul 2022 22:23:44 +0000 Subject: [PATCH 14/17] Format code with php-cs-fixer --- deploy/checkbase.php | 4 ++-- deploy/www/intro-controller.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/checkbase.php b/deploy/checkbase.php index c854f5975..31f9e17fd 100644 --- a/deploy/checkbase.php +++ b/deploy/checkbase.php @@ -1,4 +1,5 @@ Date: Tue, 19 Jul 2022 18:27:58 -0400 Subject: [PATCH 15/17] Update ratchets for new audit files. --- deploy/tests/functional/test_ratchets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/tests/functional/test_ratchets.py b/deploy/tests/functional/test_ratchets.py index 9334f2b6c..b6ed18b3c 100644 --- a/deploy/tests/functional/test_ratchets.py +++ b/deploy/tests/functional/test_ratchets.py @@ -10,7 +10,7 @@ class TestRatchets: and checks the overall SLOC of the project ''' control_php = 37 - www_php = 2 + www_php = 4 plus_minus = 6 ''' Rough file counts in pertinent directories ''' From fb866b3fb45c1bf0a7cc254f7cd165491cfa2abd Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 12 Jan 2023 06:42:36 +0000 Subject: [PATCH 16/17] Format code with php-cs-fixer --- deploy/check.php | 3 +-- deploy/lib/extensions/Nmail.class.php | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/deploy/check.php b/deploy/check.php index 9def67c63..9ab1fad2f 100644 --- a/deploy/check.php +++ b/deploy/check.php @@ -7,8 +7,7 @@ $connected = (bool) query_item('select 1 from players limit 1'); $is_superuser = (bool) query_item('select usesuper from pg_user where usename = CURRENT_USER;') === true; -function passfailB($passed, $pass, $fail) -{ +function passfailB($passed, $pass, $fail) { $messaging = ($passed ? '[PASSING]: Reason ' . $pass : '[FAILING]: Reason ' . $fail); echo "$messaging\n"; return $passed; diff --git a/deploy/lib/extensions/Nmail.class.php b/deploy/lib/extensions/Nmail.class.php index 6b435ce5e..61ce19d39 100644 --- a/deploy/lib/extensions/Nmail.class.php +++ b/deploy/lib/extensions/Nmail.class.php @@ -102,7 +102,7 @@ public function send() { //Optionally add any attachments // ->attach(Swift_Attachment::fromPath('my-document.pdf')) - ; + ; if ($this->reply_to) { $this->message->setReplyTo($this->reply_to); From 85e219562ea52a299eef92c053f56a28da1482cf Mon Sep 17 00:00:00 2001 From: Roy Ronalds Date: Sat, 28 Jan 2023 15:12:16 -0500 Subject: [PATCH 17/17] Fix up the Makefile run. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2020f25f5..071a28ee9 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ build: dep mkdir -p $(JS) @echo "Don't forget to update nginx configs as necessary." @echo "Including updating the php to retain login sessions longer." - cp -upn ./deploy/resources.build.php ./deploy/resources.php + cp -pn ./deploy/resources.build.php ./deploy/resources.php || true echo "Note that this does not overwrite existing resources.php" echo "Check that the webserver user has permissions to the script!" @ln -sf "$(RELATIVE_COMPONENTS)jquery/jquery.min.js" "$(JS)"