mirror of
https://github.com/zoriya/flood.git
synced 2026-06-03 19:21:48 +00:00
API: rearrange add, add-files and details endpoints
Add and add-files endpoints belong to the Torrents section. getTorrentDetails should use /:hash/details format to match priority and file-priority endpoints.
This commit is contained in:
@@ -19,7 +19,7 @@ const baseURI = ConfigStore.getBaseURI();
|
||||
const TorrentActions = {
|
||||
addTorrentsByUrls: (options: AddTorrentByURLOptions) =>
|
||||
axios
|
||||
.post(`${baseURI}api/client/add`, options)
|
||||
.post(`${baseURI}api/client/torrents/add`, options)
|
||||
.then((json) => json.data)
|
||||
.then(
|
||||
(response) => {
|
||||
@@ -44,7 +44,7 @@ const TorrentActions = {
|
||||
|
||||
addTorrentsByFiles: (options: AddTorrentByFileOptions) =>
|
||||
axios
|
||||
.post(`${baseURI}api/client/add-files`, options)
|
||||
.post(`${baseURI}api/client/torrents/add-files`, options)
|
||||
.then((json) => json.data)
|
||||
.then(
|
||||
(data) => {
|
||||
@@ -120,9 +120,7 @@ const TorrentActions = {
|
||||
|
||||
fetchTorrentDetails: (hash: TorrentProperties['hash']) =>
|
||||
axios
|
||||
.post(`${baseURI}api/client/torrent-details`, {
|
||||
hash,
|
||||
})
|
||||
.get(`${baseURI}api/client/torrents/${hash}/details`)
|
||||
.then((json) => json.data)
|
||||
.then(
|
||||
(torrentDetails) => {
|
||||
|
||||
+16
-16
@@ -35,14 +35,6 @@ router.post('/connection-test', (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
router.post('/add', (req, res) => {
|
||||
client.addUrls(req.user, req.services, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.post('/add-files', (req, res) => {
|
||||
client.addFiles(req.user, req.services, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.get('/settings', (req, res) => {
|
||||
client.getSettings(req.user, req.services, req.query, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
@@ -55,16 +47,12 @@ router.put('/settings/speed-limits', (req, res) => {
|
||||
client.setSpeedLimits(req.user, req.services, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.post('/torrent-details', (req, res) => {
|
||||
client.getTorrentDetails(req.user, req.services, req.body.hash, ajaxUtil.getResponseFn(res));
|
||||
router.post('/torrents/add', (req, res) => {
|
||||
client.addUrls(req.user, req.services, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.patch('/torrents/:hash/priority', (req, res) => {
|
||||
client.setPriority(req.user, req.services, req.params.hash, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.patch('/torrents/:hash/file-priority', (req, res) => {
|
||||
client.setFilePriority(req.user, req.services, req.params.hash, req.body, ajaxUtil.getResponseFn(res));
|
||||
router.post('/torrents/add-files', (req, res) => {
|
||||
client.addFiles(req.user, req.services, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -200,6 +188,18 @@ router.patch('/torrents/tracker', (req, res) => {
|
||||
client.setTracker(req.user, req.services, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.get('/torrents/:hash/details', (req, res) => {
|
||||
client.getTorrentDetails(req.user, req.services, req.params.hash, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.patch('/torrents/:hash/priority', (req, res) => {
|
||||
client.setPriority(req.user, req.services, req.params.hash, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.patch('/torrents/:hash/file-priority', (req, res) => {
|
||||
client.setFilePriority(req.user, req.services, req.params.hash, req.body, ajaxUtil.getResponseFn(res));
|
||||
});
|
||||
|
||||
router.get('/methods.json', (req, res) => {
|
||||
const {type} = req.query;
|
||||
const {args} = req.query;
|
||||
|
||||
Reference in New Issue
Block a user