Skip to content

Commit a045b83

Browse files
committed
Controllers\Sources: Remove unused GET /source API endpoint
Initially, it was used to produce HTML fragment containing a form for adding new source. In 767e667, it has been changed to return JSON with just the `spouts`, which is almost identical to `GET /sources/spouts`. Let’s switch to that and drop the old API endpoint. Bumping API version to 8.0.0.
1 parent b96be96 commit a045b83

File tree

7 files changed

+10
-22
lines changed

7 files changed

+10
-22
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
- [Prettier](https://prettier.io/) is now used for code formatting. ([#1493](https://github.com/fossar/selfoss/pull/1493))
5151
- Several `npm run` scripts were renamed for consistency: `analyse:server``check:server:phpstan`, `cs:server``check:server:cs`, `lint:server``check:server:lint`. ([#1494](https://github.com/fossar/selfoss/pull/1494))
5252

53+
### API changes
54+
55+
- *API 8.0.0*: Remove `GET /source` API, it was only used by us and was redundant with `GET /sources/spouts` ([#1539](https://github.com/fossar/selfoss/pull/1539))
56+
5357

5458
## 2.19 – 2022-10-12
5559
**This version requires PHP ~~5.6~~ 7.2 (see known regressions section) or newer. It is also the last version to support PHP 7.**

client/js/requests/sources.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ export function getAllSources(abortController) {
6565
* Gets list of supported spouts and their paramaters.
6666
*/
6767
export function getSpouts() {
68-
return ajax.get('source').promise.then((response) => response.json());
68+
return ajax
69+
.get('sources/spouts')
70+
.promise.then((response) => response.json());
6971
}
7072

7173
/**

client/js/templates/SourcesPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function handleAddSource({
3434
// Refresh the spout datea
3535
sourceRequests
3636
.getSpouts()
37-
.then(({ spouts }) => {
37+
.then((spouts) => {
3838
// Update spout data.
3939
setSpouts(spouts);
4040
})

docs/api-description.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"servers": [],
44
"info": {
55
"description": "You can access selfoss by using the same backend as selfoss user interface: The RESTful HTTP JSON API. There are a few urls where you can get information from selfoss and some for updating data. Assume you want all tags for rendering this in your own app. You have to make an HTTP GET call on the url /tags:\n\n```\nGET http://yourselfossurl.com/tags\n```\nThe result is following JSON formatted response (in this example two tags “blog” and “deviantart” are available:\n\n```\n[{\"tag\":\"blog\",\"color\":\"#251f10\",\"unread\":\"1\"},\n{\"tag\":\"deviantart\",\"color\":\"#e78e5c\",\"unread\":\"0\"}]\n```\n\nFollowing docs shows you which calls are possible and which response you can expect.",
6-
"version": "7.0.0",
6+
"version": "8.0.0",
77
"title": "selfoss"
88
},
99
"tags": [

index.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@
109109
// json
110110
$container->get(controllers\Sources::class)->show();
111111
});
112-
$router->get('/source', function() use ($container): void {
113-
// json
114-
$container->get(controllers\Sources::class)->add();
115-
});
116112
$router->get('/sources/list', function() use ($container): void {
117113
// json
118114
$container->get(controllers\Sources::class)->listSources();

src/constants.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
// independent of selfoss version
1010
// needs to be bumped each time public API is changed (follows semver)
1111
// keep in sync with docs/api-description.json
12-
const SELFOSS_API_VERSION = '7.0.0';
12+
const SELFOSS_API_VERSION = '8.0.0';

src/controllers/Sources.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,6 @@ public function show(): void {
5656
]);
5757
}
5858

59-
/**
60-
* add new source
61-
* json
62-
*/
63-
public function add(): void {
64-
$this->authentication->ensureIsPrivileged();
65-
66-
$spouts = $this->spoutLoader->all();
67-
68-
$this->view->jsonSuccess([
69-
'spouts' => $spouts,
70-
]);
71-
}
72-
7359
/**
7460
* render spouts params
7561
* json

0 commit comments

Comments
 (0)