From 816e4886eb886cea043e424e9015ef664478382a Mon Sep 17 00:00:00 2001 From: haskal Date: Mon, 5 Aug 2019 01:19:58 -0400 Subject: [PATCH] Fix html, add captive portal message, tweak defaults --- arch/PKGBUILD | 2 +- index.html | 13 ++++++------ piratebox/__init__.py | 12 ++++++----- piratebox/autoindex_footer.html | 22 ++++++++++++-------- piratebox/autoindex_header.html | 36 ++++++++++++++++----------------- 5 files changed, 47 insertions(+), 38 deletions(-) diff --git a/arch/PKGBUILD b/arch/PKGBUILD index bbb4d71..1a4e2dc 100644 --- a/arch/PKGBUILD +++ b/arch/PKGBUILD @@ -2,7 +2,7 @@ pkgname=piratebox pkgver=1.1.4_mod_haskal -pkgrel=1 +pkgrel=2 pkgdesc="PirateBox - Share Freely" arch=('any') license=('GPL3') diff --git a/index.html b/index.html index 9836120..b6f6045 100644 --- a/index.html +++ b/index.html @@ -2,16 +2,16 @@ - + PirateBox - Share Freely! - - + + - + - - + + @@ -39,6 +39,7 @@

Welcome

Now, first of all, there is nothing illegal or scary going on here. This is a social place where you can chat and share files with people around you, anonymously! This is an off-line network, specially designed and developed for file-sharing and chat services. Staying off the grid is a precaution to maintain your full anonymity. Please have fun, chat with people, and feel free to share any files you may like.

+

Note to mobile users: If you're seeing this as a "login page", select "Use this network as-is" or the equivalent, then open http://piratebox.lan in your regular browser.

diff --git a/piratebox/__init__.py b/piratebox/__init__.py index 6b0a0bd..ca1b4eb 100644 --- a/piratebox/__init__.py +++ b/piratebox/__init__.py @@ -16,8 +16,8 @@ import aiofiles.os as aios aios.statvfs = aios.wrap(os.statvfs) aios.listdir = aios.wrap(os.listdir) -STORAGE_PATH = os.environ.get("PIRATEBOX_STORAGE", "/storage") -WAP_INTERFACE = os.environ.get("PIRATEBOX_IF", "wlan0") +STORAGE_PATH = os.environ.get("PIRATEBOX_STORAGE", "/storage/piratebox") +WAP_INTERFACE = os.environ.get("PIRATEBOX_IF", "piratebox0") SERVER_SOCK = os.environ.get("PIRATEBOX_SOCK", "/run/piratebox/piratebox.sock") CHUNK_SIZE = 256 * 1024 @@ -215,11 +215,13 @@ async def browse(request): st = await aios.stat(fp) if stat.S_ISDIR(st.st_mode): size = "-" - name = escape(file) + "/" + link = escape(file) + "/" + name = f"{link}" else: size = sizeof_fmt(st.st_size) - name = escape(file) - content += f"
  • {name}{size}
  • " + link = escape(file) + name = link + content += f"
  • {name}{size}
  • " content += "" content += res[1] return web.Response(text=content, content_type="text/html") diff --git a/piratebox/autoindex_footer.html b/piratebox/autoindex_footer.html index 38c7fa6..dca6079 100644 --- a/piratebox/autoindex_footer.html +++ b/piratebox/autoindex_footer.html @@ -1,13 +1,19 @@ - + - + + + + + diff --git a/piratebox/autoindex_header.html b/piratebox/autoindex_header.html index 85b2f4a..aba7406 100644 --- a/piratebox/autoindex_header.html +++ b/piratebox/autoindex_header.html @@ -1,34 +1,34 @@ + + + PirateBox - Share Freely! + + - - - - - + + -
    + +
    +