From ff55a69c99daa72aef8a3afe0953ddff00d9c5c6 Mon Sep 17 00:00:00 2001 From: robinmoisson Date: Mon, 3 Apr 2023 13:45:36 +0200 Subject: [PATCH] add color customization of template --- README.md | 78 ++++++++++++++++++++------------------ cli/helpers.js | 22 +++++------ lib/password_template.html | 2 +- package-lock.json | 4 +- package.json | 2 +- 5 files changed, 57 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index 31f5c9c..5e4eedf 100644 --- a/README.md +++ b/README.md @@ -71,47 +71,53 @@ The password argument is optional if `STATICRYPT_PASSWORD` is set in the environ Usage: staticrypt [options] Options: - --help Show help [boolean] - --version Show version number [boolean] - -c, --config Path to the config file. Set to "false" to - disable. [string] [default: ".staticrypt.json"] - -d, --directory Name of the directory where the encrypted files - will be saved. [string] [default: "encrypted/"] - -p, --password The password to encrypt your file with. Leave - empty to be prompted for it. If - STATICRYPT_PASSWORD is set in the env, we'll use - that instead. [string] [default: null] - --remember Expiration in days of the "Remember me" checkbox - that will save the (salted + hashed) password in - localStorage when entered by the user. Set to - "false" to hide the box. Default: "0", no - expiration. [number] [default: 0] - -s, --salt Generate a config file or set the salt manually. - Pass a 32-character-long hexadecimal string to - use as salt, or leave empty to generate, display - and save to config a random salt. This won't - overwrite an existing config file. [string] - --share Get a link containing your hashed password that - will auto-decrypt the page. Pass your URL as a - value to append "#staticrypt_pwd=", - or leave empty to display the hash to append. - [string] - --short Hide the "short password" warning. + --help Show help [boolean] + --version Show version number [boolean] + -c, --config Path to the config file. Set to "false" to + disable.[string] [default: ".staticrypt.json"] + -d, --directory Name of the directory where the encrypted + files will be saved. + [string] [default: "encrypted/"] + -p, --password The password to encrypt your file with. Leave + empty to be prompted for it. If + STATICRYPT_PASSWORD is set in the env, we'll + use that instead. [string] [default: null] + --remember Expiration in days of the "Remember me" + checkbox that will save the (salted + hashed) + password in localStorage when entered by the + user. Set to "false" to hide the box. Default: + "0", no expiration. [number] [default: 0] + -s, --salt Generate a config file or set the salt + manually. Pass a 32-character-long hexadecimal + string to use as salt, or leave empty to + generate, display and save to config a random + salt. This won't overwrite an existing config + file. [string] + --share Get a link containing your hashed password + that will auto-decrypt the page. Pass your URL + as a value to append + "#staticrypt_pwd=", or leave empty + to display the hash to append. [string] + --short Hide the "short password" warning. [boolean] [default: false] - -t, --template Path to custom HTML template with password - prompt. + -t, --template Path to custom HTML template with password + prompt. [string] [default: "/code/staticrypt/lib/password_template.html"] - --template-button Label to use for the decrypt button. Default: - "DECRYPT". [string] [default: "DECRYPT"] - --template-instructions Special instructions to display to the user. + --template-button Label to use for the decrypt button. Default: + "DECRYPT". [string] [default: "DECRYPT"] + --template-color-primary Primary color (button...) + [string] [default: "#4CAF50"] + --template-color-secondary Secondary color (page background...) + [string] [default: "#76B852"] + --template-instructions Special instructions to display to the user. [string] [default: ""] - --template-error Error message to display on entering wrong - password. [string] [default: "Bad password!"] - --template-placeholder Placeholder to use for the password input. + --template-error Error message to display on entering wrong + password. [string] [default: "Bad password!"] + --template-placeholder Placeholder to use for the password input. [string] [default: "Password"] - --template-remember Label to use for the "Remember me" checkbox. + --template-remember Label to use for the "Remember me" checkbox. [string] [default: "Remember me"] - --template-title Title for the output HTML page. + --template-title Title for the output HTML page. [string] [default: "Protected Page"] diff --git a/cli/helpers.js b/cli/helpers.js index 3f10c0d..5191a58 100644 --- a/cli/helpers.js +++ b/cli/helpers.js @@ -350,6 +350,16 @@ function parseCommandLineArguments() { describe: 'Label to use for the decrypt button. Default: "DECRYPT".', default: "DECRYPT", }) + .option("template-color-primary", { + type: "string", + describe: "Primary color (button...)", + default: "#4CAF50", + }) + .option("template-color-secondary", { + type: "string", + describe: "Secondary color (page background...)", + default: "#76B852", + }) .option("template-instructions", { type: "string", describe: "Special instructions to display to the user.", @@ -374,16 +384,6 @@ function parseCommandLineArguments() { type: "string", describe: "Title for the output HTML page.", default: "Protected Page", - }) - .option("template-color-primary", { - type: "string", - describe: "Button color.", - default: "#4CAF50", - }) - .option("template-color-secondary", { - type: "string", - describe: "Background color of the page.", - default: "#76b852", - }) + }); } exports.parseCommandLineArguments = parseCommandLineArguments; diff --git a/lib/password_template.html b/lib/password_template.html index 66a24fe..666bf93 100644 --- a/lib/password_template.html +++ b/lib/password_template.html @@ -63,7 +63,7 @@ .staticrypt-form .staticrypt-decrypt-button:hover, .staticrypt-form .staticrypt-decrypt-button:active, .staticrypt-form .staticrypt-decrypt-button:focus { background: /*[|template_color_primary|]*/0; - filter: brightness(95%); + filter: brightness(92%); } .staticrypt-html { diff --git a/package-lock.json b/package-lock.json index f17eb93..cfc2754 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "staticrypt", - "version": "3.0.4", + "version": "3.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "staticrypt", - "version": "3.0.4", + "version": "3.1.0", "license": "MIT", "dependencies": { "dotenv": "^16.0.3", diff --git a/package.json b/package.json index 0993481..1bf5f7b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "staticrypt", - "version": "3.0.4", + "version": "3.1.0", "description": "Based on the [crypto-js](https://github.com/brix/crypto-js) library, StatiCrypt uses AES-256 to encrypt your input with your passphrase and put it in a HTML file with a password prompt that can decrypted in-browser (client side).", "main": "index.js", "files": [