#820 - Update API URLs

This commit is contained in:
Elio Struyf
2024-08-08 14:18:27 +02:00
parent 5353d07fcb
commit 430760eca8
7 changed files with 23 additions and 24 deletions
+4
View File
@@ -1,5 +1,9 @@
# Change Log
## [10.2.1] - 2024-08-08
- [#820](https://github.com/estruyf/vscode-front-matter/issues/820): Update API links to the new API URL
## [10.2.0] - 2024-06-12 - [Release notes](https://beta.frontmatter.codes/updates/v10.2.0)
### ✨ New features
+10 -14
View File
@@ -22,20 +22,16 @@ export class Backers {
const githubAuth = await authentication.getSession('github', ['read:user'], { silent: true });
if (githubAuth && githubAuth.accessToken) {
try {
const isBeta = ext.isBetaVersion();
const response = await fetch(
`https://${isBeta ? `beta.` : ``}frontmatter.codes/api/v2/backers`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
accept: 'application/json'
},
body: JSON.stringify({
token: githubAuth.accessToken
})
}
);
const response = await fetch(`https://api.frontmatter.codes/v2/backers`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
accept: 'application/json'
},
body: JSON.stringify({
token: githubAuth.accessToken
})
});
if (response.ok) {
const prevData = await ext.getState<boolean>(CONTEXT.backer, 'global');
+2 -2
View File
@@ -14,8 +14,8 @@ export const DOCS_SUBMODULES = 'https://frontmatter.codes/docs/git-integration#g
export const WEBSITE_LINKS = {
root: 'https://frontmatter.codes',
api: {
metrics: 'https://frontmatter.codes/api/metrics',
ai: 'https://frontmatter.codes/api/ai'
root: 'https://api.frontmatter.codes',
metrics: 'https://api.frontmatter.codes/metrics'
},
docs: {
dataDashboard: 'https://frontmatter.codes/docs/dashboard/datafiles-view',
@@ -36,7 +36,7 @@ export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.Props
setLocaleReady(true);
});
const initResponse = await fetch(`${aiUrl}/api/ai-init`);
const initResponse = await fetch(`${aiUrl}/ai-init`);
if (!initResponse.ok) {
return;
@@ -70,7 +70,7 @@ export const Chatbot: React.FunctionComponent<IChatbotProps> = ({ }: React.Props
return;
}
const response = await fetch(`${aiUrl}/api/ai-chat`, {
const response = await fetch(`${aiUrl}/ai-chat`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -28,7 +28,7 @@ export const Feedback: React.FunctionComponent<IFeedbackProps> = ({
}, []);
const callVote = useCallback(async (vote: boolean) => {
await fetch(`${aiUrl}/api/ai-feedback`, {
await fetch(`${aiUrl}/ai-feedback`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
+1 -1
View File
@@ -93,7 +93,7 @@ if (elm) {
render(
<I10nProvider>
<SettingsProvider
aiUrl={WEBSITE_LINKS.root}
aiUrl={WEBSITE_LINKS.api.root}
experimental={experimental === 'true'}
version={version || ""}>
<Chatbot />
+3 -4
View File
@@ -9,7 +9,6 @@ import { TaxonomyType } from '../models';
import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../localization';
const AI_URL = WEBSITE_LINKS.api.ai;
// const AI_URL = 'http://localhost:3000/api/ai';
export class SponsorAi {
@@ -28,7 +27,7 @@ export class SponsorAi {
}, 10000);
const signal = controller.signal;
const response = await fetch(`${AI_URL}/title`, {
const response = await fetch(`${WEBSITE_LINKS.api.root}/ai/title`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -66,7 +65,7 @@ export class SponsorAi {
articleContent = articleContent.substring(0, 2000);
}
const response = await fetch(`${AI_URL}/description`, {
const response = await fetch(`${WEBSITE_LINKS.api.root}/ai/description`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
@@ -129,7 +128,7 @@ export class SponsorAi {
taxonomy: optionsString
});
const response = await fetch(`${AI_URL}/taxonomy`, {
const response = await fetch(`${WEBSITE_LINKS.api.root}/ai/taxonomy`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',