Skip to content

Commit

Permalink
chore: Update website and API hosts #820
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Jul 18, 2024
1 parent 86de4fa commit 1d7436d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- [#467](https://github.com/estruyf/vscode-front-matter/issues/467): New `fmContentType` metadata field to link content type (fallback to the `type` field)
- [#819](https://github.com/estruyf/vscode-front-matter/issues/819): Added new extensibility support for media scripts
- [#820](https://github.com/estruyf/vscode-front-matter/issues/820): Moving the website and API to different hosts
- [#821](https://github.com/estruyf/vscode-front-matter/issues/821): Added URI handler to support command links from the documentation
- [#822](https://github.com/estruyf/vscode-front-matter/issues/822): Added docs to the panel & dashboard views
- [#829](https://github.com/estruyf/vscode-front-matter/issues/829): UI extensibility is now generally available
Expand Down
25 changes: 11 additions & 14 deletions src/commands/Backers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authentication, commands, ExtensionContext } from 'vscode';
import { COMMAND_NAME, CONTEXT } from '../constants';
import { COMMAND_NAME, CONTEXT, WEBSITE_LINKS } from '../constants';
import { Extension, Logger } from '../helpers';
import { Dashboard } from './Dashboard';
import { SettingsListener } from '../listeners/panel';
Expand All @@ -23,19 +23,16 @@ export class Backers {
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(`${WEBSITE_LINKS.api.url}/api/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');
Expand Down
1 change: 1 addition & 0 deletions src/constants/Links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const DOCS_SUBMODULES = 'https://frontmatter.codes/docs/git-integration#g
export const WEBSITE_LINKS = {
root: 'https://frontmatter.codes',
api: {
url: 'https://fontmatter-fncs.azurewebsites.net',
metrics: 'https://frontmatter.codes/api/metrics',
ai: 'https://frontmatter.codes/api/ai'
},
Expand Down
2 changes: 1 addition & 1 deletion src/dashboardWebView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if (elm) {
render(
<I10nProvider>
<SettingsProvider
aiUrl={WEBSITE_LINKS.root}
aiUrl={WEBSITE_LINKS.api.url}
experimental={experimental === 'true'}
version={version || ""}>
<Chatbot />
Expand Down
2 changes: 1 addition & 1 deletion src/services/SponsorAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TaxonomyType } from '../models';
import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../localization';

const AI_URL = WEBSITE_LINKS.api.ai;
const AI_URL = `${WEBSITE_LINKS.api.url}/api/ai`;
// const AI_URL = 'http://localhost:3000/api/ai';

export class SponsorAi {
Expand Down

0 comments on commit 1d7436d

Please sign in to comment.