Add 'app.rc'
This commit is contained in:
parent
25836b3664
commit
7537b0ef2a
|
@ -0,0 +1,38 @@
|
|||
fn conf_enable_watatsuki {
|
||||
enable_watatsuki=yes
|
||||
conf_enable_app watatsuki
|
||||
pageTitle='Watatsuki'
|
||||
}
|
||||
|
||||
fn watatsuki_init {
|
||||
get_post_args q
|
||||
if (! ~ $#q 0) {
|
||||
handler_body_main='watatsuki_display'
|
||||
}
|
||||
if not {
|
||||
handler_body_main='watatsuki_body'
|
||||
}
|
||||
}
|
||||
|
||||
fn watatsuki_body {
|
||||
echo '
|
||||
<h1>Watatsuki</h1>
|
||||
<form action="/watatsuki/" method="POST">
|
||||
<label for="address">Enter a Gemini address:</label>
|
||||
<input type="text" id="address" name="q" placeholder="gemini://">
|
||||
<input type="submit" value="Submit">
|
||||
</form>'
|
||||
}
|
||||
|
||||
fn watatsuki_display {
|
||||
echo '
|
||||
<h1>Watatsuki</h1>
|
||||
<form action="/watatsuki/" method="POST">
|
||||
<label for="address">Enter a Gemini address:</label>
|
||||
<input type="text" id="address" name="q" placeholder="gemini://">
|
||||
<input type="submit" value="Submit">
|
||||
</form>'
|
||||
gem_src=`{echo $q | perl -pe 's/\//\\\//g' | perl -pe 's/\:/\\\:/g' | perl -pe 's/\./\\\./g'}
|
||||
site=`{gcat $q | gmi2mkd | perl -pse 's/(?<=\()[^http].*(?=\))/'$gem_src'\/$&/g' | cmark}
|
||||
echo $site
|
||||
}
|
Loading…
Reference in New Issue