mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
Feature/autofac tidyup (#2096)
* Move service config service back into shared .NET Framework Library * Move Content files into shared folder. Make autoface load different assembilies depending on what framework is using it. * Change my mind on what the shared module should be called. Common Module is too bland. * DotNet4.SocksProxy is not yet publically .NET Standard. Revert to previous SocksWebProxy package. * Check in unstaged change to test dependency injection setup.
This commit is contained in:
89
src/Jackett.Common/Content/libs/api.js
Normal file
89
src/Jackett.Common/Content/libs/api.js
Normal file
@@ -0,0 +1,89 @@
|
||||
var api = {
|
||||
version: "2.0",
|
||||
root: "/api",
|
||||
key: "",
|
||||
|
||||
getApiPath: function(category, action) {
|
||||
var path = this.root + "/v" + this.version + "/" + category;
|
||||
if (action !== undefined)
|
||||
path = path + "/" + action
|
||||
return path;
|
||||
},
|
||||
|
||||
getAllIndexers: function(callback) {
|
||||
return $.get(this.getApiPath("indexers"), callback);
|
||||
},
|
||||
|
||||
getServerConfig: function(callback) {
|
||||
return $.get(this.getApiPath("server", "config"), callback);
|
||||
},
|
||||
|
||||
getIndexerConfig: function(indexerId, callback) {
|
||||
return $.get(this.getApiPath("indexers", indexerId + "/config"), callback);
|
||||
},
|
||||
|
||||
updateIndexerConfig: function(indexerId, config, callback) {
|
||||
return $.ajax({
|
||||
url: this.getApiPath("indexers", indexerId + "/config"),
|
||||
type: 'POST',
|
||||
data: JSON.stringify(config),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
cache: false,
|
||||
success: callback
|
||||
});
|
||||
},
|
||||
|
||||
deleteIndexer: function(indexerId, callback) {
|
||||
return $.ajax({
|
||||
url: this.getApiPath("indexers", indexerId),
|
||||
type: 'DELETE',
|
||||
cache: false,
|
||||
success: callback
|
||||
});
|
||||
},
|
||||
|
||||
testIndexer: function(indexerId, callback) {
|
||||
return $.post(this.getApiPath("indexers", indexerId + "/test"), callback);
|
||||
},
|
||||
|
||||
resultsForIndexer: function(indexerId, query, callback) {
|
||||
return $.get(this.getApiPath("indexers", indexerId + "/results?apikey=" + this.key), query, callback);
|
||||
},
|
||||
|
||||
getServerCache: function(callback) {
|
||||
return $.get(this.getApiPath("indexers", "cache"), callback);
|
||||
},
|
||||
|
||||
getServerLogs: function(callback) {
|
||||
return $.get(this.getApiPath("server", "logs"), callback);
|
||||
},
|
||||
|
||||
updateServerConfig: function(serverConfig, callback) {
|
||||
return $.ajax({
|
||||
url: this.getApiPath("server", "config"),
|
||||
type: 'POST',
|
||||
data: JSON.stringify(serverConfig),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
cache: false,
|
||||
success: callback
|
||||
});
|
||||
},
|
||||
|
||||
updateServer: function(callback) {
|
||||
return $.post(this.getApiPath("server", "update"), callback);
|
||||
},
|
||||
|
||||
updateAdminPassword: function(password, callback) {
|
||||
return $.ajax({
|
||||
url: this.getApiPath("server", "adminpassword"),
|
||||
type: 'POST',
|
||||
data: JSON.stringify(password),
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
cache: false,
|
||||
success: callback
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user