22 Commits

Author SHA1 Message Date
dreamer 49cc36ef31 use custom escape function 2026-04-14 08:24:34 +02:00
dreamer fe70315a63 un-escape more chars 2026-04-13 21:35:46 +02:00
dreamer 3aec58719b don't remove leading slash 2026-04-13 21:27:08 +02:00
dreamer b86f583f42 try un-escaping slash 2026-04-13 21:08:59 +02:00
dreamer ae1eca427f add license 2026-04-07 09:27:43 +02:00
dreamer 64b07ad34d undo retain forward slashes 2026-03-31 11:27:45 +02:00
dreamer 6fbc87a465 retain forward slashes 2026-03-31 11:25:18 +02:00
dreamer c88c43fd8e retain forward slashes 2026-03-31 11:23:53 +02:00
dreamer 807e124570 properly handle escaping of paths 2026-03-31 11:16:28 +02:00
dreamer 0493632932 undo the other too 2026-03-30 12:43:50 +02:00
dreamer ce4f7f54da undo request_path escape 2026-03-30 12:42:59 +02:00
dreamer 9df7ed5be8 escape more paths 2026-03-30 12:36:02 +02:00
dreamer 82035ea239 sort files and dirs 2026-03-30 12:27:30 +02:00
dreamer b47f7c8e75 Merge branch 'main' into bugfix/escape_urls 2026-03-30 12:17:34 +02:00
dreamer 692747abc5 divider style 2026-03-26 16:27:32 +01:00
dreamer cc62a54571 style tweaks 2026-03-26 16:15:24 +01:00
dreamer 3165996d6e remove extra slash 2026-03-26 14:54:02 +01:00
dreamer e9d4163a5d refactor url+path generation 2026-03-26 14:43:50 +01:00
dreamer 52cca8eef2 tweak content_type 2026-03-26 14:37:47 +01:00
dreamer d88674fe40 tweak content_type 2026-03-26 14:37:19 +01:00
dreamer 42ebff2c7c rss tweaks 2026-03-26 14:36:26 +01:00
dreamer 5c7626db66 add rss endpoint 2026-03-26 14:32:42 +01:00
11 changed files with 319 additions and 90 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Wasted Audio
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+5
View File
@@ -49,6 +49,11 @@ app:get("/latest.json", function(self)
return handlers.Latesthandler(self) return handlers.Latesthandler(self)
end) end)
app:get("/latest.xml", function(self)
self.titles = page_titles
return handlers.RSShandler(self)
end)
app:get("/*", function(self) app:get("/*", function(self)
self.titles = page_titles self.titles = page_titles
return handlers.Roothandler(self) return handlers.Roothandler(self)
+20
View File
@@ -0,0 +1,20 @@
local to_json = require("lapis.util").to_json
local escape = require("lapis.util").escape
local autoload = require("lapis.util").autoload
local config = require("lapis.config")
local hotmixes = autoload("hotmixes")
local function RSShandler(self)
local path = config.get().mount .. self.titles.url
local latest_path, latest_name = hotmixes.utils.these_latest( path )
local host = self.req.parsed_url.scheme .. '://' .. self.req.parsed_url.host
self.datapath = host .. '/data/' .. self.titles.url .. '/'
self.latestpath = latest_path
self.latestname = latest_name
return { content_type = "application/rss+xml", layout = require "views.rss" }
end
return RSShandler
+1 -1
View File
@@ -1,4 +1,3 @@
local to_json = require("lapis.util").to_json
local autoload = require("lapis.util").autoload local autoload = require("lapis.util").autoload
local config = require("lapis.config") local config = require("lapis.config")
local hotmixes = autoload("hotmixes") local hotmixes = autoload("hotmixes")
@@ -17,6 +16,7 @@ local function Roothandler(self)
self.images = stuff.images self.images = stuff.images
self.latestpath = latest_path self.latestpath = latest_path
self.latestname = latest_name self.latestname = latest_name
self.functions = { hotesc = hotmixes.utils.hotesc }
if self.titles['url'] == "panamaracing.club" then if self.titles['url'] == "panamaracing.club" then
return { render = "root", layout = require "views.prc_layout" } return { render = "root", layout = require "views.prc_layout" }
+14 -5
View File
@@ -30,6 +30,10 @@ local type_allowed = { jpg=true, jpeg=true, png=true, gif=true, mp3=true, flac=t
local utils = {} local utils = {}
local function hotesc ( str )
return escape(str):gsub("%%2f", "/"):gsub("%%2d", "-"):gsub("%%2e", ".")
end
utils['request_path'] = request_path utils['request_path'] = request_path
utils['data_path'] = data_path utils['data_path'] = data_path
@@ -64,17 +68,17 @@ utils['these_files'] = function( path )
if utils.match_ext( file, type_image ) then if utils.match_ext( file, type_image ) then
table.insert( images, file ) table.insert( images, file )
elseif utils.match_ext( file, type_media ) then elseif utils.match_ext( file, type_media ) then
table.insert( files, {sane=escape(file), file=file} ) table.insert( files, file )
end end
elseif lfs.attributes( path .. file, "mode" ) == "directory" then elseif lfs.attributes( path .. file, "mode" ) == "directory" then
table.insert( dirs, {sane=escape(file), dir=file} ) table.insert( dirs, file )
end end
end end
end end
table.sort( images ) table.sort( images )
-- table.sort( files ) table.sort( files )
-- table.sort( dirs ) table.sort( dirs )
local stuff = { local stuff = {
files = files, files = files,
@@ -84,12 +88,17 @@ utils['these_files'] = function( path )
return stuff return stuff
end end
utils['hotesc'] = function( str )
return hotesc(str)
end
utils['these_latest'] = function( path ) utils['these_latest'] = function( path )
-- list last 10 modified files in our directory -- list last 10 modified files in our directory
local latest_path, latest_name = {}, {} local latest_path, latest_name = {}, {}
for i, file_path in ipairs( utils.latest_files( path ) ) do for i, file_path in ipairs( utils.latest_files( path ) ) do
table.insert( latest_path, escape(file_path)) local escpath = hotesc(file_path)
table.insert( latest_path, escpath )
local temp = "" local temp = ""
local result = "" local result = ""
+136 -38
View File
@@ -11,6 +11,7 @@
.h1 .h1
{ {
font-family: Helvetica; font-family: Helvetica;
font-size: 16px;
color: var(--ifm-white); color: var(--ifm-white);
padding-top: 5px; padding-top: 5px;
padding-bottom: 5px; padding-bottom: 5px;
@@ -22,9 +23,9 @@
.p .p
{ {
font-family: Helvetica; font-family: Helvetica;
font-size: 6px;
color: var(--ifm-grey); color: var(--ifm-grey);
margin-bottom: 45px; margin-bottom: 45px;
font-size: 10px;
} }
.href .href
@@ -37,7 +38,7 @@
{ {
line-height: 16px; line-height: 16px;
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 10px;
margin-bottom: 0; margin-bottom: 0;
margin-top: 0; margin-top: 0;
font-family: Helvetica; font-family: Helvetica;
@@ -49,7 +50,7 @@
color: var(--ifm-grey); color: var(--ifm-grey);
line-height: 1.6em; line-height: 1.6em;
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 10px;
text-decoration: none; text-decoration: none;
background: var(--ifm-deep-black); background: var(--ifm-deep-black);
display: inline-flex; display: inline-flex;
@@ -61,19 +62,13 @@
.amixlink:hover .amixlink:hover
{ {
font-family: Helvetica;
color: #000; color: #000;
line-height: 1.6em;
font-weight: 600;
font-size: 14px;
background: var(--ifm-red); background: var(--ifm-red);
} }
.body .body
{ {
width: 80%; width: 100%;
padding-left: 10%;
padding-right: 10%;
background-color: var(--ifm-black); background-color: var(--ifm-black);
} }
@@ -81,7 +76,7 @@
{ {
font-family: Helvetica; font-family: Helvetica;
font-weight: 900; font-weight: 900;
font-size: 16px; font-size: 12px;
color: var(--ifm-grey); color: var(--ifm-grey);
padding: 5px; padding: 5px;
margin-top: 2%; margin-top: 2%;
@@ -93,7 +88,15 @@
.prclogo .prclogo
{ {
width: 1440px; height: 120px;
padding-bottom: 10px;
padding-left: 10px;
padding-top: 10px;
}
.divider
{
height: 23px;
padding-bottom: 10px; padding-bottom: 10px;
padding-left: 10px; padding-left: 10px;
padding-top: 10px; padding-top: 10px;
@@ -112,7 +115,7 @@
.header .header
{ {
width: 100%; width: 100%;
max-height: 220px; max-height: 120px;
} }
.footer .footer
@@ -124,18 +127,10 @@
clear: both; clear: both;
} }
.djsection
{
font-family: Helvetica;
font-size: 18px;
text-decoration: inherit;
color: var(--ifm-red);
}
.djsectionmenu .djsectionmenu
{ {
font-family: Helvetica; font-family: Helvetica;
font-size: 33px; font-size: 18px;
color: var(--ifm-red); color: var(--ifm-red);
line-height: 1em; line-height: 1em;
z-index: 100; z-index: 100;
@@ -156,15 +151,9 @@
.djsection .djsection
{ {
font-family: Helvetica; font-family: Helvetica;
font-size: 33px; font-size: 18px;
text-decoration: inherit;
color: var(--ifm-red); color: var(--ifm-red);
line-height: 1em;
margin-bottom: 0px;
margin-top: 0px;
padding-top: 5px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 5px;
} }
.djsection:hover .djsection:hover
@@ -176,7 +165,7 @@
{ {
font-family: Helvetica; font-family: Helvetica;
color: var(--ifm-red); color: var(--ifm-red);
font-size: 24px; font-size: 16px;
padding-top: 5px; padding-top: 5px;
border-bottom: 2px solid var(--ifm-red); border-bottom: 2px solid var(--ifm-red);
} }
@@ -232,10 +221,7 @@
padding-right: 5%; padding-right: 5%;
width: 40%; width: 40%;
} }
.h2
{
font-size: 14px;
}
.footer .footer
{ {
margin-top: 15%; margin-top: 15%;
@@ -324,6 +310,13 @@
} }
} }
.content
{
width: 80%;
padding-left: 10%;
padding-right: 10%;
}
.latest .latest
{ {
position: relative; position: relative;
@@ -361,10 +354,115 @@
} }
} }
@media (max-width:767px) @media screen and (min-width: 600px) {
{
.h1mobile .h1{
font-size: 18px;
}
.p
{
font-size: 8px;
}
.mixlink
{
font-size: 12px;
}
.amixlink
{
font-size: 12px;
}
.mixsections
{
font-size: 14px;
}
.h2
{ {
font-size: 18px; font-size: 18px;
} }
.header
{
max-height: 180px;
}
.prclogo
{
height: 180px;
}
.divider
{
height: 35px;
}
.djsectionmenu
{
font-size: 25px;
}
.djsection
{
font-size: 28px;
}
}
@media screen and (min-width: 768px) {
.h1{
font-size: 26px;
}
.p
{
font-size: 10px;
}
.mixlink
{
font-size: 14px;
}
.amixlink
{
font-size: 14px;
}
.mixsections
{
font-size: 16px;
}
.h2
{
font-size: 24px;
}
.header
{
max-height: 220px;
}
.prclogo
{
height: 220px;
}
.divider
{
height: 43px;
}
.djsectionmenu
{
font-size: 33px;
}
.djsection
{
font-size: 33px;
}
} }
+89 -34
View File
@@ -16,6 +16,7 @@
.h1 .h1
{ {
font-family: ArcadeFont; font-family: ArcadeFont;
font-size: 16px;
color: var(--ifm-red); color: var(--ifm-red);
border-top: 3px solid var(--ifm-red); border-top: 3px solid var(--ifm-red);
border-bottom: 3px solid var(--ifm-red); border-bottom: 3px solid var(--ifm-red);
@@ -29,9 +30,9 @@
.p .p
{ {
font-family: ArcadeFont; font-family: ArcadeFont;
font-size: 6px;
color: var(--ifm-grey); color: var(--ifm-grey);
margin-bottom: 45px; margin-bottom: 45px;
font-size: 10px;
} }
.href .href
@@ -44,7 +45,7 @@
{ {
line-height: 16px; line-height: 16px;
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 10px;
margin-bottom: 0; margin-bottom: 0;
margin-top: 0; margin-top: 0;
font-family: ArcadeFont; font-family: ArcadeFont;
@@ -56,7 +57,7 @@
color: var(--ifm-grey); color: var(--ifm-grey);
line-height: 1.6em; line-height: 1.6em;
font-weight: 600; font-weight: 600;
font-size: 14px; font-size: 10px;
text-decoration: none; text-decoration: none;
background: var(--ifm-deep-black); background: var(--ifm-deep-black);
display: inline-flex; display: inline-flex;
@@ -68,11 +69,7 @@
.amixlink:hover .amixlink:hover
{ {
font-family: ArcadeFont;
color: #000; color: #000;
line-height: 1.6em;
font-weight: 600;
font-size: 14px;
background: var(--ifm-red); background: var(--ifm-red);
} }
@@ -88,7 +85,7 @@
{ {
font-family: ArcadeFont; font-family: ArcadeFont;
font-weight: 900; font-weight: 900;
font-size: 16px; font-size: 12px;
color: var(--ifm-grey); color: var(--ifm-grey);
padding: 5px; padding: 5px;
margin-top: 2%; margin-top: 2%;
@@ -109,7 +106,7 @@
.h2 .h2
{ {
font-family: ArcadeFont; font-family: ArcadeFont;
font-size: 24px; font-size: 16px;
color: var(--ifm-grey); color: var(--ifm-grey);
font-weight: 200; font-weight: 200;
border-bottom: 2px solid var(--ifm-grey); border-bottom: 2px solid var(--ifm-grey);
@@ -132,18 +129,10 @@
clear: both; clear: both;
} }
.djsection
{
font-family: ArcadeFont;
font-size: 18px;
text-decoration: inherit;
color: var(--ifm-red);
}
.djsectionmenu .djsectionmenu
{ {
font-family: ArcadeFont; font-family: ArcadeFont;
font-size: 33px; font-size: 18px;
color: var(--ifm-red); color: var(--ifm-red);
line-height: 1em; line-height: 1em;
z-index: 100; z-index: 100;
@@ -164,15 +153,9 @@
.djsection .djsection
{ {
font-family: ArcadeFont; font-family: ArcadeFont;
font-size: 33px; font-size: 18px;
text-decoration: inherit;
color: var(--ifm-red); color: var(--ifm-red);
line-height: 1em;
margin-bottom: 0px;
margin-top: 0px;
padding-top: 5px;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 5px;
} }
.djsection:hover .djsection:hover
@@ -184,7 +167,7 @@
{ {
font-family: ArcadeFont; font-family: ArcadeFont;
color: var(--ifm-red); color: var(--ifm-red);
font-size: 24px; font-size: 16px;
padding-top: 5px; padding-top: 5px;
border-bottom: 2px solid var(--ifm-red); border-bottom: 2px solid var(--ifm-red);
} }
@@ -240,10 +223,7 @@
padding-right: 5%; padding-right: 5%;
width: 40%; width: 40%;
} }
.h2
{
font-size: 14px;
}
.footer .footer
{ {
margin-top: 15%; margin-top: 15%;
@@ -369,10 +349,85 @@
} }
} }
@media (max-width:767px) @media screen and (min-width: 600px) {
{
.h1mobile .h1{
font-size: 18px;
}
.p
{
font-size: 8px;
}
.mixlink
{
font-size: 12px;
}
.amixlink
{
font-size: 12px;
}
.mixsections
{
font-size: 14px;
}
.h2
{ {
font-size: 18px; font-size: 18px;
} }
.djsectionmenu
{
font-size: 25px;
}
.djsection
{
font-size: 28px;
}
}
@media screen and (min-width: 768px) {
.h1{
font-size: 26px;
}
.p
{
font-size: 10px;
}
.mixlink
{
font-size: 14px;
}
.amixlink
{
font-size: 14px;
}
.mixsections
{
font-size: 16px;
}
.h2
{
font-size: 24px;
}
.djsectionmenu
{
font-size: 33px;
}
.djsection
{
font-size: 33px;
}
} }
+1 -1
View File
@@ -19,7 +19,7 @@
<header class="header"> <header class="header">
<a href="/"><img src="/static/<%= titles['header'] %>" alt="videohotmix logo" class="hotmixlogo"/></a> <a href="/"><img src="/static/<%= titles['header'] %>" alt="videohotmix logo" class="hotmixlogo"/></a>
</header> </header>
<h1 class="h1 h1mobile">Tons Of Mix - Downloads & Streams (right click + Save link as... for downloads)<br> <h1 class="h1">Tons Of Mix - Downloads & Streams (right click + Save link as... for downloads)<br>
<%= titles.name %><br> <%= titles.name %><br>
Sharing <%= total[0] %> files</h1> Sharing <%= total[0] %> files</h1>
+10 -7
View File
@@ -15,18 +15,20 @@
<header class="header"> <header class="header">
<a href="/"><img src="/static/<%= titles['header'] %>" alt="prc logo" class="prclogo"/></a> <a href="/"><img src="/static/<%= titles['header'] %>" alt="prc logo" class="prclogo"/></a>
</header> </header>
<h1 class="h1 h1mobile">Tons Of Mix - Downloads & Streams (right click + Save link as... for downloads)<br> <div class="content">
<h1 class="h1">Tons Of Mix - Downloads & Streams (right click + Save link as... for downloads)<br>
<%= titles.name %><br> <%= titles.name %><br>
Sharing <%= total[0] %> files Sharing <%= total[0] %> files
</h1> </h1>
<img src="/static/panamaracing.club_divider.png"> </div>
<img class="divider" src="/static/panamaracing.club_divider.png">
<div class="content">
<% content_for("inner") %> <% content_for("inner") %>
</div>
<img class="divider" src="/static/panamaracing.club_divider.png">
<div class="content">
<section class="latest"> <section class="latest">
<div class="latest_files"> <div class="latest_files">
<br>
<br>
<h1 class="h1">Latest uploads:</h1> <h1 class="h1">Latest uploads:</h1>
<% for i, file in ipairs(latestpath) do %> <% for i, file in ipairs(latestpath) do %>
<a class="amixlink" href="<%= '/data/' .. titles.url .. '/' .. file:gsub("#", "%%23") %>"> <a class="amixlink" href="<%= '/data/' .. titles.url .. '/' .. file:gsub("#", "%%23") %>">
@@ -36,6 +38,7 @@
<% end %> <% end %>
</div> </div>
</section> </section>
</div>
<img class="divider" src="/static/panamaracing.club_divider.png">
</body> </body>
</html> </html>
+3 -3
View File
@@ -10,14 +10,14 @@
<% for i, dir in ipairs(dirs) do %> <% for i, dir in ipairs(dirs) do %>
<br> <br>
<a href="<%= uri .. dir["sane"] %>" class="djsection"><span><%= dir["dir"] %></span></a> <a href="<%- functions.hotesc(uri .. dir) %>" class="djsection"><span><%= dir %></span></a>
<br> <br>
<% end %> <% end %>
<br> <br>
<% for i, file in ipairs(files) do %> <% for i, file in ipairs(files) do %>
<a class="amixlink" href="<%= path .. file["sane"] %>"> <a class="amixlink" href="<%- functions.hotesc(path .. file) %>">
<span class="mixlink"><%= file["file"] %></span> <span class="mixlink"><%= file %></span>
</a> </a>
<br> <br>
<% end %> <% end %>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="https://<%= titles['url'] %>/latest.xml" rel="self" type="application/rss+xml" />
<title><%= titles['name'] %></title>
<link>https://<%= titles['url'] %></link>
<description>Latest uploads</description>
<% for i, file in ipairs(latestpath) do %>
<item>
<title><%= latestname[i] %></title>
<link><%= datapath .. file:gsub("#", "%%23") %></link>
<description><![CDATA[<%= latestname[i] %>]]></description>
<guid><%= datapath .. file:gsub("#", "%%23") %></guid>
</item>
<% end %>
</channel>
</rss>