mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
/api/delete
This commit is contained in:
parent
2c2ef2d015
commit
7cd7973144
2 changed files with 29 additions and 8 deletions
|
@ -44,6 +44,11 @@ describe 'api delete' do
|
||||||
@site.store_file 't$st.jpg', Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
|
@site.store_file 't$st.jpg', Rack::Test::UploadedFile.new('./tests/files/test.jpg', 'image/jpeg')
|
||||||
post '/api/delete', filenames: ['t$st.jpg']
|
post '/api/delete', filenames: ['t$st.jpg']
|
||||||
res[:error_type].must_equal 'bad_filename'
|
res[:error_type].must_equal 'bad_filename'
|
||||||
|
|
||||||
|
create_site
|
||||||
|
basic_authorize @user, @pass
|
||||||
|
post '/api/delete', filenames: ['./config.yml']
|
||||||
|
res[:error_type].must_equal 'bad_filename'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'fails with missing files' do
|
it 'fails with missing files' do
|
||||||
|
@ -67,7 +72,6 @@ describe 'api delete' do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'api upload' do
|
describe 'api upload' do
|
||||||
|
|
||||||
it 'fails with no auth' do
|
it 'fails with no auth' do
|
||||||
post '/api/upload'
|
post '/api/upload'
|
||||||
res[:result].must_equal 'error'
|
res[:result].must_equal 'error'
|
||||||
|
|
|
@ -63,4 +63,21 @@ api.uploadFile('newfile.html', './local.html', function(resp) {
|
||||||
console.log(resp)
|
console.log(resp)
|
||||||
})
|
})
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<h3>POST /api/delete</h3>
|
||||||
|
<p>
|
||||||
|
Deletes files from your site. Provide a <strong>filenames</strong> argument with an array of filenames you wish to delete. You can delete any files except index.html.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong>Be careful with this API call.</strong> There is no way to undo a delete!
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h4>Examples</h4>
|
||||||
|
<h6>Using cURL</h6>
|
||||||
|
<p>
|
||||||
|
Delete <strong>img1.jpg</strong> and <strong>img2.jpg</strong> from your site:
|
||||||
|
</p>
|
||||||
|
<code>
|
||||||
|
curl -d "filenames[]=img1.jpg" -d "filenames[]=img2.jpg" \<br> https://YOURUSER:YOURPASS@neocities.org/api/delete
|
||||||
|
</code>
|
||||||
</div> <!-- end .content -->
|
</div> <!-- end .content -->
|
||||||
|
|
Loading…
Add table
Reference in a new issue