Comments (5)
Hi, I believe I have a similar issue and can offer some more perspective: if I pass a directory to staticrypt, and there are css files in that directory, staticrypt will attempt to encrypt the css files (or any other file) as an HTML file. This causes syntax issues in the resulting css file.
I would prefer if the CSS file were just copied to the new directory (this would work for my use case). Not sure if this is the general case solution though.
Additionally, if there are multiple index.html
files that are being passed, they seem to copy to the same file without preserving the original directory structure.
from staticrypt.
Hey @Sammeeey, sorry for the late reply and thanks for reporting.
Regarding not finding linked CSS or images: what staticrypt does is encrypt the html file only, and put it in the /encrypted
folder. So if your file structure is
encrypted/filename.html
filename.html
style.css
image.jpg
and your original html file links to external files with <style src="style.css">
/<img src="image.jpg">
, then since the encrypted file is in encrypted/
when you decrypt it it won't find the other files. (it'll look under encrypted/style.css
and they're not there)
You can either move the style.css and image.jpg in the encrypted folder, use absolute links to the files (src="/style.css"
or src="//mywebsite.com/style.css"
), change your structure to have something like
encrypted/filename.html
html/filename.html
assets/style.css
assets/image.jpg
and have relative linking with src="../style.css"
... Many different options depending on your setup.
Regarding encryption working once: I don't think I understand exactly what you did here. Why did you delete the .staticrypt.json
file, and especially the encrypted/
folder? That folder is where the encrypted file will be.
from staticrypt.
Hey @jshph, thanks for commenting and for the good idea.
I think if we pass a directory we could encrypt the .html
files et copy everything else as is in the new directory, instead of trying to encrypt other files in a way that doesn't make sense. Seems like this would solve your use case?
That means we're suddenly including files that used to be encrypted as plaintext, but I guess that's not behavior you were supposed to rely on (since the files were unusable), so not a breaking change. I'll sleep on it, happy to hear if others think otherwise.
Regarding the multiple index.html
files, can you give more details? If you pass staticrypt foo/index.html foo/bar/index.html
that's to be expected, when passing single files staticrypt will get the file, encrypt it and put it at the root of the encrypted
directory, so if they have the same name they'll overwrite each other. If you want to preserve a directory structure, you'll have to pass the directory itself as an argument, with the `-r| flag.
from staticrypt.
Yes that's exactly it. I consider the ability to pass a full directory as an improvement, but for my use case it needs to only encrypt HTML files. Perhaps others' use cases differ; an "excludes" filter that takes glob arguments could help.
I think I wasn't aware of the -r
flag helping to avoid overwriting index.html! I ended up reverting to an earlier version of staticrypt that relies on find... exec
for now.
from staticrypt.
Done & published! Starting 3.3.2, non-HTML file will be copied as-is.
from staticrypt.
Related Issues (20)
- Cannot destructure property 'subtle' of 'crypto' as it is undefined. HOT 11
- Missing Package in Latest Release 3.1.0 HOT 2
- Error: Cannot find module 'node:crypto' HOT 3
- Feature: Support usernames, with database HOT 6
- Nothing is happening when clicking "decrypt" on encrypted pages HOT 2
- The `--remember false` option does not work HOT 1
- Page not protected until reload HOT 7
- Question - Is it possible to still use CryptoJS? HOT 4
- Did not generate encrypted content with "--share" HOT 1
- Auto remember me from shareable link HOT 6
- Please update the home page interface to be compatible with mobile browsers HOT 2
- Encrypt directories recursively but only HTML files HOT 2
- Encrypt page but with no password prompt box HOT 2
- Where have i gone wrong? HOT 2
- Browser Back Navigation Does Not Work HOT 6
- crypto.subtle missing on Safari iOS 17.3.1 HOT 2
- [Feature]: Add JS API for leveraging staticrypt in code HOT 2
- staticrypt not rendering in-place as expected HOT 2
- Pages not loading after decryption. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from staticrypt.