mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
api: include file sha1 hash in /api/list (#252)
This commit is contained in:
parent
556bc9d2be
commit
8d0e339f72
3 changed files with 10 additions and 4 deletions
|
@ -32,6 +32,7 @@ get '/api/list' do
|
|||
new_file[:is_directory] = file[:is_directory]
|
||||
new_file[:size] = file[:size] unless file[:is_directory]
|
||||
new_file[:updated_at] = file[:updated_at].rfc2822
|
||||
new_file[:sha1_hash] = file[:sha1_hash] unless file[:is_directory]
|
||||
files << new_file
|
||||
end
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ describe 'api list' do
|
|||
site_file[:is_directory].must_equal file[:is_directory]
|
||||
site_file[:size].must_equal file[:size]
|
||||
site_file[:updated_at].rfc2822.must_equal file[:updated_at]
|
||||
site_file[:sha1_hash].must_equal file[:sha1_hash]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -110,13 +110,15 @@ api.delete(['img1.jpg', 'img2.jpg'], function(resp) {
|
|||
"path": "index.html",
|
||||
"is_directory": false,
|
||||
"size": 1023,
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
|
||||
"sha1_hash": "c8aac06f343c962a24a7eb111aad739ff48b7fb1"
|
||||
},
|
||||
{
|
||||
"path": "not_found.html",
|
||||
"is_directory": false,
|
||||
"size": 271,
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
|
||||
"sha1_hash": "cfdf0bda2557c322be78302da23c32fec72ffc0b"
|
||||
},
|
||||
{
|
||||
"path": "images",
|
||||
|
@ -127,7 +129,8 @@ api.delete(['img1.jpg', 'img2.jpg'], function(resp) {
|
|||
"path": "images/cat.png",
|
||||
"is_directory": false,
|
||||
"size": 16793,
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
|
||||
"sha1_hash": "41fe08fc0dd44e79f799d03ece903e62be25dc7d"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -141,7 +144,8 @@ api.delete(['img1.jpg', 'img2.jpg'], function(resp) {
|
|||
"path": "images/cat.png",
|
||||
"is_directory": false,
|
||||
"size": 16793,
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000"
|
||||
"updated_at": "Sat, 13 Feb 2016 03:04:00 -0000",
|
||||
"sha1_hash": "41fe08fc0dd44e79f799d03ece903e62be25dc7d"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue