mirror of
https://github.com/neocities/neocities.git
synced 2025-08-05 01:01:30 +02:00
API key support
This commit is contained in:
parent
73ec613283
commit
1274e9fa63
8 changed files with 93 additions and 17 deletions
|
@ -29,6 +29,8 @@
|
|||
<li><a href="#username" data-toggle="tab">Change Site (User) Name</a></li>
|
||||
<li><a href="#tipping" data-toggle="tab">Tipping</a></li>
|
||||
|
||||
<li><a href="#api_key" data-toggle="tab">API Key</a></li>
|
||||
|
||||
<% if @site.admin_nsfw != true %>
|
||||
<li><a href="#nsfw" data-toggle="tab">18+</a></li>
|
||||
<% end %>
|
||||
|
@ -53,7 +55,9 @@
|
|||
<div class="tab-pane" id="tipping">
|
||||
<%== erb :'settings/site/tipping' %>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="api_key">
|
||||
<%== erb :'settings/site/api_key' %>
|
||||
</div>
|
||||
<% if @site.admin_nsfw != true %>
|
||||
<div class="tab-pane" id="nsfw">
|
||||
<%== erb :'settings/site/nsfw' %>
|
||||
|
|
4
views/settings/site/_api_key_form.erb
Normal file
4
views/settings/site/_api_key_form.erb
Normal file
|
@ -0,0 +1,4 @@
|
|||
<form method="POST" action="/settings/<%= @site.username %>/generate_api_key">
|
||||
<%== csrf_token_input_html %>
|
||||
<input class="btn-Action" type="submit" value="Generate API Key">
|
||||
</form>
|
19
views/settings/site/api_key.erb
Normal file
19
views/settings/site/api_key.erb
Normal file
|
@ -0,0 +1,19 @@
|
|||
<h2>API Key</h2>
|
||||
|
||||
<p>
|
||||
An API Key can be used with the <a href="https://neocities.org/api">Neocities API</a> to allow for changes to your site without requiring login credentials. <strong>This API key allows full write access to your site. Keep it secret, keep it safe.</strong>
|
||||
</p>
|
||||
|
||||
<% if @site.api_key %>
|
||||
<p>Your API key:<br><strong><%= @site.api_key %></strong></p>
|
||||
|
||||
<p>
|
||||
If you need to regenerate the key for some reason, you can do that below.
|
||||
Keep in mind that this will make the old key no longer function.
|
||||
</p>
|
||||
|
||||
<%== erb :'settings/site/_api_key_form', layout: false %>
|
||||
<% else %>
|
||||
<p>You haven't yet generated an API key, click the button to create one:</p>
|
||||
<%== erb :'settings/site/_api_key_form', layout: false %>
|
||||
<% end %>
|
Loading…
Add table
Add a link
Reference in a new issue