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

Add plugin: NetClip #5088

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Add plugin: NetClip #5088

wants to merge 9 commits into from

Conversation

Elhary
Copy link
Contributor

@Elhary Elhary commented Jan 7, 2025

I am submitting a new Community Plugin

Repo URL

Link to my plugin: https://github.com/Elhary/Obsidian-NetClip

Release Checklist

  •  I have tested the plugin on
    •  Windows
    •  macOS
    •  Linux
    •  Android (if applicable)
    •  iOS (if applicable)
  •  My GitHub release contains all required files (as individual files, not just in the source.zip / source.tar.gz)
    •  main.js
    •  manifest.json
    •  styles.css (optional)
  •  GitHub release name matches the exact version number specified in my manifest.json (Note: Use the exact version number, don't include a prefix v)
  •  The id in my manifest.json matches the id in the community-plugins.json file.
  •  My README.md describes the plugin's purpose and provides clear usage instructions.
  •  I have read the developer policies at https://docs.obsidian.md/Developer+policies, and have assessed my plugins's adherence to these policies.
  •  I have read the tips in https://docs.obsidian.md/Plugins/Releasing/Plugin+guidelines and have self-reviewed my plugin to avoid these common pitfalls.
  •  I have added a license in the LICENSE file.
  •  My project respects and is compatible with the original license of any code from other plugins that I'm using.
    I have given proper attribution to these other projects in my README.md.

Copy link

github-actions bot commented Jan 7, 2025

Hello!

I found the following issues in your plugin submission

Errors:

❌ The newly added entry is not at the end, or you are submitting on someone else's behalf. The last plugin in the list is: 0011000000110010/obsidian-manager. If you are submitting from a GitHub org, you need to be a public member of the org.


This check was done automatically. Do NOT open a new PR for re-validation. Instead, to trigger this check again, make a change to your PR and wait a few minutes, or close and re-open it.

@ObsidianReviewBot
Copy link
Collaborator

The automated review has not found any issues with your code, ready for manual review.

@Elhary Elhary closed this Jan 9, 2025
@Elhary Elhary reopened this Jan 20, 2025
@ObsidianReviewBot
Copy link
Collaborator

The automated review has not found any issues with your code, ready for manual review.

@Zachatoo
Copy link
Collaborator

const mainFolder = this.app.vault.getAbstractFileByPath(this.settings.defaultFolderName);, const categoryFolder = this.app.vault.getAbstractFileByPath(categoryPath);, const folderExists = this.app.vault.getAbstractFileByPath(folderPath);, const existingFolder = this.app.vault.getAbstractFileByPath(folderPath);, const oldFolder = this.app.vault.getAbstractFileByPath(oldPath);, const newFolder = this.app.vault.getAbstractFileByPath(newPath);, const categoryFolder = this.app.vault.getAbstractFileByPath(oldCategoryPath);
getAbstractFileByPath can return a TFile or a TFolder. Either use getFolderByPath and update your minAppVersion to the latest public build number, or add checks to validate that the result is a TFolder.

checkCallback: (checking) => {
This doesn't need to be a checkCallback since you're always returning true when checking.

this.ClipperView = new clipperHomeView(leaf, this);
Do not store a reference to your plugin's custom view(s). This might lead to memory leaks or a stale/bad reference. Instead use workspace.getLeavesOfType(YOUR_VIEW_HERE) to get all the current leaves containing your custom view.

.setDesc('create new category folder')
Use sentence case in UI

new Setting(containerEl).setName('WebView settings').setHeading(), new Setting(containerEl).setName('Clipper settings').setHeading()
Avoid "settings" in settings headings

const view = leaf.view as WorkspaceLeafWebView;, const view = leaf.view as WorkspaceLeafWebView;
As of Obsidian v1.7.2, when Obsidian loads, all views are created as instances of DeferredView. Once a view is visible on screen (i.e. the tab is selected within its containing tab group), the leaf will re-render and the view will be switched out to the correct View instance. Please see understanding deferred views for how to safely access your custom view.

const content = await this.app.vault.read(file);
Prefer to use Vault.cachedRead() over Vault.read() when you only want to display content to the user

const imageUrl = thumbnailMatch ? thumbnailMatch[1] : 'https://cdn.pixabay.com/photo/2023/12/14/06/45/chicken-8448262_1280.jpg'; // Use a default image if no thumbnail is found
Prefer to not use remote resources. Instead bundle the remote resources with your plugin.

@Zachatoo Zachatoo self-assigned this Jan 22, 2025
@Zachatoo Zachatoo added Changes requested Additional review required PR needs to be reviewed by another person, after the currently requested changes have been made and removed Ready for review labels Jan 22, 2025
@Elhary Elhary closed this Jan 27, 2025
@Elhary Elhary reopened this Jan 27, 2025
@Elhary
Copy link
Contributor Author

Elhary commented Jan 29, 2025

const mainFolder = this.app.vault.getAbstractFileByPath(this.settings.defaultFolderName);, const categoryFolder = this.app.vault.getAbstractFileByPath(categoryPath);, const folderExists = this.app.vault.getAbstractFileByPath(folderPath);, const existingFolder = this.app.vault.getAbstractFileByPath(folderPath);, const oldFolder = this.app.vault.getAbstractFileByPath(oldPath);, const newFolder = this.app.vault.getAbstractFileByPath(newPath);, const categoryFolder = this.app.vault.getAbstractFileByPath(oldCategoryPath); getAbstractFileByPath can return a TFile or a TFolder. Either use getFolderByPath and update your minAppVersion to the latest public build number, or add checks to validate that the result is a TFolder.

checkCallback: (checking) => { This doesn't need to be a checkCallback since you're always returning true when checking.

this.ClipperView = new clipperHomeView(leaf, this); Do not store a reference to your plugin's custom view(s). This might lead to memory leaks or a stale/bad reference. Instead use workspace.getLeavesOfType(YOUR_VIEW_HERE) to get all the current leaves containing your custom view.

.setDesc('create new category folder') Use sentence case in UI

new Setting(containerEl).setName('WebView settings').setHeading(), new Setting(containerEl).setName('Clipper settings').setHeading() Avoid "settings" in settings headings

const view = leaf.view as WorkspaceLeafWebView;, const view = leaf.view as WorkspaceLeafWebView; As of Obsidian v1.7.2, when Obsidian loads, all views are created as instances of DeferredView. Once a view is visible on screen (i.e. the tab is selected within its containing tab group), the leaf will re-render and the view will be switched out to the correct View instance. Please see understanding deferred views for how to safely access your custom view.

const content = await this.app.vault.read(file); Prefer to use Vault.cachedRead() over Vault.read() when you only want to display content to the user

const imageUrl = thumbnailMatch ? thumbnailMatch[1] : 'https://cdn.pixabay.com/photo/2023/12/14/06/45/chicken-8448262_1280.jpg'; // Use a default image if no thumbnail is found Prefer to not use remote resources. Instead bundle the remote resources with your plugin.

@Zachatoo updated as requested.

@Elhary
Copy link
Contributor Author

Elhary commented Jan 31, 2025

I've resolved all the issues. Please review the changes

@Elhary Elhary closed this Jan 31, 2025
@Elhary Elhary reopened this Jan 31, 2025
@Zachatoo
Copy link
Collaborator

Zachatoo commented Feb 1, 2025

You have not made all the requested changes. Please re-review the changes I have requested. The bot should move this forward once all requested changes have been made. Here are the ones I noticed you missed.

There is still one case where you're using getAbstractFileByPath and not correctly validating if it is a folder or a file.

You are still storing a reference to your plugin's custom view.

There are some places where you are not safely accessing your custom views.

@Elhary Elhary closed this Feb 2, 2025
@Elhary Elhary reopened this Feb 2, 2025
@Elhary
Copy link
Contributor Author

Elhary commented Feb 2, 2025

Thank you for the review, @Zachatoo. I think I've made the changes now.

@ObsidianReviewBot ObsidianReviewBot added Ready for review and removed Changes requested Additional review required PR needs to be reviewed by another person, after the currently requested changes have been made labels Feb 2, 2025
@ObsidianReviewBot ObsidianReviewBot removed their assignment Feb 2, 2025
@ObsidianReviewBot
Copy link
Collaborator

Changes requested by bot have been made, ready for additional review by human.

@ObsidianReviewBot
Copy link
Collaborator

Changes requested by Zachatoo have been made, assigning additional human for additional review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants