mirror of
https://github.com/neocities/neocities.git
synced 2025-06-19 10:50:34 +02:00
bluesky did/handle integration
This commit is contained in:
parent
243eda9321
commit
6a045685d0
3 changed files with 55 additions and 2 deletions
|
@ -20,6 +20,9 @@ get '/settings/:username/?' do |username|
|
|||
pass if Site.select(:id).where(username: username).first.nil?
|
||||
require_login
|
||||
require_ownership_for_settings
|
||||
|
||||
@bluesky_did = $redis_proxy.hget "dns-_atproto.#{@site.username}.neocities.org", 'TXT'
|
||||
|
||||
@title = "Site settings for #{username}"
|
||||
erb :'settings/site'
|
||||
end
|
||||
|
@ -174,6 +177,24 @@ post '/settings/:username/custom_domain' do
|
|||
end
|
||||
end
|
||||
|
||||
post '/settings/:username/bluesky_set_did' do
|
||||
require_login
|
||||
require_ownership_for_settings
|
||||
redirect '/settings' if !@site.domain.empty?
|
||||
|
||||
# todo standards based validation
|
||||
if params[:did].length > 50
|
||||
flash[:error] = 'DID provided was too long'
|
||||
elsif !params[:did].match(/^did=did:plc:([a-z|0-9)]+)$/)
|
||||
flash[:error] = 'DID was invalid'
|
||||
else
|
||||
$redis_proxy.hset "dns-_atproto.#{@site.username}.neocities.org", 'TXT', params[:did]
|
||||
flash[:success] = 'DID set! You can now verify the domain on the Bluesky app.'
|
||||
end
|
||||
|
||||
redirect "/settings/#{@site.username}#bluesky"
|
||||
end
|
||||
|
||||
post '/settings/:username/generate_api_key' do
|
||||
require_login
|
||||
require_ownership_for_settings
|
||||
|
|
|
@ -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>
|
||||
|
|
24
views/settings/site/bluesky.erb
Normal file
24
views/settings/site/bluesky.erb
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue