Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to V3 server API (with two comments after the fold) #1685

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

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