diff --git a/src/app/BrowserApi.ts b/src/app/BrowserApi.ts index c95d58b3..886b6971 100644 --- a/src/app/BrowserApi.ts +++ b/src/app/BrowserApi.ts @@ -13,7 +13,7 @@ import {useTabsetService} from "src/tabsets/services/TabsetService2"; import {useFeaturesStore} from "src/features/stores/featuresStore"; import {useRequestsService} from "src/requests/services/ContentService"; import {useCommandExecutor} from "src/core/services/CommandExecutor"; -import {GithubBackupCommand} from "src/tabsets/commands/GithubBackupCommand"; +import {GithubBackupCommand} from "src/tabsets/commands/github/GithubBackupCommand"; function runHousekeeping() { diff --git a/src/boot/constants.ts b/src/boot/constants.ts index 6af8af10..7b6ab434 100644 --- a/src/boot/constants.ts +++ b/src/boot/constants.ts @@ -43,6 +43,8 @@ const GITHUB_USERNAME = "github.username" const GITHUB_REPONAME = "github.reponame" const GITHUB_TOKEN = "github.token" const GITHUB_AUTO_BACKUP = "github.autobackup" +const GITHUB_LOG = "github.log" +const GITHUB_PATH = "github.path" export default boot(({}) => { }) @@ -65,6 +67,6 @@ export { CURRENT_USER_ID, CURRENT_USER_EMAIL, UI_WINDOWS_ITEMS_PER_PAGE, - GITHUB_USERNAME, GITHUB_REPONAME, GITHUB_TOKEN, GITHUB_AUTO_BACKUP + GITHUB_USERNAME, GITHUB_REPONAME, GITHUB_TOKEN, GITHUB_AUTO_BACKUP,GITHUB_LOG,GITHUB_PATH } diff --git a/src/core b/src/core index b2e0e8a6..6648b1f9 160000 --- a/src/core +++ b/src/core @@ -1 +1 @@ -Subproject commit b2e0e8a6cea567a5ba9971d3b76b8f4c93aab3b3 +Subproject commit 6648b1f90ad8a3fef805d01bd9c0105c616c94c1 diff --git a/src/pages/SettingsPage.vue b/src/pages/SettingsPage.vue index 233e8e32..a582ece9 100644 --- a/src/pages/SettingsPage.vue +++ b/src/pages/SettingsPage.vue @@ -342,7 +342,7 @@
- +
@@ -549,8 +549,6 @@ const unarchive = (tabset: Tabset) => sendMsg('reload-tabset', {tabsetId: tabset.id}) }) -// const ignoredUrls = () => useTabsStore().ignoredTabset?.tabs - const simulateNewVersion = (version: string) => NavigationService.updateAvailable({version: version}) const restoreHints = () => useUiStore().restoreHints() @@ -564,7 +562,7 @@ const simulateStaticSuggestion = () => { useSuggestionsStore().addSuggestion(suggestions[suggestionsCounter++ % 2]) } -const setTab = (a: any) => tab.value = a['tab' as keyof object] +const setTab = (t: string) => tab.value = t diff --git a/src/pages/helper/BackupSettings.vue b/src/pages/helper/BackupSettings.vue index c4966797..9cc7595f 100644 --- a/src/pages/helper/BackupSettings.vue +++ b/src/pages/helper/BackupSettings.vue @@ -7,7 +7,7 @@
Username
-
Your github username
+
Your github username
@@ -16,7 +16,7 @@
Repository
-
A preferrably empty public repository
+
A preferrably empty public repository
@@ -25,7 +25,7 @@
GitHub Access Token
-
Click here to create a new +
Click here to create a new token (use scope public_repo).
@@ -34,14 +34,26 @@
+
+
Path
+
optional path where to store the backups and logs +
+
+
+ +
+
+
Save
- + +
+
- +
@@ -54,37 +66,62 @@ import {ref, watchEffect} from "vue"; import {LocalStorage} from "quasar"; import {useCommandExecutor} from "src/core/services/CommandExecutor"; -import {GithubBackupCommand} from "src/tabsets/commands/GithubBackupCommand"; -import {GITHUB_AUTO_BACKUP, GITHUB_REPONAME, GITHUB_TOKEN, GITHUB_USERNAME} from "boot/constants"; +import { + GITHUB_AUTO_BACKUP, + GITHUB_LOG, + GITHUB_PATH, + GITHUB_REPONAME, + GITHUB_TOKEN, + GITHUB_USERNAME +} from "boot/constants"; +import {GithubBackupCommand} from "src/tabsets/commands/github/GithubBackupCommand"; +import {NotificationType} from "src/core/services/ErrorHandler"; +import {useUiStore} from "src/ui/stores/uiStore"; const username = ref(LocalStorage.getItem(GITHUB_USERNAME) as string) const reponame = ref(LocalStorage.getItem(GITHUB_REPONAME) as string) const githubToken = ref(LocalStorage.getItem(GITHUB_TOKEN) as string) const autobackup = ref(LocalStorage.getItem(GITHUB_AUTO_BACKUP) || false) +const githubLog = ref(LocalStorage.getItem(GITHUB_LOG) || false) +const githubPath = ref(LocalStorage.getItem(GITHUB_PATH) as string) + +const loading = ref(false) + +function clearIncluding(idenfier: string) { + LocalStorage.remove(idenfier) + githubLog.value = false + autobackup.value = false +} watchEffect(() => { (username.value && username.value.trim().length > 0) ? LocalStorage.set(GITHUB_USERNAME, username.value) - : LocalStorage.remove(GITHUB_USERNAME) + : clearIncluding(GITHUB_USERNAME) }) watchEffect(() => { (reponame.value && reponame.value.trim().length > 0) ? LocalStorage.set(GITHUB_REPONAME, reponame.value) - : LocalStorage.remove(GITHUB_REPONAME) + : clearIncluding(GITHUB_REPONAME) }) watchEffect(() => { (githubToken.value && githubToken.value.trim().length > 0) ? LocalStorage.set(GITHUB_TOKEN, githubToken.value) - : LocalStorage.remove(GITHUB_TOKEN) + : clearIncluding(GITHUB_TOKEN) }) watchEffect(() => { - LocalStorage.set(GITHUB_AUTO_BACKUP, autobackup.value) + (githubPath.value && githubPath.value.trim().length > 0) + ? LocalStorage.set(GITHUB_PATH, githubPath.value) + : clearIncluding(GITHUB_PATH) }) +watchEffect(() => LocalStorage.set(GITHUB_AUTO_BACKUP, autobackup.value)) + +watchEffect(() => LocalStorage.set(GITHUB_LOG, githubLog.value)) + const runGithubBackup = () => { - useCommandExecutor().executeFromUi(new GithubBackupCommand()) + useCommandExecutor().executeFromUi(new GithubBackupCommand(["tabsets_backup_current", "tabset_backup_" + new Date().getTime()]), NotificationType.NOTIFY) } diff --git a/src/pages/helper/ImportExportSettings.vue b/src/pages/helper/ImportExportSettings.vue index b1384bd8..00bb9894 100644 --- a/src/pages/helper/ImportExportSettings.vue +++ b/src/pages/helper/ImportExportSettings.vue @@ -11,7 +11,7 @@
Export
as json or as bookmarks
- export to github is available here. + export to github is available here.
@@ -26,7 +26,7 @@
Import
- from json
+ from json or github backup
You might need to restart tabsets.
@@ -47,10 +47,10 @@ import ExportDialog from "src/tabsets/dialogues/ExportDialog.vue"; import ImportDialog from "src/tabsets/dialogues/ImportDialog.vue"; import {useQuasar} from "quasar"; -import {useRouter} from "vue-router"; const $q = useQuasar() -const router = useRouter() + +const emits = defineEmits(['showTab']) const showExportDialog = () => $q.dialog({component: ExportDialog, componentProps: {inSidePanel: true}}) const showImportDialog = () => $q.dialog({component: ImportDialog, componentProps: {inSidePanel: true}}) diff --git a/src/tabsets b/src/tabsets index 2920c557..67075a83 160000 --- a/src/tabsets +++ b/src/tabsets @@ -1 +1 @@ -Subproject commit 2920c557a3ce7ece528e16a1b0e8af7430d59717 +Subproject commit 67075a83e52f5b66995f4fd79208304f31d2692d diff --git a/src/ui b/src/ui index 4734cce5..fb7720a4 160000 --- a/src/ui +++ b/src/ui @@ -1 +1 @@ -Subproject commit 4734cce5f22f13ff4d6397dfc28f2c0c16a5030b +Subproject commit fb7720a4473343fbd0cd7882ebe6c0091fcf4e40