Skip to content

Commit

Permalink
Merge pull request #1685 from FreeFeed/v3-api
Browse files Browse the repository at this point in the history
Switch to V3 server API (with two comments after the fold)
  • Loading branch information
davidmz authored Jul 3, 2024
2 parents 71abe06 + bec08f3 commit 743bcae
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 140 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.133.0] - Not released
### Added
- Add a "description" meta-tag to the index.html.
### Changed
- Switch to V3 server API (with _omittedCommentsOffset_ field and two comments
after the fold).
### Fixed
- Update SSI patterns in index.html to support dashes in groupnames.
- Bug on iOS that blocks deletion of post's attachments.
Expand Down
3 changes: 2 additions & 1 deletion src/components/stats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { startOfYesterday } from 'date-fns/startOfYesterday';
import { subYears } from 'date-fns/subYears';
import { format } from '../utils/date-format';
import { apiVersion } from '../services/api-version';

function StatsChart({ type, title }) {
const [data, setData] = useState(null);
Expand All @@ -21,7 +22,7 @@ function StatsChart({ type, title }) {
const to_date = format(startOfYesterday(), `yyyy-MM-dd`); // Yesterday
const from_date = format(subYears(new Date(), 1), `yyyy-MM-dd`); // Stats for 1 year

const url = `${CONFIG.api.root}/v2/stats?data=${type}&start_date=${from_date}&end_date=${to_date}`;
const url = `${CONFIG.api.root}/v${apiVersion}/stats?data=${type}&start_date=${from_date}&end_date=${to_date}`;

try {
const response = await fetch(url);
Expand Down
3 changes: 2 additions & 1 deletion src/components/user.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '../redux/action-creators';
import { getCurrentRouteName } from '../utils';
import { initialAsyncState } from '../redux/async-helpers';
import { apiVersion } from '../services/api-version';
import { postActions, userActions } from './select-utils';
import FeedOptionsSwitch from './feed-options-switch';
import Breadcrumbs from './breadcrumbs';
Expand Down Expand Up @@ -79,7 +80,7 @@ const UserHandler = (props) => {
? `Posts of ${props.viewUser.username}`
: `Posts in group ${props.viewUser.username}`
}
href={`${CONFIG.api.root}/v2/timelines-rss/${props.viewUser.username}`}
href={`${CONFIG.api.root}/v${apiVersion}/timelines-rss/${props.viewUser.username}`}
/>
<title>
{nameForTitle} - {CONFIG.siteTitle}
Expand Down
1 change: 1 addition & 0 deletions src/services/api-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const apiVersion = 3;
Loading

0 comments on commit 743bcae

Please sign in to comment.