Skip to content

Commit

Permalink
change: add Env.Api to store api links
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetherinox committed Apr 3, 2024
1 parent 271a25c commit d9ab83b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
22 changes: 22 additions & 0 deletions src/api/Env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ type Repo =
urlDemoVault?: HttpsUrl
}

/*
Api Strings
*/

type Api =
{
github?: HttpsUrl
}

/*
Class > Env
*/
Expand All @@ -46,6 +55,10 @@ export abstract class Env
private static _obsidianApiVer: string
private static _manifest: PluginManifest

/*
Repo Links
*/

public static readonly Links: Repo =
{
urlDocs: 'https://aetherinox.github.io/obsidian-gistr',
Expand All @@ -58,6 +71,15 @@ export abstract class Env
urlDemoVault: 'https://github.com/Aetherinox/obsidian-gistr/tree/main/tests/gistr-vault',
}

/*
Api
*/

public static readonly Api: Api =
{
github: 'https://www.githubstatus.com/api/v2/summary.json',
}

/*
Initialize
*/
Expand Down
12 changes: 6 additions & 6 deletions src/lang/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ export default
*/

cfg_tab_su_desc: 'The following buttons are associated to useful resources for this plugin.',
cfg_tab_su_doc_name: 'Documentation',
cfg_tab_su_doc_desc: 'View the official Gistr documentation',
cfg_tab_su_doc_btn: 'View',
cfg_tab_su_gs_name: 'Introduction',
cfg_tab_su_gs_desc: 'View brief introduction to getting started with this plugin',
cfg_tab_su_gs_btn: 'Open',
cfg_tab_su_repo_label: 'Plugin repo',
cfg_tab_su_repo_label: 'Gistr repo',
cfg_tab_su_repo_btn: 'View',
cfg_tab_su_vault_label: 'Plugin demo vault',
cfg_tab_su_doc_name: 'Gistr Documentation',
cfg_tab_su_doc_desc: 'View the official Gistr documentation',
cfg_tab_su_doc_btn: 'View',
cfg_tab_su_vault_label: 'Gistr demo vault',
cfg_tab_su_vault_btn: 'View',
cfg_tab_su_ogrepo_label: 'OpenGist: download',
cfg_tab_su_ogrepo_url: 'https://github.com/thomiceli/opengist/releases',
Expand Down Expand Up @@ -255,7 +255,7 @@ export default
Tab > Sync
*/

cfg_tab_sy_list_save_showall_name: 'Save list: Show All Saves',
cfg_tab_sy_list_save_showall_name: 'Save list: Show all saves',
cfg_tab_sy_list_save_showall_desc: 'This setting effects how the gist save list displays saved gists.<br><br><span class="gistr-settings-elm-note">Enabled</span>: When saving an existing gist, the suggestion box will display ALL saves for that note in the same list; both public and secret.<br><br><span class="gistr-settings-elm-important">Disabled</span>: Public and secret gist saves will be separated when being displayed in the existing gist save list.',

cfg_tab_sy_list_icon_name: 'Save list: Icon color',
Expand Down
3 changes: 2 additions & 1 deletion src/modals/GettingStartedModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import { App, Modal, ButtonComponent, Setting, requestUrl, MarkdownRenderer } from "obsidian"
import GistrPlugin from "src/main"
import { Env } from 'src/api'
import { GistrSettings } from 'src/settings/'
import { lng } from 'src/lang'

Expand Down Expand Up @@ -115,7 +116,7 @@ export default class ModalGettingStarted extends Modal
*/

let json_delay = 1 * 1000
const gh_status = requestUrl( "https://www.githubstatus.com/api/v2/summary.json" ).then( ( res ) =>
const gh_status = requestUrl( Env.Api[ "github" ] ).then( ( res ) =>
{
if ( res.status === 200 )
return res.json.components[ 0 ].status || lng( "gist_status_issues" )
Expand Down
2 changes: 1 addition & 1 deletion src/settings/sections/SettingsSection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ export class SettingsSection extends PluginSettingTab
*/

let json_delay = 0.5 * 1000
const gh_status = requestUrl( "https://www.githubstatus.com/api/v2/summary.json" ).then( ( res ) =>
const gh_status = requestUrl( Env.Api[ "github" ] ).then( ( res ) =>
{
if ( res.status === 200 )
return res.json.components[ 0 ].status || lng( "gist_status_issues" )
Expand Down

0 comments on commit d9ab83b

Please sign in to comment.