diff options
author | pdp8 <pdp8@pdp8.info> | 2023-06-03 19:38:21 +0200 |
---|---|---|
committer | pdp8 <pdp8@pdp8.info> | 2023-06-03 19:38:21 +0200 |
commit | c727922afd124ae59e05b2da56634a271863f8af (patch) | |
tree | 8be6dae1b73a9c7db328a5cddb683348734ef95a | |
parent | 23d72528a829e080ca6a508a217a700f04217d4a (diff) |
public dirs ignored
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | public/login.html | 9 | ||||
-rw-r--r-- | public/style.css | 108 | ||||
-rw-r--r-- | views/inbox.erb | 50 | ||||
-rwxr-xr-x | watch | 4 |
5 files changed, 173 insertions, 0 deletions
@@ -1,3 +1,5 @@ *.pem .usr .pwd +inbox +public/*/ diff --git a/public/login.html b/public/login.html new file mode 100644 index 0000000..9003b91 --- /dev/null +++ b/public/login.html @@ -0,0 +1,9 @@ + <!DOCTYPE html> + <html lang='en'> + <body> + <form action='/login' method='post'> + <input type='password' name='secret' /> + <input type='submit' name='button' value='Login' /> + </form> + </body> + </html> diff --git a/public/style.css b/public/style.css new file mode 100644 index 0000000..63fdb65 --- /dev/null +++ b/public/style.css @@ -0,0 +1,108 @@ +body { + width: 100vw; + margin: 0; + font-family: sans-serif; +} + +nav { + background: #000; + color: #fff; + padding: 0.75em 0 1em 0; +} + +nav a { + padding: 0 1em; + text-decoration: none; +} + +nav img { + height: 2em; + display: inline; + vertical-align: bottom; +} + +nav #logo img { height: 2em; } + +nav .current { color: #fff; } + +nav #menu { display:none; } + +nav a:hover { color: #fff; } + +@media screen and (max-width: 600px) { + nav .item { + display: none; + padding-left: 1em; + padding-top: 0.5em; + } + + nav #menu { + float: right; + display: inline; + font-size: 2em; + } +} + +.post { padding: 1em; } + +img, video { + max-width: 100%; + max-height: 80vh; + display: block; + margin-left: auto; + margin-right: auto; +} + +iframe { + width: 100%; + height: 90vh; + border: none; +} + +a { + color: #888; +} + +#image { + padding-top: 2.5%; + padding-bottom: 1%; +} + +.cover { + max-height: 50vh; + margin-left: 0; +} + + +#controller { + position: fixed; + left: 0; + bottom: 2.5%; + width: 100%; + text-align: center; + padding: 0 +} + +.btn { + display: inline-block; + cursor: pointer; + color: #000; + font-size: 2em; + font-weight: bold; + width: 4em; +} + +#prev, #next { + cursor: pointer; + position: absolute; + color: lightgrey; + font-weight: bold; + font-size: 8em; + transition: 0.5s ease; + bottom: 6vh; +} + +#prev { left: 1%; } +#next { right: 1%; } +#prev:hover, #next:hover { text-decoration: none; } +#prev:active, #next:active { color: black; } diff --git a/views/inbox.erb b/views/inbox.erb new file mode 100644 index 0000000..a3e3f83 --- /dev/null +++ b/views/inbox.erb @@ -0,0 +1,50 @@ + <!DOCTYPE html> + <html lang='en'> + <head> + <link rel='stylesheet' type='text/css' href='/style.css'> + </head> + <body> + <% @inbox.each_with_index do |file,i| %> + <% item = JSON.parse(File.read(file)) + mention = mention(item['attributedTo']) + following_path = File.join('public', 'following', mention + '.json') %> + <b><a href='<%= item['attributedTo'] %>', target='_blank'><%= mention %></a></b> <i><%= item['published'].sub('T', ' ') %></i> + <% File.exists?(following_path) ? method = 'unfollow' : method = 'follow' %> + <form action='<%= File.join method, mention %>' method='post'> + <button><%= method.capitalize %></button> + </form> + <p><%= item['content'] %> + <% if item['attachment'] + item['attachment'].each do |att| + case att['mediaType'] + when /audio/ %> + <br><audio controls=''><source src='<%= att['url'] %>' type='<%= att['mediaType'] %>'></audio> + <% when /image/ %> + <br><a href='<%= att['url'] %>'><img src='<%= att['url'] %>'></a> + <% when /video/ %> + <br><video controls=''><source src='<%= att['url'] %>' type='<%= att['mediaType'] %>'></video> + <% else %> + <%= att %><br> + <a href='<%= att['url'] %>'><%= att['url'] %></a> + <% end %> + <% end %> + <% end %> + <p> + <form action='<%= File.join 'delete', file %>' method='post'> + <button>Delete</button> + </form> + <!-- + <form action='<%= File.join 'boost', file %>' method='post'> + <button>Boost</button> + </form> + <form action='<%= File.join 'archive', file %>' method='post'> + <button>Archive</button> + </form> + <form action='<%= File.join 'reply', file %>' method='post'> + <button>Reply</button> + </form> + --> + <hr> + <% end %> + </body> + </html> @@ -0,0 +1,4 @@ +#!/usr/bin/env fish +while inotifywait -qqe modify activitypub.rb + sudo systemctl restart social.service +end |