Skip to content

Commit 430760e

Browse files
committed
#820 - Update API URLs
1 parent 5353d07 commit 430760e

File tree

7 files changed

+23
-24
lines changed

7 files changed

+23
-24
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## [10.2.1] - 2024-08-08
4+
5+
- [#820](https://github.com/estruyf/vscode-front-matter/issues/820): Update API links to the new API URL
6+
37
## [10.2.0] - 2024-06-12 - [Release notes](https://beta.frontmatter.codes/updates/v10.2.0)
48

59
### ✨ New features

src/commands/Backers.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,16 @@ export class Backers {
2222
const githubAuth = await authentication.getSession('github', ['read:user'], { silent: true });
2323
if (githubAuth && githubAuth.accessToken) {
2424
try {
25-
const isBeta = ext.isBetaVersion();
26-
const response = await fetch(
27-
`https://${isBeta ? `beta.` : ``}frontmatter.codes/api/v2/backers`,
28-
{
29-
method: 'POST',
30-
headers: {
31-
'Content-Type': 'application/json',
32-
accept: 'application/json'
33-
},
34-
body: JSON.stringify({
35-
token: githubAuth.accessToken
36-
})
37-
}
38-
);
25+
const response = await fetch(`https://api.frontmatter.codes/v2/backers`, {
26+
method: 'POST',
27+
headers: {
28+
'Content-Type': 'application/json',
29+
accept: 'application/json'
30+
},
31+
body: JSON.stringify({
32+
token: githubAuth.accessToken
33+
})
34+
});
3935

4036
if (response.ok) {
4137
const prevData = await ext.getState<boolean>(CONTEXT.backer, 'global');

src/constants/Links.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export const DOCS_SUBMODULES = 'https://frontmatter.codes/docs/git-integration#g
1414
export const WEBSITE_LINKS = {
1515
root: 'https://frontmatter.codes',
1616
api: {
17-
metrics: 'https://frontmatter.codes/api/metrics',
18-
ai: 'https://frontmatter.codes/api/ai'
17+
root: 'https://api.frontmatter.codes',
18+
metrics: 'https://api.frontmatter.codes/metrics'
1919
},
2020
docs: {
2121
dataDashboard: 'https://frontmatter.codes/docs/dashboard/datafiles-view',

src/dashboardWebView/components/Chatbot/Chatbot.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.Props
3636
setLocaleReady(true);
3737
});
3838

39-
const initResponse = await fetch(`${aiUrl}/api/ai-init`);
39+
const initResponse = await fetch(`${aiUrl}/ai-init`);
4040

4141
if (!initResponse.ok) {
4242
return;
@@ -70,7 +70,7 @@ export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.Props
7070
return;
7171
}
7272

73-
const response = await fetch(`${aiUrl}/api/ai-chat`, {
73+
const response = await fetch(`${aiUrl}/ai-chat`, {
7474
method: 'POST',
7575
headers: {
7676
'Content-Type': 'application/json',

src/dashboardWebView/components/Chatbot/Feedback.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const Feedback: React.FunctionComponent<IFeedbackProps> = ({
2828
}, []);
2929

3030
const callVote = useCallback(async (vote: boolean) => {
31-
await fetch(`${aiUrl}/api/ai-feedback`, {
31+
await fetch(`${aiUrl}/ai-feedback`, {
3232
method: 'POST',
3333
headers: {
3434
'Content-Type': 'application/json',

src/dashboardWebView/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ if (elm) {
9393
render(
9494
<I10nProvider>
9595
<SettingsProvider
96-
aiUrl={WEBSITE_LINKS.root}
96+
aiUrl={WEBSITE_LINKS.api.root}
9797
experimental={experimental === 'true'}
9898
version={version || ""}>
9999
<Chatbot />

src/services/SponsorAI.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { TaxonomyType } from '../models';
99
import * as l10n from '@vscode/l10n';
1010
import { LocalizationKey } from '../localization';
1111

12-
const AI_URL = WEBSITE_LINKS.api.ai;
1312
// const AI_URL = 'http://localhost:3000/api/ai';
1413

1514
export class SponsorAi {
@@ -28,7 +27,7 @@ export class SponsorAi {
2827
}, 10000);
2928
const signal = controller.signal;
3029

31-
const response = await fetch(`${AI_URL}/title`, {
30+
const response = await fetch(`${WEBSITE_LINKS.api.root}/ai/title`, {
3231
method: 'POST',
3332
headers: {
3433
'Content-Type': 'application/json',
@@ -66,7 +65,7 @@ export class SponsorAi {
6665
articleContent = articleContent.substring(0, 2000);
6766
}
6867

69-
const response = await fetch(`${AI_URL}/description`, {
68+
const response = await fetch(`${WEBSITE_LINKS.api.root}/ai/description`, {
7069
method: 'POST',
7170
headers: {
7271
'Content-Type': 'application/json',
@@ -129,7 +128,7 @@ export class SponsorAi {
129128
taxonomy: optionsString
130129
});
131130

132-
const response = await fetch(`${AI_URL}/taxonomy`, {
131+
const response = await fetch(`${WEBSITE_LINKS.api.root}/ai/taxonomy`, {
133132
method: 'POST',
134133
headers: {
135134
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)