rename "idp" to "short"

rename a variable with a useless name to something more descriptive
This commit is contained in:
Robin Malley 2023-02-20 01:56:09 +00:00
parent fc7d3f9f79
commit 4514a42cfc
2 changed files with 10 additions and 10 deletions

View File

@ -106,8 +106,8 @@ local function read_get(req)
local err
--Get our story id
assert(string.len(ps.path) > 0,"Tried to read 0-length story id")
ps.idp = string.sub(ps.path,2)--remove leading "/"
ps.storyid,err = util.decode_id(ps.idp)
ps.short = string.sub(ps.path,2)--remove leading "/"
ps.storyid,err = util.decode_id(ps.short)
if not ps.storyid then
local page = pages.error{
errcode = 400,
@ -180,8 +180,8 @@ local function read_get(req)
--If this isn't unlisted, dirty everywhere the hit counter is shown
cache.dirty(string.format("%s",config.domain))
cache.dirty(string.format("%s/%s",config.domain,ps.idp)) -- This place to read this post
cache.dirty(string.format("%s.%s",config.domain,ps.idp)) -- The author's index page
cache.dirty(string.format("%s/%s",config.domain,ps.short)) -- This place to read this post
cache.dirty(string.format("%s.%s",config.domain,ps.short)) -- The author's index page
assert(text)
http_response(req,200,text)

View File

@ -1,15 +1,15 @@
<{system cat src/pages/parts/header.etlua}>
<nav>
<a href="https://<%= domain %>"><%= domain %></a>/<a href="https://<%= domain %>/<%= idp %>"><%= idp %></a>
<a href="https://<%= domain %>"><%= domain %></a>/<a href="https://<%= domain %>/<%= short %>"><%= short %></a>
</nav>
<% if owner then -%>
<div class="row">
<form action="https://<%= domain %>/_edit" method="get"><fieldset>
<input type="hidden" name="story" value="<%= idp %>"/>
<input type="hidden" name="story" value="<%= short %>"/>
<input type="submit" value="edit" class="button column column-0"/>
</fieldset></form>
<form action="https://<%= domain %>/_delete" method="post"><fieldset>
<input type="hidden" name="story" value="<%= idp %>"/>
<input type="hidden" name="story" value="<%= short %>"/>
<input type="submit" value="delete" class="button column column-0"/>
</fieldset></form>
</div>
@ -37,14 +37,14 @@
<p><%= views %> Hits</p>
<form action="https://<%= domain %>/_download" method="get">
<input type="hidden" name="story" value="<%= idp %>"/>
<input type="hidden" name="story" value="<%= short %>"/>
<% if unlisted then %>
<input type="hidden" name="pwd" value="<%= hashstr %>"/>
<% end %>
<input type="submit" value="Download TXT" class="button"/>
</form>
<% if not show_comments then -%>
<form action="https://<%= domain %>/<%= idp %>"><fieldset>
<form action="https://<%= domain %>/<%= short %>"><fieldset>
<input type="hidden" name="comments" value="1">
<% if unlisted then %>
<input type="hidden" name="pwd" value="<%= hashstr %>"/>
@ -52,7 +52,7 @@
<input type="submit" value="load comments" class="button">
</fieldset></form>
<% else %>
<form action="https://<%= domain %>/<%= idp %>" method="POST">
<form action="https://<%= domain %>/<%= short %>" method="POST">
<% if unlisted then %>
<input type="hidden" name="pwd" value="<%= hashstr %>"/>
<% end %>