diff options
author | pdp8 <pdp8@pdp8.info> | 2023-06-04 12:34:23 +0200 |
---|---|---|
committer | pdp8 <pdp8@pdp8.info> | 2023-06-04 12:34:23 +0200 |
commit | 458ce88d5f96272daeadfc70ccd7d43c10df1a31 (patch) | |
tree | 4b72059fc8aa5fced4f028c5e41dde680b310e51 /views | |
parent | 1b51ff391d98dc5ed297b9162fa0e3078840cdc0 (diff) |
inbox at '/', inbox parsing moved to activitypub.rb
Diffstat (limited to 'views')
-rw-r--r-- | views/inbox.erb | 50 | ||||
-rw-r--r-- | views/index.erb | 35 |
2 files changed, 35 insertions, 50 deletions
diff --git a/views/inbox.erb b/views/inbox.erb deleted file mode 100644 index 0be5dd5..0000000 --- a/views/inbox.erb +++ /dev/null @@ -1,50 +0,0 @@ - <!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> - <% 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> diff --git a/views/index.erb b/views/index.erb new file mode 100644 index 0000000..a698565 --- /dev/null +++ b/views/index.erb @@ -0,0 +1,35 @@ + <!DOCTYPE html> + <html lang='en'> + <head> + <link rel='stylesheet' type='text/css' href='/style.css'> + </head> + <body> + <% @inbox.each do |item| %> + <b><a href='<%= item[:actor_url] %>', target='_blank'><%= item[:mention] %></a></b> + <form action='<%= File.join item[:follow], item[:mention] %>' method='post'> + <button><%= item[:follow].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', item[:file] %>' method='post'> + <button>Delete</button> + </form> + <hr> + <% end %> + </body> + </html> |