diff options
author | FChannel <> | 2022-04-24 00:46:49 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | 3db517715bef6a53225c5c3c06e8fc5fd0bf71e3 (patch) | |
tree | 9aa7fbcb12f2ec8d0e4e66cd85ace058e38dd32d /views | |
parent | 9718d34a757b66917747c1c4acfb9b35d154625b (diff) |
basic pass over view posts, post, catalog and manage page connections
Diffstat (limited to 'views')
-rw-r--r-- | views/admin.html | 78 | ||||
-rw-r--r-- | views/catalog.html | 109 | ||||
-rw-r--r-- | views/index.html | 3 | ||||
-rw-r--r-- | views/layouts/main.html | 1 |
4 files changed, 190 insertions, 1 deletions
diff --git a/views/admin.html b/views/admin.html new file mode 100644 index 0000000..191444b --- /dev/null +++ b/views/admin.html @@ -0,0 +1,78 @@ +<div style="margin: 0 auto; width: 400px;"> + <h3>Add Board</h3> + <form id="new-post" action="/{{ .page.Key }}/addboard" method="post" enctype="application/x-www-form-urlencoded"> + <label>Name:</label><br> + <input type="text" name="name" placeholder="g" required><br> + <label>Prefered Name:</label><br> + <input type="text" name="prefname" placeholder="Technology" required><input type="submit" value="Add"><br> + <label>Summary:</label><br> + <textarea name="summary" rows="8" cols="50"></textarea><br> + <label>Restricted (i.e SFW):</label><br> + <select name="restricted"> + <option value="True">True</option> + <option value="False">False</option> + </select> + </form> + <ul style="display: inline-block; padding: 0;"> + <li style="display: inline-block;">[<a href="#news">Create News</a>]</li> + <li style="display: inline-block;">[<a href="#regex">Post Blacklist</a>]</li> + <!-- <li style="display: inline-block;"><a href="javascript:show('followers')">Followers</a></li> --> + <!-- <li style="display: inline-block;"><a href="#reported">Reported</a></li> --> + </ul> +</div> + +<div id="following" class="box2" style="margin-bottom: 25px; padding: 12px;"> + <h4 style="margin: 0; margin-bottom: 5px;">Subscribed</h4> + <form id="follow-form" action="/{{ .page.Key }}/follow" method="post" enctype="application/x-www-form-urlencoded"> + <input id="follow" name="follow" style="margin-bottom: 12px;" placeholder="http://localhost:3000/g"></input><input type="submit" value="Subscribe"><br> + <input type="hidden" name="actor" value="{{ .page.Actor }}"> + </form> + <ul style="display: inline-block; padding: 0; margin: 0; list-style-type: none;"> + {{ $actor := .page.Actor }} + {{ $key := .page.Key }} + {{ range .page.Following }} + <li>[<a href="/{{ $key }}/follow?follow={{ . }}&actor={{ $actor }}">Unfollow</a>]<a href="{{ . }}">{{ . }}</a></li> + {{ end }} + </ul> +</div> + +<div id="followers" class="box2" style="margin-bottom: 25px; padding: 12px; display:none;"> + <h4 style="margin: 0; margin-bottom: 5px;">Followers</h4> + <ul style="display: inline-block; padding: 0; margin: 0; list-style-type: none;"> + {{ range .page.Followers }} + <li><a href="http://localhost:3000/g">{{ . }}</a></li> + {{ end }} + </ul> +</div> + +<div class="box2" style="margin-bottom: 25px; padding: 12px;"> + <h3>Create News</h3> + <form id="news" action="/{{ .page.Key }}/postnews" method="post" enctype="application/x-www-form-urlencoded"> + <label>Title:</label><br> + <input type="text" name="title" placeholder="New Board" required><input type="submit" value="Post"><br> + <label>Content:</label><br> + <textarea name="summary" rows="8" cols="50"></textarea><br> + </form> +</div> + +<div id="regex" class="box2" style="margin-bottom: 25px; padding: 12px;"> + <h3>Regex Post Blacklist</h3> + <form id="blacklist" action="/blacklist" method="post" enctype="application/x-www-form-urlencoded"> + <label>Regex:</label><br> + <input type="text" name="regex" placeholder="(?i)(?s)(.+)?stuff?(.+)to(.+)?block(.+)?https?://(.+)?" size="38" required><input style="margin-left: 5px;" type="submit" value="Post"><br> + <label>Test Case:</label><br> + <textarea name="testCase" rows="8" cols="50" placeholder="enter a test case to block, if it passes the regex will be added to the blacklist. (?i) for case insesitive (?s) to span multiple lines"></textarea><br> + </form> + {{ if .page.PostBlacklist }} + <ul style="display: inline-block; padding: 0; margin: 0; margin-top: 25px; list-style-type: none;"> + {{ range .page.PostBlacklist }} + <li>{{ .Regex }} [<a href="/blacklist?remove={{ .Id }}">remove</a>]</li> + {{ end }} + </ul> + {{ end }} + +<!-- <div id="reported" class="popup-box" style="margin-bottom: 25px; padding: 12px;"> --> +<!-- <h4 style="margin: 0; margin-bottom: 5px;">Reported</h4> --> +<!-- <ul style="display: inline-block; padding: 0; margin: 0; list-style-type: none;"> --> +<!-- </ul> --> +<!-- </div> --> diff --git a/views/catalog.html b/views/catalog.html new file mode 100644 index 0000000..c70471e --- /dev/null +++ b/views/catalog.html @@ -0,0 +1,109 @@ +{{ define "header" }} +<title>/{{ .page.Board.Name }}/ - catalog</title> +<meta name="description" content="{{ .page.Board.Summary }}"> +<meta property="og:url" content="{{ .page.Board.Actor.Id }}"> +<meta property="og:site_name" content="{{ .page.Instance.PreferredUsername }}" /> + +<meta property="og:title" content="{{ .page.Title }}"> +<meta property="og:description" content="{{ .page.Board.Summary }}"> + +<meta name="twitter:title" content="{{ .page.Title }}"> +<meta name="twitter:description" content="{{ .page.Board.Summary }}"> +<meta name="twitter:card" content="summary_large_image"> + +<script src="/static/js/posts.js"></script> +{{ end }} + +{{ $board := .page.Board }} +<hr> + +<ul id="navlinks"> + <li>[<a href="/{{ $board.Name }}/">Return</a>]</li> + <!-- TODO: Implement showArchive --> + <!-- \{\{ if showArchive }} --> + <!-- <li>[<a href="/{{ $board.Name }}/archive">Archive</a>]</li> --> + <!-- \{\{ end }} --> + <li>[<a href="#bottom">Bottom</a>]</li> + <li>[<a href="javascript:location.reload()">Refresh</a>]</li> +</ul> + +<hr> + +<div style="padding: 10px; text-align: center;"> + {{ range .page.Posts }} + <div style="overflow: hidden; vertical-align: top; padding-right: 24px; padding-bottom: 24px; display: inline-block; width: 180px; max-height: 320px; margin-bottom: 10px;"> + {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} + [<a href="/delete?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Post</a>] + {{ end }} + {{ if .Attachment }} + {{ if eq $board.ModCred $board.Domain $board.Actor.Id }} + [<a href="/deleteattach?id={{ .Id }}&board={{ $board.Actor.Name }}">Delete Attachment</a>] + [<a href="/marksensitive?id={{ .Id }}&board={{ $board.Actor.Name }}">Mark Sensitive</a>] + {{ end }} + <div id="hide-{{ .Id }}" style="display: none;">[Hide]</div> + <div id="sensitive-{{ .Id }}" style="display: none;"> + <div style="position: relative; text-align: center;"> + <img id="sensitive-img-{{ .Id }}" style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 180px; max-height: 180px;" src="/static/sensitive.png"> + <div id="sensitive-text-{{ .Id }}" style="width: 170px; position: absolute; margin-top: 75px; padding: 5px; background-color: black; color: white; cursor: default; ">NSFW Content</div> + </div> + </div> + <a id="{{ .Id }}-anchor" href="/{{ $board.Name }}/{{ shortURL $board.Actor.Outbox .Id}}"> + <div id="media-{{ .Id }}" style="width:180px;"> {{ parseAttachment . true }}</div> + </a> + <script> + media = document.getElementById("media-{{ .Id }}") + + if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || ({{ isOnion .Id }} && !{{ isOnion $board.Domain }})){ + sensitive = document.getElementById("sensitive-{{ .Id }}") + hide = document.getElementById("hide-{{ .Id }}") + sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"} + hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"} + sensitive.style = "display: block" + media.style = "display: none;" + } + + if({{ isOnion .Id }} && !{{ isOnion $board.Domain }}) { + sensitive = document.getElementById("sensitive-{{ .Id }}") + document.getElementById("sensitive-img-{{ .Id }}").src = "/static/onion.png" + document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Instance" + hide = document.getElementById("hide-{{ .Id }}") + sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"} + hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"} + sensitive.style = "display: block" + media.style = "display: none;" + } + </script> + {{ end }} + <a style="color: unset;" id="{{ .Id }}-link" href="/{{ $board.Name }}/{{ shortURL $board.Actor.Outbox .Id }}"> + <div style="display: block;"> + {{ $replies := .Replies }} + {{ if $replies }} + <span>R: {{ $replies.TotalItems }}{{ if $replies.TotalImgs }}/ A: {{ $replies.TotalImgs }}{{ end }}</span> + {{ end }} + {{ if .Name }} + <br> + <span class="subject"><b>{{ .Name }}</b></span> + {{ end }} + + {{ if .Content }} + <br> + <span>{{.Content}}</span> + {{ end }} + </div> + </a> + </div> + {{ end }} +</div> +<hr> + +<ul id="navlinks"> + <li>[<a href="/{{ $board.Name }}/">Return</a>]</li> + <!-- TODO: Implement showArchive --> + <!-- \{\{ if showArchive }} --> + <!-- <li>[<a href="/{{ $board.Name }}/archive">Archive</a>]</li> --> + <!-- \{\{ end }} --> + <li>[<a href="#top">Top</a>]</li> + <li>[<a href="javascript:location.reload()">Refresh</a>]</li> +</ul> + +<hr> diff --git a/views/index.html b/views/index.html index f426d5d..e928ace 100644 --- a/views/index.html +++ b/views/index.html @@ -1,3 +1,6 @@ +{{ define "header" }} +<title>{{ .page.Title }}</title> +{{ end }} <div style="text-align: center; max-width: 800px; margin: 0 auto;"> <h1>{{ .page.Title }}</h1> <p style="text-align: justify">{{ .page.PreferredUsername }} is a federated image board based on <a href="https://activitypub.rocks/">ActivityPub</a>. The current version of the code running on the server is still a work-in-progress product, expect a bumpy ride for the time being. Get the server code here: <a href="https://github.com/FChannel0">https://github.com/FChannel0</a>.</p> diff --git a/views/layouts/main.html b/views/layouts/main.html index 4cd48f9..41e3412 100644 --- a/views/layouts/main.html +++ b/views/layouts/main.html @@ -45,6 +45,5 @@ {{ template "partials/footer" .page }} <script src="/static/js/themes.js"></script> - {{ template "scripts" .page }} </body> </html> |