Skip to content

Commit

Permalink
add hash debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
vintikzzz committed Aug 27, 2024
1 parent 715ce72 commit 0ff1c42
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 37 deletions.
6 changes: 6 additions & 0 deletions .idea/jsLibraryMappings.xml

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

6 changes: 5 additions & 1 deletion assets/src/js/app/embed/check.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import message from './message';
import {makeDebug} from '../../lib/debug';
const debug = await makeDebug('webtor:embed:check');
const sha1 = require('sha1');
message.send('init');
const data = await message.receiveOnce('init');
Expand Down Expand Up @@ -34,7 +36,9 @@ function initPlaceholder(data) {
async function check() {
message.send('inject', window._checkScript);
const check = await message.receiveOnce('check');
return sha1(window._id + check) == _checkHash;
const hash = sha1(window._id + check)
debug('check window._id=%o check=%o hash=%o _checkHash=%o', window._id, check, hash, _checkHash);
return hash === _checkHash;
}

function initEmbed(data) {
Expand Down
71 changes: 36 additions & 35 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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"css-loader": "^6.7.1",
"css-minimizer-webpack-plugin": "^4.2.2",
"daisyui": "^2.28.0",
"debug": "^4.3.4",
"debug": "4.3.5",
"hls.js": "^1.5.8",
"iframe-resizer": "^4.3.11",
"mediaelement": "^7.0.3",
Expand All @@ -40,6 +40,7 @@
"stylelint-config-standard": "^28.0.0",
"supertokens-web-js": "^0.8.0",
"tailwindcss": "^3.1.8",
"terser-webpack-plugin": "^5.3.10",
"webpack": "^5.90.3",
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.11.0"
Expand Down
11 changes: 11 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,21 @@ module.exports = async (env, options) => {
},
devServer: {
port: 8082,
client: {
webSocketURL: 'auto://0.0.0.0:0/ws',
},
static: './assets/dist',
allowedHosts: ['all'],
devMiddleware: {
publicPath: '/assets',
index: false,
},
proxy: [
{
context: () => true,
target: 'http://localhost:8080',
},
],
watchFiles: ['templates/*.html', 'assets/src/*'],
},
optimization: {
Expand Down

0 comments on commit 0ff1c42

Please sign in to comment.