Skip to content

Commit 27ba9a9

Browse files
authored
Merge pull request #25 from Aetherinox/beta
build: v1.4.1 beta
2 parents 09200f3 + 1fbb2bb commit 27ba9a9

File tree

8 files changed

+208
-57
lines changed

8 files changed

+208
-57
lines changed

dist/main.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 41 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"@rollup/plugin-terser": "^0.4.4",
3232
"@rollup/plugin-typescript": "^8.2.1",
3333
"@types/node": "^14.14.37",
34+
"@types/semver": "^7.5.8",
3435
"obsidian": "^1.0.0",
3536
"rollup": "^2.32.1",
3637
"rollup-plugin-define": "^1.0.1",
@@ -44,6 +45,7 @@
4445
"@simonwep/pickr": "github:simonwep/pickr",
4546
"colortranslator": "^4.1.0",
4647
"front-matter": "^4.0.2",
47-
"nanoid": "^5.0"
48+
"nanoid": "^5.0",
49+
"semver": "^7.6.0"
4850
}
4951
}

src/lang/locale/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export default
1818
base_time_am: 'AM',
1919
base_time_pm: 'PM',
2020
base_debug_loading: 'Loading {0} v{1} [ {2} ]',
21+
base_debug_updater_1: '{0} Update Check',
22+
base_debug_updater_2: '{0} {1}',
2123
base_context_nofocus: 'Obsidian does not have focus, please open a file',
2224

2325
/*

src/main.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/*
22
Import
3+
4+
@note : semver has issues with rollup. do not import semver's entire package.
5+
import the methods you need individually, otherwise you'll receive circular dependencies error.
36
*/
47

58
import { Plugin, WorkspaceLeaf, Debouncer, debounce, TFile, Menu, MarkdownView, PluginManifest, Notice, requestUrl } from 'obsidian'
@@ -11,6 +14,8 @@ import { lng, PluginID } from 'src/lang/helpers'
1114
import { Github_GetGist, Github_CopyGist, HandleFrontmatter, Github_UpdateExistingGist } from 'src/backend/services/github'
1215
import { GistrAPI, GistrEditor } from "src/api/types"
1316
import ShowContextMenu from "src/menus/context"
17+
import lt from "semver/functions/lt";
18+
import gt from "semver/functions/gt";
1419

1520
/*
1621
Basic Declrations
@@ -129,7 +134,6 @@ export default class GistrPlugin extends Plugin
129134
console.debug( lng( "base_debug_loading", process.env.NAME, process.env.PLUGIN_VERSION, process.env.AUTHOR ) )
130135

131136
await this.loadSettings ( )
132-
this.versionCheck ( )
133137
this.addSettingTab ( new SettingsTab( this.app, this ) )
134138

135139
this.app.workspace.onLayoutReady( async ( ) =>
@@ -201,6 +205,14 @@ export default class GistrPlugin extends Plugin
201205
this.registerMarkdownCodeBlockProcessor ( this.settings.keyword, gistBackend.processor )
202206
this.registerEvent ( this.app.workspace.on( "editor-menu", this.GetContextMenu ) )
203207

208+
/*
209+
Version checking
210+
*/
211+
212+
if ( this.settings.ge_enable_updatenoti )
213+
{
214+
this.versionCheck( )
215+
}
204216
}
205217

206218
/*
@@ -343,10 +355,19 @@ export default class GistrPlugin extends Plugin
343355
Output notice to user on possible updates
344356
*/
345357

346-
if ( ver_running?.indexOf( "beta" ) !== -1 && ver_running !== ver_beta )
347-
new Notice( lng( "ver_update_beta" ), 0 )
348-
else if ( ver_running !== ver_stable )
349-
new Notice( lng( "ver_update_stable" ), 0 )
358+
console.debug( lng( "base_debug_updater_1", process.env.NAME ) )
359+
console.debug( lng( "base_debug_updater_2", "Current : ..... ", ver_running ) )
360+
console.debug( lng( "base_debug_updater_2", "Stable : ..... ", ver_stable ) )
361+
console.debug( lng( "base_debug_updater_2", "Beta : ..... ", ver_beta ) )
362+
363+
if ( gt( ver_beta, ver_stable ) && lt( ver_running, ver_beta ) )
364+
{
365+
new Notice( lng( "ver_update_beta" ), 0 )
366+
}
367+
else if ( lt( ver_beta, ver_stable ) && lt( ver_running, ver_stable ) )
368+
{
369+
new Notice( lng( "ver_update_stable" ), 0 )
370+
}
350371
}
351372

352373
}

tests/Gistr Demo/.obsidian/plugins/gistr/main.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Gistr Demo/.obsidian/plugins/gistr/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "gistr",
33
"name": "Gistr",
4-
"version": "1.4.0",
4+
"version": "1.4.1",
55
"minAppVersion": "1.0.0",
66
"description": "Integrate OpenGist and Github gist snippets in your notes.",
77
"author": "Aetherinox",

0 commit comments

Comments
 (0)