Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Comments #5

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/modals/PluginDataModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}));

Expand All @@ -38,32 +38,37 @@ 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;
}));

new Setting(contentEl)
.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 <username>/<repository> 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.');
Expand Down
1 change: 1 addition & 0 deletions src/modals/PluginTroubleshootingModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class PluginTroubleshootingModal extends Modal {
let releases: Partial<Release>[] | undefined;
let hasReleases = false;

// Debonce text input
const updateRepo = debounce(() => {
this.pluginInfo.repo = `${username}/${repository}`;
this.update();
Expand Down
4 changes: 3 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"0.0.0": "0.15.0"
}
Loading