close to prerelase

This commit is contained in:
Quentin Wolkensperg 2024-11-11 14:52:00 -05:00
parent e55fbb5b67
commit 31022358ed
181 changed files with 2118 additions and 141 deletions

View file

@ -49,7 +49,7 @@ fn blagh_init {
if not if(~ $req_path $blagh_uri^index.rss)
blagh_setup_feed_handlers rss20.tpl 'text/xml; charset=utf-8'
if not if(~ $req_path $blagh_uri^feed.json)
if not if(~ $req_path $blagh_uri^feed.json)
blagh_setup_feed_handlers jsonfeed.tpl 'application/json; charset=utf-8'
if not if(~ $req_path $blagh_uri^new_post && ! ~ $#editor_mode 0) {
@ -101,16 +101,16 @@ fn get_post_list {
}
fn mkbpost {
bptext=$1
bpdate=$2
bptitle=$3
bpid=$4
bptext=$1;
bpdate=$2;
bptitle=$3;
bpid=$4;
_status=()
if(~ $"bptext '')
_status=($_status 'You need to provide a post body.')
if(! ~ $"bpdate [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])
_status=($_status 'Invalid date: '''^$"bpdate^'''') # XXX Should make semantic check.
if(~ $#_status 0) {
umask 002 # Let group write
if(! ~ $"bpid '')

View file

@ -19,7 +19,7 @@ fn statpost {
<link>%($base_url^$req_path%)</link>
<description><![CDATA[%($blogDesc%)]]></description>
<language>en-us</language>
<generator><![CDATA[Tom Duff's rc, and Kris Maglione's clever hackery]]></generator>
<generator><![CDATA[werc blagh app]]></generator>
%{
# <webMaster>uriel99+rss@gmail.com (Uriel)</webMaster>
# rfc2822 last time channel content changed.
@ -32,7 +32,7 @@ fn statpost {
%}
<item>
<title><![CDATA[%($title%)]]></title>
<author><![CDATA[%($by%)@noreply.cat-v.org (%($by%))]]></author>
<author><![CDATA[%($by%)]]></author>
<link>%($post_uri%)</link>
<guid isPermaLink="true">%($post_uri%)</guid>
<pubDate>%($pubdate%)</pubDate>

View file

@ -2,7 +2,7 @@
% notices_handler
<form action="" method="post">
<textarea name="comment_text" id="comment_text" cols="80" rows="16">%($"saved_comment_text%)</textarea>
<textarea name="comment_text" id="comment_text">%($"saved_comment_text%)</textarea>
<br>
<input type="submit" name="bridge_post" value="Post a comment">

33
werc/apps/cssedit/app.rc Normal file
View file

@ -0,0 +1,33 @@
fn conf_enable_cssedit {
enable_cssedit=yes
cssedit_editors_groups=$*
conf_enable_app cssedit
css_file='_werc/style.css' # Default location, can be changed
}
fn cssedit_init {
if(! ~ $#enable_cssedit 0 && check_user $cssedit_editors_groups) {
lp=$local_path
lp=`{echo $lp | sed 's/index$//'}
cssedit_file=$"lp$"css_file
if(~ 1 $#post_arg_cssedit_edit $#post_arg_cssedit_preview) {
handler_body_main=(tpl_handler `{get_lib_file cssedit/edit.tpl apps/cssedit/edit.tpl})
}
if not if(! ~ '' $"post_arg_cssedit_save $"post_arg_css_text) {
save_css
}
if not if(~ $"handler_body_main '' || {~ $REQUEST_METHOD GET && test -f $cssedit_file}) {
ll_add handlers_bar_left tpl_handler apps/cssedit/sidebar_controls.tpl
}
}
}
fn save_css {
umask 002
echo $post_arg_css_text > $cssedit_file
post_redirect $base_url^$req_path
}

View file

@ -0,0 +1,27 @@
<div>
<h1>Editing CSS: <a href="%($css_file%)">%($css_file%)</a></h1>
<br>
<form action="" method="POST">
<fieldset>
<textarea name="css_text" id="css_text" cols="80" rows="43">%{
if(~ $#post_arg_css_text 0 && test -f $cssedit_file)
cat $cssedit_file | escape_html
if not
echo -n $post_arg_css_text | escape_html
%}</textarea>
<br>
<a class="bu" href="%($css_file%)" download="%(style`{date -n}.css%)">Download Stylesheet</a>
<hr>
<input type="submit" name="cssedit_save" value="Save">
<small><strong>Note:</strong> Saved changes are final, historical versions of stylesheet are not kept.</small>
</fieldset>
</form>
<h2>Tips</h2>
<div class="info">
<ul>
<li>Pressing <code>F12</code> in your browser and editing the style.css that way is a good way to test/preview your changes out before committing to them using this tool.</li>
<li>Using a computer is suggested for these kind of changes</li>
<li>Learn css: <a href="https://www.w3schools.com/Css/css_intro.asp">w3schools</a></li>
</ul>
</div>
</div>

View file

@ -0,0 +1,3 @@
<form action="" method="POST">
<input type="submit" name="cssedit_edit" value="Edit CSS" />
</form>

View file

@ -0,0 +1,19 @@
# RisingThumb's build of dirdir
dirdir is werc's directory management tool.
## Features
This adds a few features to dirdir.
- Ability to edit larger text files
- Ability to edit template files
- Ability to upload files(optionally under a different name)
- Ability to delete a page
- Ability to delete a folder
## Roadmap
- Ideally take some filetype info for making new pages. Would be nice to make tpl files this way.
- User permissioning around editing template files (default config off?)
- Possibly allowing different markdown/formatters to be used.

View file

@ -2,6 +2,9 @@ fn conf_enable_wiki {
enable_wiki=yes
wiki_editors_groups=$*
conf_enable_app dirdir
if(~ $"conf_dirdir_index_type '')
conf_dirdir_index_type='md'
}
fn dirdir_init {
@ -11,16 +14,34 @@ fn dirdir_init {
# maybe it should, but for now we can fix it up here.
if(~ $lp */)
lp=$lp^'index'
dirdir_file=$lp.md
dirdir_file=$lp.^$"conf_dirdir_index_type
if (test -f $lp.tpl) {
dirdir_file=$lp.tpl
}
dirdir_dir=$dirdir_file^'_werc/dirdir/'
if(~ 1 $#post_arg_dirdir_edit $#post_arg_dirdir_preview)
handler_body_main=(tpl_handler `{get_lib_file dirdir/edit.tpl apps/dirdir/edit.tpl})
if not if(~ 1 $#post_arg_dirdir_delete && ! ~ $#post_arg_dirdir_delete_yes 1)
handler_body_main=(tpl_handler `{get_lib_file dirdir/delete_sure.tpl apps/dirdir/delete_sure.tpl})
if not if(~ 1 $#post_arg_dirdir_delete_folder && ! ~ $#post_arg_dirdir_delete_yes 1)
handler_body_main=(tpl_handler `{get_lib_file dirdir/delete_sure.tpl apps/dirdir/delete_sure.tpl})
if not if(~ 1 $#post_arg_dirdir_delete && ! ~ $#post_arg_dirdir_delete_yes 0)
rm $dirdir_file
if not if(~ 1 $#post_arg_dirdir_delete_folder && ! ~ $#post_arg_dirdir_delete_yes 0)
rm -rf `{dirname $dirdir_file}
if not if(~ 1 $#post_arg_dirdir_add_child_file && ! ~ $#post_arg_dirdir_search 0)
touch `{dirname $dirdir_file}^'/'^$post_arg_dirdir_search^'.md'
if not if(~ 1 $#post_arg_dirdir_add_child_folder! ~ $#post_arg_dirdir_search 0)
mkdir `{dirname $dirdir_file}^'/'^$post_arg_dirdir_search
if not if(~ 1 $#post_arg_dirdir_upload_file_pressed && ! ~ $#post_arg_dirdir_file_name 0 && ! ~ $post_arg_dirdir_file_name "" && ! ~ $#post_arg_dirdir_upload_file 0)
mv /tmp/werc_file.*.data `{dirname $dirdir_file}^'/'^$post_arg_dirdir_file_name
if not if(~ 1 $#post_arg_dirdir_upload_file_pressed && ! ~ $#post_arg_dirdir_upload_file 0)
mv /tmp/werc_file.*.data `{dirname $dirdir_file}^'/'^$post_arg_dirdir_upload_file
if not if(! ~ '' $"post_arg_dirdir_save $"post_arg_edit_text)
save_page
if not if(~ $"handler_body_main '' || {~ $REQUEST_METHOD GET && test -f $local_path.md})
if not if(~ $"handler_body_main '' || {~ $REQUEST_METHOD GET && test -f $local_path.md} || {~ $REQUEST_METHOD GET && test -f $local_path.tpl} )
ll_add handlers_bar_left tpl_handler apps/dirdir/sidebar_controls.tpl
}
}
@ -32,9 +53,7 @@ fn save_page {
# XXX Use a tmp file and mv(1) to ensure updates are atomic?
echo $logged_user > $dirdir_verdir/author
echo $post_arg_edit_text > $dirdir_verdir/data
echo $post_arg_edit_text > $dirdir_file
echo $post_arg_edit_text | dos2unix > $dirdir_verdir/data
echo $post_arg_edit_text | dos2unix > $dirdir_file
post_redirect $base_url^$req_path
#notify_notes='Saved <a href="'$"req_path'">'$"req_path'</a>!'
}

View file

@ -0,0 +1,9 @@
<form action="" method="POST">
% if(~ 1 $#post_arg_dirdir_delete ) {
% echo '<input type="hidden" name="dirdir_delete" value="Delete page" />' }
% if(~ 1 $#post_arg_dirdir_delete_folder ) {
% echo '<input type="hidden" name="dirdir_delete_folder" value="Delete folder" />' }
<input type="submit" name="dirdir_delete_yes" value="Are you sure you want to delete?" />
</form>

View file

@ -1,9 +1,10 @@
<div>
<h1>Editing: <a href="%($req_path%)">%($req_path%)</a></h1>
<br>
<form action="" method="POST">
<form action="" method="POST" enctype="multipart/form-data">
<textarea name="edit_text" id="edit_text" cols="80" rows="43">%{
# FIXME Extra trailing new lines get added to the content somehow, should avoid it.
echo $dirdir_search
if(~ $#post_arg_edit_text 0 && test -f $dirdir_file)
cat $dirdir_file | escape_html
if not
@ -20,6 +21,6 @@
% if(! ~ $"post_arg_dirdir_preview '') {
<h2>Preview:</h2>
<div id="preview">
% echo $post_arg_edit_text | $formatter
% echo $post_arg_edit_text | dos2unix | $formatter
</div>
% }

View file

@ -1,3 +1,14 @@
<form action="" method="POST">
<input type="submit" name="dirdir_edit" value="Edit page" />
<input type="submit" name="dirdir_edit" value="Edit page" /><br/>
</form>
<form action="" method="POST">
<input type="search" id="test-search" name="dirdir_search" placeholder="Page or folder to add"/><br/>
<input type="submit" name="dirdir_add_child_file" value="New Page" />
<input type="submit" name="dirdir_add_child_folder" value="New Folder" /><hr />
</form>
<form action="" method="POST">
<hr style="color: red"/><input type="submit" name="dirdir_delete_folder" value="Delete folder" />
</form>
<form action="" method="POST">
<input type="submit" name="dirdir_delete" value="Delete page" /><hr style="color: red"/>
</form>

1
werc/apps/gallery Submodule

@ -0,0 +1 @@
Subproject commit 65ecf50e317daa8c463b0375f1a57bd388b5bca4

144
werc/apps/ico/app.rc Normal file
View file

@ -0,0 +1,144 @@
fn conf_enable_ico {
ico_uri=$conf_wd
ico_dirs=$*
if(~ $#ico_dirs 0)
ico_dirs=( . )
conf_enable_app ico
if(~ $"conf_ico_editors '')
conf_ico_editors=ico-editors
if(~ $"conf_max_posts_per_page '')
conf_max_posts_per_page=32
if(~ $"conf_ico_categories '')
conf_ico_categories=(general)
if(~ $"conf_ico_max_image_size '')
conf_ico_max_image_size=5242880
}
fn ico_init {
if(~ $#ico_dirs 0 && ~ $req_path */[iI]co/*) {
ico_uri=`{echo $req_path | sed 's,(/[iI]co/).*,\1,'}
ico_dirs=( . )
}
if(! ~ $#ico_dirs 0) {
ico_url=$base_url^$ico_uri
ico_root=$sitedir^$ico_uri
if(check_user $conf_ico_editors) {
editor_mode=on
if(~ $"post_arg_date '')
post_date=`{/bin/date -I|sed 's,-,/,g'}
if not
post_date=$post_arg_date
ll_add handlers_foot_body template `{get_lib_file ico/foot.tpl apps/ico/foot.tpl}
}
if(~ $req_path $ico_uri) {
handler_body_main=ico_body
u=$ico_uri'index'
extraHeaders=$"extraHeaders ^ \
'<link rel="alternate" type="application/atom+xml" title="ATOM" href="'$"u'.atom" />
<link rel="alternate" type="application/rss+xml" title="RSS" href="'$"u'.rss" />'
}
if not if(~ $req_path $ico_uri^category/*) {
category=`{echo $req_path | sed 's!.*/!!; s/_/ /g'}
handler_body_main=ico_category_body
}
if not if(~ $req_path $ico_uri^index.atom)
ico_setup_feed_handlers atom.tpl 'application/atom+xml'
if not if(~ $req_path $ico_uri^index.rss)
ico_setup_feed_handlers rss20.tpl 'application/rss+xml'
if not if(~ $req_path $ico_uri^new_post && ! ~ $#editor_mode 0) {
handler_body_main=( tpl_handler `{get_lib_file ico/new_post.tpl apps/ico/new_post.tpl} )
if(~ $REQUEST_METHOD POST) {
if(mkicopost $"post_arg_body $"post_date $"post_arg_title $"post_arg_categories $"post_arg_loc $"post_arg_loc_link $"post_arg_link $"post_arg_short_desc $"post_arg_poster $"post_arg_edate)
post_redirect $ico_uri
if not
notify_errors=$status
}
}
}
}
fn ico_category_body {
template apps/ico/event_list_cat.tpl
}
fn ico_body {
template apps/ico/event_list_all.tpl
}
fn get_post_list {
ls -F $*^/[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]/ >[2]/dev/null |
sed -n '/'^$forbidden_uri_chars^'/d; /\/$/p' |
sort -r |
sed -e $conf_max_posts_per_page^'q'
}
fn mkicopost {
icotext=$1
icodate=$2
icotitle=$3
icocategories=$4
icolocation=$5
icolocationlink=$6
icoeventlink=$7
icoshortdesc=$8
icoposterpath=$9
icoexpireddate=$10
_status=()
postdate=`{/bin/date -I|sed 's,-,/,g'}
if(~ $"icotext '')
_status=($_status 'You need to provide a post body.')
if(! ~ $"postdate [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9])
_status=($_status 'Invalid date: '''^$"postdate^'''')
if(~ $#_status 0) {
umask 022
ddir=$ico_root^$postdate^'/'
n=`{ls $ddir >[2]/dev/null | wc -l}
mkdir -p $ddir^$n
post_link='/'$postdate^'/'$n
category_links=''
for(cat in `{echo $icocategories}) {
if(! ~ $cat '') {
cat_link=`{echo -n $cat | sed 's/ /_/g'}
category_links=$category_links'<div>[<a href='$ico_uri'category/'$cat_link'>'$cat'</a>]</div> '
}
}
icopostlink='/'^$postdate^'/'^$n^'/'
template apps/ico/post.tpl > $ddir^$n^'/index.html'
# Create the main categories directory
categories_dir=$ico_root^'categories'
mkdir -p $categories_dir
# Update category files
for(cat in `{echo $icocategories}) {
if(! ~ $cat '') {
cat_file=$categories_dir^'/'^`{echo -n $cat | sed 's/ /_/g'}^'.txt'
echo $post_link >> $cat_file
}
}
}
status=$_status
}
fn get_post_by_category {
cat_dir=$ico_root^'categories'
cat_file=$cat_dir^'/'^`{echo -n $1 | sed 's/ /_/g'}^'.txt'
if(test -f $cat_file) {
cat $cat_file | sort -r | sed $conf_max_posts_per_page^'q'
}
}
fn list_categories {
ls $ico_root^'categories/'*.txt | sed 's!.*/!!; s!\.txt$!!; s!_! !g'
}

View file

@ -0,0 +1,25 @@
% if (! ~ $"icoTitle '')
<h1>%($"icoTitle%)</h1>
% if (! ~ $"icoDesc '')
<p class="ico_desc">%($"icoDesc%)</p>
<fieldset class="categories_box">
<legend>Catagories</legend>
<div class="categories">
%{
for(cat in `{list_categories}) {
echo '<a href="'$ico_uri'category/'^`{echo -n $cat | sed 's/ /_/g'}^'">'$cat'</a> '
}
%}
</div>
</fieldset>
<div class="icofeed">
%{
for(p in `{get_post_list $ico_root^$ico_dirs}) {
echo '<div class="post">'
cat $p/index.html
echo '</div>'
}
%}
</div>
<p>Check out the <a href="/archive">archive</a> to see past events.</p>

View file

@ -0,0 +1,23 @@
<h1>Posts in category: %($category%)</h1>
<p class="ico_desc">You are seeing events in the <strong>%($category%)</strong> category. Click <a href="/">here</a> to go home!</p>
<fieldset class="categories_box">
<legend>Catagories</legend>
<div class="categories">
<a href="/">all</a>
%{
for(cat in `{list_categories}) {
echo '<a href="'$ico_uri'category/'^`{echo -n $cat | sed 's/ /_/g'}^'">'$cat'</a> '
}
%}
</div>
</fieldset>
<div class="icofeed">
%{
for(p in `{get_post_by_category $category}) {
echo '<div class="post">'
cat $sitedir$p/index.html
echo '</div>'
}
%}
</div>
<p>Check out the <a href="/archive">archive</a> to see past events.</p>

1
werc/apps/ico/foot.tpl Normal file
View file

@ -0,0 +1 @@
<div><p>[ <a href="/new_post">Make a new post</a> ]</p></div>

View file

@ -0,0 +1,17 @@
<div>
% notices_handler
<form method="POST"><fieldset>
<legend>Submit a new ico post</legend>
<label>Title: <input size="64" type="text" name="title" value="%($"post_arg_title%)" required /></label>
<label>Event Date (Displayed): <input size="10" type="text" name="date" value="%($"post_date%)" /></label>
<label for="dateInput">Expire Date [YYYY-MM-DD] <small>(usually the date of the show)</small>: <input type="text" name="edate" id="dateInput" placeholder="YYYY-MM-DD" pattern="\d{4}-\d{2}-\d{2}" required value="%($"post_arg_edate%)"/></label>
<label>Categories <small>(space-separated)</small>: <input size="64" type="text" name="categories" value="%($"post_arg_categories%)" /></label>
<label>Location: <input size="64" type="text" name="loc" value="%($"post_arg_loc%)" /></label>
<label>Location Link: <input size="64" type="text" name="loc_link" value="%($"post_arg_loc_link%)" /></label>
<label>Event Link/Website: <input size="64" type="text" name="link" value="%($"post_arg_link%)" /></label>
<label>Short Description: <textarea cols="94" rows="1" name="short_desc">%($"post_arg_short_desc%)</textarea></label>
<label>Description: <textarea cols="94" rows="16" name="body">%($"post_arg_body%)</textarea></label>
<label>Event Poster Image Link: <input size="64" type="text" name="poster" value="%($"post_arg_poster%)" /></label><br />
<input type="submit" value="Post" />
</fieldset></form>
</div>

20
werc/apps/ico/post.tpl Normal file
View file

@ -0,0 +1,20 @@
<!-- EXPIRES: "%($icoexpireddate%)" -->
<div class="event_box">
<a href="%($icopostlink%)" class="event_box_link"><span class="link_span"></span></a>
<a href="%($icopostlink%)"><h2>%($icotitle%)</h2></a>
<div class="event_info">
<div class="date">%($icodate%)</div>
<div class="location"><a href="%($icolocationlink%)">%($icolocation%)</a></div>
<div class="event_link"><a href="%($icoeventlink%)">Event Link</a></div>
<div class="cat_list">%($category_links%)</div>
<div class="short_desc">%($icoshortdesc%)</div>
</div>
% if(! ~ $"icoposterpath '') {
<div class="event_poster">
<a href="%($icoeventlink%)" class="event_img_link"><img src="%($icoposterpath%)" alt="Event Poster" /></a>
</div>
% }
<div class="event_body">
%($icotext%)
</div>
</div>

25
werc/apps/ico/rss20.tpl Normal file
View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="%($base_url^$req_path%)" rel="self" type="application/rss+xml" />
<title><![CDATA[%($siteTitle%)]]></title>
<link>%($base_url^$req_path%)</link>
<description><![CDATA[%($icoDesc%)]]></description>
<language>en-us</language>
<generator>werc ico app</generator>
<lastBuildDate>%($lastBuildDate%)</lastBuildDate>
%{
for(f in `{get_post_list $ico_root$ico_dirs}){
statpost $f
%}
<item>
<title><![CDATA[%($title%)]]></title>
<link>%($post_uri%)</link>
<guid isPermaLink="true">%($post_uri%)</guid>
<pubDate>%($pubdate%)</pubDate>
<description><![CDATA[%($summary%)]]></description>
<category>%($categories%)</category>
</item>
% }
</channel>
</rss>