diff --git a/src/modals/PluginDataModal.ts b/src/modals/PluginDataModal.ts index e5845e1..5ff745b 100644 --- a/src/modals/PluginDataModal.ts +++ b/src/modals/PluginDataModal.ts @@ -28,7 +28,7 @@ export class PluginDataModal extends Modal { .addText(text => text .setPlaceholder('Username') .onChange(value => { - // Assign value of this Setting an save it + // Assign value of this Setting username = value; })); @@ -38,7 +38,7 @@ export class PluginDataModal extends Modal { .addText(text => text .setPlaceholder('Repository') .onChange(value => { - // Assign value of this Setting an save it + // Assign value of this Setting repository = value; })); @@ -46,24 +46,29 @@ export class PluginDataModal extends Modal { .addButton(button => button .setButtonText('Save') .onClick(async () => { + // Check username exist and is not empty if (!username || username === '') { new Notice('Github username cannot be empty!'); return; } + // Check repository exist and is not empty if (!repository || repository === '') { new Notice('Github repository cannot be empty!'); return; } + // Check the repo matches the pattern const repo = `${username}/${repository}`; if (!repositoryRegEx.test(repo)) { new Notice('Github / do not match the pattern!'); return; } + // Check a manifest could be fetched const manifest = await fetchManifest(repo); if (!manifest) { new Notice('Github repository could not be found!'); return; } + // check there are releases for the repo const releases = await fetchReleases(repo); if (!releases || releases.length <= 0) { new Notice('No releases found for this plugin. May it do not have any.'); diff --git a/src/modals/PluginTroubleshootingModal.ts b/src/modals/PluginTroubleshootingModal.ts index a3a569a..c1b07e1 100644 --- a/src/modals/PluginTroubleshootingModal.ts +++ b/src/modals/PluginTroubleshootingModal.ts @@ -26,6 +26,7 @@ export class PluginTroubleshootingModal extends Modal { let releases: Partial[] | undefined; let hasReleases = false; + // Debonce text input const updateRepo = debounce(() => { this.pluginInfo.repo = `${username}/${repository}`; this.update(); diff --git a/versions.json b/versions.json index 9e26dfe..2e60e92 100644 --- a/versions.json +++ b/versions.json @@ -1 +1,3 @@ -{} \ No newline at end of file +{ + "0.0.0": "0.15.0" +} \ No newline at end of file