major refactor

- moved everything to webpack
This commit is contained in:
dogeystamp 2023-01-30 17:53:57 -05:00
parent f51ee13176
commit cff32999ba
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
15 changed files with 3047 additions and 17 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
tags tags
node_modules/ node_modules/
dist/

13
dist/aes.html vendored Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>encryptme: Simple AES encryption/decryption</title>
<meta name="description" content="Easy to use and simple online tool for AES encryption and decryption.
Advanced settings allow control over the IV, AES mode, and PBKDF2 parameters.">
<script defer src="src_style_css-src_templates_js.js"></script><script defer src="aes.js"></script></head>
<body>
<h1>AES</h1>
</body>
</html>

14
dist/index.html vendored Normal file
View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>encryptme</title>
<meta name="description" content="Easy to use and simple online tools for encryption and decryption.">
<script defer src="src_style_css-src_templates_js.js"></script><script defer src="index.js"></script></head>
<body>
<h2>Tools</h2>
<h3>Encryption/decryption</h3>
<a href="aes.html">AES</a>
</body>
</html>

2952
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,11 @@
"name": "encryptme", "name": "encryptme",
"version": "0.4.1", "version": "0.4.1",
"description": "Simple online cryptography app.", "description": "Simple online cryptography app.",
"main": "scripts/interface.js", "private": true,
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"lint": "eslint --ext .js,.jsx src"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -30,6 +32,11 @@
}, },
"homepage": "https://github.com/dogeystamp/encryptme#readme", "homepage": "https://github.com/dogeystamp/encryptme#readme",
"devDependencies": { "devDependencies": {
"eslint": "^8.33.0" "css-loader": "^6.7.3",
"eslint": "^8.33.0",
"html-webpack-plugin": "^5.5.0",
"style-loader": "^3.3.1",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
} }
} }

View File

@ -1,8 +0,0 @@
header = document.createElement("div");
header.classList.add("page-header");
header.innerHTML = `
<a href="index.html"><h1>encryptme</h1></a>
`
document.body.appendChild(header);

View File

@ -12,6 +12,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
*/ */
import { generateHeader } from "./templates.js";
import "./style.css";
generateHeader();
import { TabList } from "./interface.js"; import { TabList } from "./interface.js";
import { bufToB64, b64ToBuf } from "./util.js"; import { bufToB64, b64ToBuf } from "./util.js";

3
src/index.js Normal file
View File

@ -0,0 +1,3 @@
import { generateHeader } from "./templates.js";
import "./style.css";
generateHeader();

View File

@ -3,14 +3,11 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>encryptme: Simple AES encryption/decryption</title> <title>encryptme: Simple AES encryption/decryption</title>
<meta name="description" content="Easy to use and simple online tool for AES encryption and decryption. <meta name="description" content="Easy to use and simple online tool for AES encryption and decryption.
Advanced settings allow control over the IV, AES mode, and PBKDF2 parameters."> Advanced settings allow control over the IV, AES mode, and PBKDF2 parameters.">
</head> </head>
<body> <body>
<script src="scripts/header-template.js"></script>
<h1>AES</h1> <h1>AES</h1>
<script type="module" src="scripts/aes.js"></script>
</body> </body>
</html> </html>

View File

@ -3,12 +3,10 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>encryptme</title> <title>encryptme</title>
<meta name="description" content="Easy to use and simple online tools for encryption and decryption."> <meta name="description" content="Easy to use and simple online tools for encryption and decryption.">
</head> </head>
<body> <body>
<script src="scripts/header-template.js"></script>
<h2>Tools</h2> <h2>Tools</h2>
<h3>Encryption/decryption</h3> <h3>Encryption/decryption</h3>
<a href="aes.html">AES</a> <a href="aes.html">AES</a>

11
src/templates.js Normal file
View File

@ -0,0 +1,11 @@
function generateHeader() {
let header = document.createElement("div");
header.classList.add("page-header");
header.innerHTML = `
<a href="index.html"><h1>encryptme</h1></a>
`;
document.body.prepend(header);
}
export { generateHeader };

40
webpack.config.js Normal file
View File

@ -0,0 +1,40 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const pages = ["index", "aes"];
module.exports = {
mode: 'development',
entry: pages.reduce((config, page) => {
config[page] = `./src/${page}.js`;
return config;
}, {}),
output: {
filename: "[name].js",
path: path.resolve(__dirname, "dist"),
},
optimization: {
splitChunks: {
chunks: "all",
},
},
plugins: [].concat(
pages.map(
(page) =>
new HtmlWebpackPlugin({
inject: true,
template: `./src/pages/${page}.html`,
filename: `${page}.html`,
chunks: [page],
})
)
),
module: {
rules: [
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
],
},
};