Merge branch 'master' into missing-br

This commit is contained in:
Kyle Drake 2023-07-19 16:32:15 -05:00 committed by GitHub
commit 22b8af52c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 311 additions and 136 deletions

View file

@ -1,8 +1,8 @@
<% site_followings = site.followings %>
<% if (!is_current_site && !site_followings.empty?) || is_current_site %>
<% site_followings = site.followings_dataset.count %>
<% if (!is_current_site && site_followings > 0) || is_current_site %>
<div class="following-list">
<h3><a href="/site/<%= site.username %>/follows"><%= is_current_site ? 'Sites you follow' : 'This site follows' %></a></h3>
<% if site_followings.empty? %>
<% if site_followings == 0 %>
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
<% else %>
<% site.followings_dataset.select(:site_id).all.each do |following| %>
@ -12,17 +12,22 @@
</div>
<% end %>
<% site_follows = site.follows %>
<% if (!is_current_site && !site_follows.empty?) || is_current_site %>
<% site_follows = site.follows_dataset.count %>
<% if (!is_current_site && site_follows > 0) || is_current_site %>
<div class="follower-list">
<h3><a href="/site/<%= site.username %>/followers">Followers</a></h3>
<% if site_follows.empty? %>
<% if site_follows == 0 %>
No followers yet.
<% else %>
<% site.profile_follows_actioning_ids.each do |follow| %>
<% site_profile_follows_actioning_ids = site.profile_follows_actioning_ids %>
<% site_profile_follows_actioning_ids[0...Site::MAX_DISPLAY_FOLLOWS].each do |follow| %>
<% follow_actioning_site = follow.actioning_site_dataset.select(:username).first %>
<a href="/site/<%= follow_actioning_site.username %>" title="<%= follow_actioning_site.title %>"><img src="<%= follow_actioning_site.screenshot_url 'index.html', '50x50' %>" class="avatar" onerror="this.src='/img/50x50.png'"></a>
<% end %>
<% if Site::MAX_DISPLAY_FOLLOWS < site_profile_follows_actioning_ids.count %>
<a href="/site/<%= site.username %>/followers"><strong>see more <i class="fa fa-arrow-right"></i></strong></a>
<% end %>
<% end %>
</div>
<% end %>

View file

@ -10,51 +10,32 @@
<script src="/js/news/event.js"></script>
<script src="/js/news/site.js"></script>
<% if defined?(site) && !params[:event_id] %>
<% follow_events = site.newest_follows %>
<% unless follow_events.empty? %>
<div class="news-item follow">
<div class="icon"><a href="/site/<%= site.username %>" title="<%= site.username %>" class="avatar" style="background-image: url(<%= site.screenshot_url 'index.html', '50x50' %>);"></a></div>
<div class="text">
<strong>New Followers</strong>
</div>
<div class="content">
<% follow_events.first.site.newest_follows.each_with_index do |event,i| %>
<a href="/site/<%= event.actioning_site.username %>" class="user" title="<%= event.actioning_site.title %>"><i class="fa fa-user"><% if event.actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= event.actioning_site.username %></a><% unless follow_events.length == i+1 %>, <% end %>
<% end %>
</div>
</div>
<% end %>
<% end %>
<% events.each do |event| %>
<% if event.profile_comment_id %>
<div class="news-item comment" id="event_<%= event.id %>">
<%== erb :'_news_profile_comment', layout: false, locals: {profile_comment: event.profile_comment, event: event} %>
<% elsif event.tip_id %>
<% actioning_site = event.actioning_site_dataset.select(:id, :username, :title, :domain, :stripe_customer_id, :plan_type).first %>
<% event_site = event.site_dataset.select(:id, :username, :title, :domain, :stripe_customer_id, :plan_type).first %>
<% tip = event.tip %>
<div class="news-item tip">
<div class="title">
<div class="icon">
<% if actioning_site %>
<a href="/site/<%= actioning_site.username %>" title="<%= actioning_site.username %>" class="avatar" style="background-image: url(<%= actioning_site.screenshot_url 'index.html', '50x50' %>);"></a>
<% end %>
</div>
<div class="text">
<div class="headline">
<% if actioning_site %>
<% if current_site && current_site.id == actioning_site.id %>
<a href="/site/<%= current_site.username %>" class="you">You</a>
<% else %>
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><i class="fa fa-user"><% if actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
<% end %>
<% else %>
An anonymous donor
<% end %>
sent a <strong><%= tip.amount_string %></strong> tip to
<% if current_site && event_site.id == current_site.id %>
<a href="/site/<%= current_site.username %>" class="you">you</a>!
<% else %>
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><i class="fa fa-user"><% if event_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>!
<% end %>
</div>
<span class="comment"><%= tip.message %></span>
</div>
<span class="date">
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
</span>
</div>
<div class="news-item comment" id="event_<%= event.id %>">
<%== erb :'_news_tip', layout: false, locals: {tip: event.tip, event: event} %>
<% elsif event.follow_id %>
<% actioning_site = event.actioning_site_dataset.select(:id, :username, :title, :domain, :stripe_customer_id, :plan_type).first %>
<% next if actioning_site.nil? %>

36
views/_news_tip.erb Normal file
View file

@ -0,0 +1,36 @@
<% actioning_site = event.tip.actioning_site_dataset.select(:id, :username, :stripe_customer_id, :plan_type, :parent_site_id).first %>
<% event_site = event.site_dataset.select(:id, :username, :stripe_customer_id, :plan_type, :parent_site_id).first %>
<div class="title">
<div class="icon">
<% if actioning_site %>
<a href="/site/<%= actioning_site.username %>" title="<%= actioning_site.username %>" class="avatar" style="background-image: url(<%= actioning_site.screenshot_url 'index.html', '50x50' %>);"></a>
<% end %>
</div>
<div class="text">
<% if actioning_site %>
<% if current_site && current_site.id == actioning_site.id %>
<a href="/site/<%= current_site.username %>" class="you">You</a>
<% else %>
<a href="/site/<%= actioning_site.username %>" class="user" title="<%= actioning_site.title %>"><i class="fa fa-user"><% if actioning_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= actioning_site.username %></a>
<% end %>
<% else %>
An anonymous donor
<% end %>
sent a <strong style="color: #229954 !important;"><%= tip.amount_string %></strong> tip to
<% if current_site && event_site.id == current_site.id %>
<a href="/site/<%= current_site.username %>" class="you">you</a>
<% else %>
<a href="/site/<%= event_site.username %>" class="user" title="<%= event_site.title %>"><i class="fa fa-user"><% if event_site.supporter? %><i class="fa fa-heart"></i><% end %></i><%= event_site.username %></a>
<% end %>
</div>
<span class="date">
<a href="/site/<%= event_site.username %>?event_id=<%= event.id %>"><%= event.created_at.ago %></a>
</span>
</div>
<div class="content"><%== sanitize_comment tip.message %></div>

View file

@ -13,4 +13,4 @@
<br>
<a href="https://www.tumblr.com/share?<%= Rack::Utils.build_query(v: 3, u: "#{page_uri}", t: "#{site.title}") %>" target="_blank">Tumblr</a>
<br>
<a href="https://toot.kytta.dev/?<%= Rack::Utils.build_query(text: "#{page_uri}") %>" target="_blank">Mastodon</a>
<a href="https://toot.kytta.dev/?<%= Rack::Utils.build_query(text: "#{site.title}: #{page_uri}") %>" target="_blank">Mastodon</a>

View file

@ -26,15 +26,19 @@
<li class="active"><a href="#profile" data-toggle="tab">Profile</a></li>
<!-- <li><a href="#domain" data-toggle="tab">Domain Name</a></li> -->
<li><a href="#custom_domain" data-toggle="tab">Custom Domain</a></li>
<li><a href="#username" data-toggle="tab">Change Site Name</a></li>
<li><a href="#username" data-toggle="tab">Rename</a></li>
<li><a href="#tipping" data-toggle="tab">Tipping</a></li>
<li><a href="#api_key" data-toggle="tab">API Key</a></li>
<li><a href="#api_key" data-toggle="tab">API</a></li>
<% if @site.admin_nsfw != true %>
<li><a href="#nsfw" data-toggle="tab">18+</a></li>
<% end %>
<% if @site.domain.empty? %>
<li><a href="#bluesky" data-toggle="tab">Bluesky</a></li>
<% end %>
<li><a href="#delete" data-toggle="tab">Delete</a></li>
</ul>
<div class="tab-content">
@ -64,6 +68,10 @@
</div>
<% end %>
<div class="tab-pane" id="bluesky">
<%== erb :'settings/site/bluesky' %>
</div>
<div class="tab-pane" id="delete">
<%== erb :'settings/site/delete' %>
</div>

View file

@ -0,0 +1,24 @@
<h2>Bluesky Integration (beta)</h2>
<p>
You can now verify control of your site on Neocities to create a handle on <a href="https://bsky.app/">Bluesky</a>.
</p>
<p>
<strong>Bluesky App <i class="fa fa-arrow-right"></i> "Settings" <i class="fa fa-arrow-right"></i> "Change my handle" <i class="fa fa-arrow-right"></i> "I have my own domain"</strong>
</p>
<p>
Domain: <span style="color: gray">@</span><strong><%= @site.username %>.neocities.org</strong>
</p>
<p>
TXT value:
</p>
<form method="POST" action="/settings/<%= @site.username %>/bluesky_set_did">
<%== csrf_token_input_html %>
<input name="did" type="text" style="width: 50%" placeholder="did=did:plc:somethingexamplesomething" value="<%= @bluesky_did %>">
<br>
<input class="btn-Action" type="submit" value="Update">
</form>

View file

@ -74,9 +74,9 @@
</p>
<% end %>
</div>
<%== erb :'_news', layout: false, locals: {site: @site, events: @latest_events} %>
<%== erb :'_news', layout: false, locals: {site: site, events: @latest_events} %>
<% else %>
<div class="site-profile-padding"><%== erb :'_news', layout: false, locals: {site: @site, events: @latest_events} %></div>
<div class="site-profile-padding"><%== erb :'_news', layout: false, locals: {site: site, events: @latest_events} %></div>
<% end %>
</div>

View file

@ -163,42 +163,47 @@
var editor = {}
$(document).ready(function() {
$.get("/site_files/download/<%= Addressable::URI.parse(@filename).normalized_path.to_s %>", function(resp) {
editor = ace.edit("editor")
setTheme()
<% if @ace_mode %>
editor.getSession().setMode("ace/mode/<%= @ace_mode %>")
<% end %>
editor.getSession().setTabSize(2)
editor.getSession().setUseWrapMode(true)
editor.setFontSize(14)
editor.setShowPrintMargin(false)
editor.setOptions({
maxLines: Infinity,
autoScrollEditorIntoView: true
})
$.ajax({
url: "/site_files/download/<%= Addressable::URI.parse(@filename).normalized_path.to_s %>",
cache: false,
success: function(resp) {
editor = ace.edit("editor")
setTheme()
<% if @ace_mode %>
editor.getSession().setMode("ace/mode/<%= @ace_mode %>")
<% end %>
editor.getSession().setTabSize(2)
editor.getSession().setUseWrapMode(true)
editor.setFontSize(14)
editor.setShowPrintMargin(false)
editor.setOptions({
maxLines: Infinity,
autoScrollEditorIntoView: true
})
// Disable autocomplete
editor.setBehavioursEnabled(false)
// Disable autocomplete
editor.setBehavioursEnabled(false)
editor.setValue(resp, -1)
editor.getSession().setUndoManager(new ace.UndoManager())
editor.setValue(resp, -1)
editor.getSession().setUndoManager(new ace.UndoManager())
editor.on('change', function(obj) {
$('a#saveButton,a#saveAndExitButton').css('opacity', 1)
unsavedChanges = true
})
editor.on('change', function(obj) {
$('a#saveButton,a#saveAndExitButton').css('opacity', 1)
unsavedChanges = true
})
editor.commands.addCommand({
name: 'saveCommand',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
saveTextFile(false)
}
})
})
})
editor.commands.addCommand({
name: 'saveCommand',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function(editor) {
saveTextFile(false)
}
})
}
});
});
window.onbeforeunload = function() {
if(unsavedChanges == true)