Solve the infamous application/javascript bug

Lot of html pages are now recognized as application/javascript. We now
force the HtmlRenderer for application/javascript.

Contact address has also be changed to offpunk2 everywhere
This commit is contained in:
Lionel Dricot 2023-08-22 14:59:20 +02:00
parent f4818c966e
commit 10b3a84be5
7 changed files with 10 additions and 7 deletions

View File

@ -7,6 +7,7 @@ TODO: better handling of folders with opnk
This is an an experimental and unstable release. Lot of breakages are expected.
Wait for 2.1 if you are not willing to do testing/bug reporting.
- Licence has been changed to AGPL for ideological reasons
- Contact adress has been changed to offpunk2 on the same domain (because of spam)
- New command-line tool: "netcache"
- New command-line tool: "ansicat"
- New command-line tool: "opnk"

View File

@ -1,6 +1,6 @@
Offpunk Offline Gemini client
And the Offpunk tools suite: netcache, ansicat, opnk.
(C) From 2021: Ploum <offpunk20@ploum.eu>
(C) From 2021: Ploum <offpunk2@ploum.eu>
Derived from AV-98 and Agena by Solderpunk,
(C) 2019, 2020: Solderpunk <solderpunk@sdf.org>

View File

@ -1,7 +1,7 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (c) 2022, Ploum <offpunk110 at ploum.eu> and contributors.
Copyright (c) 2022, Ploum <offpunk2 at ploum.eu> and contributors.
All rights reserved.
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>

View File

@ -1127,7 +1127,8 @@ _FORMAT_RENDERERS = {
"application/rss+xml" : FeedRenderer,
"application/atom+xml" : FeedRenderer,
"text/gopher": GopherRenderer,
"image/*": ImageRenderer
"image/*": ImageRenderer,
"application/javascript": HtmlRenderer,
}
def get_mime(path):
#Beware, this one is really a shaddy ad-hoc function
@ -1172,7 +1173,7 @@ def renderer_from_file(path,url=None):
if not url:
url = path
if os.path.exists(path):
if mime.startswith("text/"):
if mime.startswith("text/") or mime in _FORMAT_RENDERERS:
with open(path) as f:
content = f.read()
f.close()

View File

@ -86,4 +86,4 @@ is a fork of the original AV-98 by
and was originally called AV-98-offline as an experimental branch.
.
.Sh AUTHORS
.An Lionel Dricot (Ploum) Aq Mt offpunk110 at ploum.eu
.An Lionel Dricot (Ploum) Aq Mt offpunk2 at ploum.eu

View File

@ -186,6 +186,7 @@ class opencache():
#may this should be migrated here.
if not offutils.is_local(inpath):
cachepath = netcache.fetch(inpath,**kwargs)
inpath = cachepath
if not cachepath:
return False
renderer = self.get_renderer(inpath,mode=mode)

View File

@ -6,10 +6,10 @@ build-backend = "flit_core.buildapi"
name = "offpunk"
authors = [
{name = "Solderpunk", email = "solderpunk@sdf.org"},
{name = "Lionel Dricot (Ploum)", email = "offpunk20@ploum.eu"},
{name = "Lionel Dricot (Ploum)", email = "offpunk2@ploum.eu"},
]
maintainers = [
{name = "Lionel Dricot (Ploum)", email = "offpunk20@ploum.eu"},
{name = "Lionel Dricot (Ploum)", email = "offpunk2@ploum.eu"},
]
readme = "README.md"
classifiers = [