Add non-root url path support

This commit is contained in:
hcl
2021-01-25 17:52:15 +08:00
committed by nkanaev
parent 63b265fa04
commit 4f79c919f0
6 changed files with 97 additions and 54 deletions

View File

@@ -26,74 +26,74 @@
window.api = {
feeds: {
list: function() {
return api('get', '/api/feeds').then(json)
return api('get', './api/feeds').then(json)
},
create: function(data) {
return api('post', '/api/feeds', data).then(json)
return api('post', './api/feeds', data).then(json)
},
update: function(id, data) {
return api('put', '/api/feeds/' + id, data)
return api('put', './api/feeds/' + id, data)
},
delete: function(id) {
return api('delete', '/api/feeds/' + id)
return api('delete', './api/feeds/' + id)
},
list_items: function(id) {
return api('get', '/api/feeds/' + id + '/items').then(json)
return api('get', './api/feeds/' + id + '/items').then(json)
},
refresh: function() {
return api('post', '/api/feeds/refresh')
return api('post', './api/feeds/refresh')
},
list_errors: function() {
return api('get', '/api/feeds/errors').then(json)
return api('get', './api/feeds/errors').then(json)
},
},
folders: {
list: function() {
return api('get', '/api/folders').then(json)
return api('get', './api/folders').then(json)
},
create: function(data) {
return api('post', '/api/folders', data).then(json)
return api('post', './api/folders', data).then(json)
},
update: function(id, data) {
return api('put', '/api/folders/' + id, data)
return api('put', './api/folders/' + id, data)
},
delete: function(id) {
return api('delete', '/api/folders/' + id)
return api('delete', './api/folders/' + id)
},
list_items: function(id) {
return api('get', '/api/folders/' + id + '/items').then(json)
return api('get', './api/folders/' + id + '/items').then(json)
}
},
items: {
list: function(query) {
return api('get', '/api/items' + param(query)).then(json)
return api('get', './api/items' + param(query)).then(json)
},
update: function(id, data) {
return api('put', '/api/items/' + id, data)
return api('put', './api/items/' + id, data)
},
mark_read: function(query) {
return api('put', '/api/items' + param(query))
return api('put', './api/items' + param(query))
},
},
settings: {
get: function() {
return api('get', '/api/settings').then(json)
return api('get', './api/settings').then(json)
},
update: function(data) {
return api('put', '/api/settings', data)
return api('put', './api/settings', data)
},
},
status: function() {
return api('get', '/api/status').then(json)
return api('get', './api/status').then(json)
},
upload_opml: function(form) {
return fetch('/opml/import', {
return fetch('./opml/import', {
method: 'post',
body: new FormData(form),
})
},
crawl: function(url) {
return fetch('/page?url=' + url).then(function(res) {
return fetch('./page?url=' + url).then(function(res) {
return res.text()
})
}