-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update UiRequest.py #2248
Update UiRequest.py #2248
Conversation
Fonts are NOT applications! Added PGP related MIME types.
Why are the |
Feel free to add or remove MIME types. I think it's better to have common extensions stated than rely on the guessing of the |
It's not guessing. The |
|
Which ones? I see no reason in adding unneeded code when it works correctly. To be honest, I think that it's mimetypes module that should be patched, not ZeroNet code, but that's unlikely. |
I'd leave |
According to https://www.iana.org/assignments/media-types/application/font-woff |
Remove some MIME types because mimetype module correctly provides them. text/plain, text/html and text/css is not removed. Fonts MIME types are fixed because they are not applications. I have added PGP MIME types for keys, encrypted and for signature. I declared also utf8 encoding for text/css, application/json and for application/javascript. JavaScript should be application/javascript and not text/javascript according to [RFC4329] (https://tools.ietf.org/html/rfc4329#page-9).
@HelloZeroNet @filips123 @krixano Do you see any problems in using |
|
@imachug Regarding JS mime type, I already searched about this around the web and it seems that nobody actually know which one is correct. Also, if you are already adding new mime types, you should also add |
But if we want to change it, then
would be more clean/compact solution |
Yeah @imachug that's correct! https://www.iana.org/assignments/media-types/media-types.xhtml#font and [RFC8081] states |
@filips123 JavaScript should be |
This pr also belongs in the mimetypes repo - don't blame ZeroNet devs for things that aren't of their doing. In the meantime, a workaround is good, because this fonts issue has been a problem for a while I think. |
As far I know there were no issue reported that is connected to invalid mime types. All issues I have seen was because if someone enables the UiPassword plugin, then the cookie won't be passed to the css font requests and the client will display the login form instead of the resource. |
Idk, I'm pretty sure there was a comment in one issue that mentioned this problem with the mime type. Maybe I can find it, idk. |
@HelloZeroNet It's right here: #1940 |
Hold on a sec... Previously, I wasn't getting correct results when running this in python when that issue (#1940 ) originally occured:
But now I am getting "font/woff" in python. I suppose the mimetypes module was fixed for fonts but the zeronet workaround wasn't removed or something? idk... Aso, @HelloZeroNet , some people were still getting font problems in Tor browser very recently... don't know if this pr fixes it though. |
Removed some MIME types because mimetypes module correctly provides them. text/plain, text/html and text/css is not removed. Font MIME types are fixed because they are not applications. All font MIME types from https://www.iana.org/assignments/media-types/media-types.xhtml#font is stated in a clean/compact fashion as @HelloZeroNet suggested #2248 (comment). I have added PGP MIME types for keys, encrypted and for signature. I declared also utf8 encoding for text/css, application/json and for application/javascript. JavaScript should be application/javascript and not text/javascript according to [RFC4329] (https://tools.ietf.org/html/rfc4329#page-9). I don't add application/manifest+json at this time but you are free to do @filips123
As he stated in last comment: "When enable the ui_password plugin , the problem will reproduce ." So it was because of the sandbox. |
Which Python version do you have? Because |
@filips123 @krixano |
|
@imachug There are around 100 built-in extensions but yes other are loaded from system. |
@hacktivist It looks like the comment you're referring too agrees with @filips123, doesn't it? |
@hacktivist Can you explain that comment a bit more? Because I see it as point for using |
On my gateway I use for text/html the Link header also because I serving files (font, logo etc) using HTTP/2.0 with PUSH.
@HelloZeroNet I don't think you get what I was saying at all. You were trying to say that that other issue wasn't about this at all, but you literally propose a "fix" for this exact problem in that other issue (and you never actually stated that it was fixed) - so it was about this.
Because apparently you can't have two problems at once right? I was having that content-type font problem also, and I wasn't using ui_password (and I probably have photo-evidence of this somewhere on ZeroMe)... so that goes to show. Anyways @HelloZeroNet , icon fonts don't currently work in Tor browser - fix your crap! New Issue: #2249 |
…"no-referrer" header. Adding Referrer Policy to mitigate Reverse Tabnabbing (https://www.owasp.org/index.php/Reverse_Tabnabbing) See recent commit escaping sandbox using target _blank: e82155a
The MIME type |
Update MIME type from text/javascript to application/javascript. Note, that MIME type application/* is not caching. See: 10d44cf
Let me know if this don't work.
font-src '127.0.0.1:43110'
@imachug Now the fonts working? :) |
src/Ui/UiRequest.py
Outdated
headers["Cache-Control"] = "public, max-age=600" # Cache 10 min | ||
else: | ||
headers["Cache-Control"] = "no-cache, no-store, private, must-revalidate, max-age=0" # No caching at all | ||
if status in (200, 206) and cache_txt_css_html: # Cache MIME type text/* for 1 week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK we don't do cache invalidation so this might be a problem. Static site update might take a long while...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache is public
as you see. In the other hand after siteSign
there should be sitePublish
which will notify all peers about the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this help? I mean, the browser would still use cached html, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but not for 10 minutes. It would be crazy to assume that a static sites changes in every 10 minutes.
Does the browser cache content.json
? No, is not because we are not caching any MIME type application/*, specially not JavaScript.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's crazy to assume 10 minutes but it's crazy to assume a whole week too. I'd recommend 2 hours or so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZeroNet should check the content.json and if the hash is different than refresh the site.
You clearly have no idea what you're talking about. LOL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sites but you fail to come up with an example where HTML is changes every 10 minutes.
You know how I can tell you're a very fishy person... because you keep spewing that everyone's saying "10 minutes" when nobody has said that. Everyone here has only said changes happen shorter than a week.
I'll be making my own PR.
Btw, I did have a static zite, lol. And it changed frequently. Again with the fishiness... you clearly spew crap when you don't actually know what the hell you're talking about, lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right... Because apparently everyone who opens an issue also can't program? Because apparently you think that there's no other reason for people to not fix the issue themselves. Because apparently people don't have work or school or anything else going on in their life. Again a very fishy person.
Btw, there's a different between fixing something and half-assing it (and deliberately preventing things from working because you're an asshole).
Btw, you should probably stop with the Strawman (and Tu Quoque)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right... says the person who also said crap about ivanq who is the second highest for most commits and has fixed more vulnerabilities than you've even found in ZeroNet, LOL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You make your own PR but copy nothing from mine!
Does this mean you're claiming full copyright for your commit?
@HelloZeroNet I'd be weary of the potential legal consequences of this in the future. This is precisely why open-source repos have a file that requires all committers to give up rights to their commits.
Looks way better.
😞 I sent the wrong link in 99bea95 that should be: #2248 (comment) |
I have pushed modifications in Rev4250 that has updated list of bundled content types based on this PR and also solves the font loading problems. |
Also posted on antifa/ZeroNet#1 Here's a 3 way diff. Center is the original before hacktivist/antifa's PR. Left is nofish's implementation. Right is hacktivist/antifa's implementation from the PR (#2248) Here's a video of me scrolling through the whole file: Here's another diff I did - a two way diff comparing ZeroNet current code with antifa/hacktivist's PR: |
I'm posting here to update people on what's going on with the user @hacktivist / @antifa. After antifa was blocked, he created a new account called @LiberateZeroNet. He has deleted his account again and created a new account called @fukcyouintheass. This account has already been deleted, and 6 hours ago he has created another new account called AnonymousChronicler. I believe that he has an additional account that he has created an hour ago called bela-miklos. Both of these accounts have one repository that happens to be a copy of ZeroNet source code (but not shown as a fork, and under a different name). Every single time I find out about an additional username this person created, I report it to GitHub Support where I have an issue open with them about the user hacktivist all the way back from when he still used that name - I created this report with GitHub Support on October 30th. |
Another update - Looks like another account by this person has been created: PICSANRUGLAK |
Fonts are NOT applications! Added PGP related MIME types.