Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into master-xmr-dependabot-config
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Oct 10, 2019
2 parents 1f5f418 + c2489d6 commit 50e6126
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 28 deletions.
12 changes: 9 additions & 3 deletions index.js
Expand Up @@ -8,14 +8,20 @@ const path = require('path');
const Hapi = require('@hapi/hapi');
const vision = require('@hapi/vision');
const inert = require('@hapi/inert');

const handlebarsHelperSRI = require('handlebars-helper-sri');
const handlebarsPartialFile = require('handlebars-partial-file');
const generate = require('./lib/generate');
const generateElement = require('./lib/generateElement');

let handlebars = require('handlebars');

handlebars = handlebarsHelperSRI.register(handlebars);

const generate = require('./lib/generate');
const generateElement = require('./lib/generateElement');
const hbsPartialFile = handlebarsPartialFile({
referenceDir: path.join(__dirname, 'public')
});

hbsPartialFile.registerDirectory('badge', 'svg');

// eslint-disable-next-line quotes
const CSP_HEADER = "default-src 'none'; base-uri 'none'; form-action 'self'; frame-src 'self'; frame-ancestors 'self'; img-src 'self'; manifest-src 'self'; style-src 'self'";
Expand Down
28 changes: 18 additions & 10 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -33,8 +33,9 @@
"@hapi/inert": "^5.2.2",
"@hapi/vision": "^5.5.4",
"cross-env": "^6.0.3",
"handlebars": "^4.4.2",
"handlebars": "^4.4.3",
"handlebars-helper-sri": "0.0.0",
"handlebars-partial-file": "^1.0.0",
"node-fetch": "^2.6.0",
"sri-toolbox": "^0.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion public/badge/badge.css
Expand Up @@ -18,7 +18,7 @@
overflow: hidden;
}

.sri-test *[data-sri-status] img {
.sri-test *[data-sri-status] svg {
display: block;
margin-left: 16px;
}
Expand Down
9 changes: 3 additions & 6 deletions public/badge/fail.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 2 additions & 5 deletions public/badge/pass.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions templates/index.html
Expand Up @@ -79,11 +79,11 @@ <h2>Test your browser</h2>

<div class="sri-test" id="sri-badge">
<div data-sri-status="pass">
<img src="/badge/pass.svg" alt="Pass Badge" width="50" height="64">
{{> pass}}
<p>Your browser supports SRI</p>
</div>
<div data-sri-status="fail">
<img src="/badge/fail.svg" alt="Fail Badge" width="50" height="64">
{{> fail}}
<p>Your browser does not support SRI</p>
</div>
</div>
Expand Down

0 comments on commit 50e6126

Please sign in to comment.