Skip to content

Commit

Permalink
generate browser.js path in the controller, not the template
Browse files Browse the repository at this point in the history
  • Loading branch information
briskt committed May 28, 2024
1 parent 76f4b74 commit 2e239d3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ test-integration:
docker-compose run --rm test ./run-integration-tests.sh

copyJsLib:
cp ./node_modules/@simplewebauthn/browser/dist/bundle/index.umd.min.js ./modules/material/www/simplewebauthn/browser.js
cp ./node_modules/@simplewebauthn/browser/LICENSE.md ./www/simplewebauthn/LICENSE.md
cp ./node_modules/@simplewebauthn/browser/dist/bundle/index.umd.min.js ./modules/mfa/www/simplewebauthn/browser.js
cp ./node_modules/@simplewebauthn/browser/LICENSE.md ./modules/mfa/www/simplewebauthn/LICENSE.md

deps:
docker-compose run --rm node npm install --ignore-scripts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@

<?php include __DIR__ . '/../common-head-elements.php' ?>

<?php
// TODO: remove this
$webauthnJsFileHash = md5_file(__DIR__ . '/../../../www/simplewebauthn/browser.js');
?>
<script src="simplewebauthn/browser.js?v=<?= $webauthnJsFileHash ?>"></script>
<script src="<?= $this->data['browserJsPath'] ?>"></script>

<script>
function verifyWebAuthn() {
Expand Down
21 changes: 0 additions & 21 deletions modules/material/www/simplewebauthn/LICENSE.md

This file was deleted.

2 changes: 0 additions & 2 deletions modules/material/www/simplewebauthn/browser.js

This file was deleted.

2 changes: 2 additions & 0 deletions modules/mfa/www/prompt-for-mfa.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
$t->data['mfaOptions'] = $mfaOptions;
$t->data['stateId'] = $stateId;
$t->data['supportsWebAuthn'] = LoginBrowser::supportsWebAuthn($userAgent);
$browserJsHash = md5_file(__DIR__ . './simplewebauthn/browser.js');
$t->data['browserJsPath'] = 'simplewebauthn/browser.js?v=' . $browserJsHash;
$t->data['managerEmail'] = $state['managerEmail'];
$t->show();

Expand Down
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2e239d3

Please sign in to comment.