From ab036b3c8d3912a3d6de22820a7d5c8ba099c149 Mon Sep 17 00:00:00 2001 From: EnixCoda Date: Sun, 13 Jun 2021 18:12:39 +0800 Subject: [PATCH] fix: set copySnippetButton to false on github.com --- src/utils/config/helper.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/utils/config/helper.ts b/src/utils/config/helper.ts index 6380697..9a2b562 100644 --- a/src/utils/config/helper.ts +++ b/src/utils/config/helper.ts @@ -41,13 +41,16 @@ enum configKeys { compactFileTree = 'compactFileTree', } +// do NOT use platform name +const platformStorageKey = `platform_` + window.location.host.toLowerCase() + export const defaultConfigs: Config = { sideBarWidth: 260, shortcut: undefined, accessToken: '', compressSingletonFolder: true, copyFileButton: true, - copySnippetButton: !(platformName === 'GitHub' && !platform.isEnterprise()), // false when on github.com + copySnippetButton: platformStorageKey !== 'platform_github.com', // false when on github.com intelligentToggle: null, icons: 'rich', toggleButtonVerticalDistance: 124, // align with GitHub's navbar items @@ -71,8 +74,6 @@ function applyDefaultConfigs(configs: Partial) { export type VersionedConfig = Record & { configVersion: string } -// do NOT use platform name -const platformStorageKey = `platform_` + window.location.host.toLowerCase() const prepareConfig = new Promise(async resolve => { await migrateConfig() resolve()