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: Post Webhook #4708

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

Conversation

Masterb1234
Copy link

@Masterb1234 Masterb1234 commented Nov 17, 2024

I am submitting a new Community Plugin

Repo URL

Link to my plugin: https://github.com/Masterb1234/obsidian-post-webhook/

Release Checklist

  • [ v] I have tested the plugin on
    • [ v] Windows
    • [ v] macOS
    • [ v] Linux
    • [ v] Android (if applicable)
    • [ v] iOS (if applicable)
  • [ v] My GitHub release contains all required files (as individual files, not just in the source.zip / source.tar.gz)
    • [v ] main.js
    • [v] manifest.json
    • styles.css (optional)
  • [ v] 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)
  • [v ] The id in my manifest.json matches the id in the community-plugins.json file.
  • [v ] My README.md describes the plugin's purpose and provides clear usage instructions.
  • [ v] I have read the developer policies at https://docs.obsidian.md/Developer+policies, and have assessed my plugins's adherence to these policies.
  • [v ] 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.
  • [v ] I have added a license in the LICENSE file.
  • [ v] 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

Hello!

I found the following issues in your plugin submission

Errors:

❌ Could not parse community-plugins.json, invalid JSON. Expected ',' or ']' after array element in JSON at position 518811


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.

Copy link

Hello!

I found the following issues in your plugin submission

Errors:

❌ Please don't use the word obsidian in the plugin ID. The ID is used for your plugin's folder so keeping it short and simple avoids clutter and helps with sorting.


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.

@github-actions github-actions bot changed the title Update community-plugins.json Add plugin: Post Webhook Nov 17, 2024
@ObsidianReviewBot
Copy link
Collaborator

Thank you for your submission, an automated scan of your plugin code's revealed the following issues:

Required

[1]:Please remove the main.js file from the repo and add it to your .gitignore. Compiled release files shouldn't get mixed with source code in your commits and should go to the releases files instead.


Do NOT open a new PR for re-validation.
Once you have pushed all of the required changes to your repo, the bot will update the labels on this PR within 6 hours.
If you think some of the required changes are incorrect, please comment with /skip and the reason why you think the results are incorrect.

@ObsidianReviewBot ObsidianReviewBot self-assigned this Nov 18, 2024
@ObsidianReviewBot ObsidianReviewBot added Changes requested Additional review required PR needs to be reviewed by another person, after the currently requested changes have been made Ready for review and removed Ready for review Changes requested Additional review required PR needs to be reviewed by another person, after the currently requested changes have been made labels Nov 18, 2024
@ObsidianReviewBot ObsidianReviewBot removed their assignment Nov 18, 2024
@ObsidianReviewBot
Copy link
Collaborator

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

@joethei
Copy link
Collaborator

joethei commented Nov 19, 2024

# Obsidian Post Webhook Plugin
Naming something "Obsidian xyz" is reserved for first party products we create, please change this header.

i.a.
I am not aware of a service called i.a., and it's also not a abbreviation I am aware of in english, but I am aware of one in german that would fit here.

webhook, webhook, webhook, webhook
Webhook is a name, and is capitalized.

containerEl.createEl('h2', {text: 'Post Webhook Settings'});
Don't add a top-level heading in the settings tab, such as "General", "Settings", or the name of your plugin.

const parsedYaml = YAML.parse(yamlContent);
use the parseYaml function from the Obsidian API instead.

static arrayBufferToBase64(buffer) {
There is already a function in the Obsidian API with the same name for this.

const response = await fetch(webhookUrl, {
Use the requestUrl function from the Obsidian API instead, it will handle some things like CORS automatically.

static parseYamlFrontmatter(content) {
This code can be replaced with basically this (I am simplifying here, there is no error handling for example):

const info = getFrontMatterInfo(content);
if (!info.exists) {
    return {
        frontmatter: {},
        content
    }
}
const frontmatter = parseYaml(info.frontmatter);
const content = content.slice(info.contentStart);
return {
    frontmatter,
    content
}

static async getAttachments(app, content, notePath) {
And this code should be convert to something like this:

	static async getAttachments(app, file) {
	const cache = app.metadataCache.getFileCache(file);
	if (!cache) {
	    //throw error
	}
	
	for (embed in cache.embeds) {
	    const link = this.app.metadataCache.getFirstLinkpathDest(embed.link);
	    file = this.app.vault.getFileByPath(link);
	    if (file) {
	        //process file
	    }
	}
	
	//same logic as above for `cache.links`
}

Note that this code requires you to increase your minAppVersion to 1.5.7

@joethei joethei added Changes requested Minor changes requested PR can be merged after some final changes have been requested and removed Ready for review labels Nov 19, 2024
Copy link

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: nancyel/obsidian-foldercanvas-plugin. 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.

@Masterb1234
Copy link
Author

Masterb1234 commented Nov 21, 2024

@joethei, I've implemented the changes you suggested (release v1.0.2). Please have a look when you have a chance.

Thank you for your helpful feedback!

Copy link

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: MichelNivard/Ridian. 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 ObsidianReviewBot added Ready for review Changes made and removed Changes requested Minor changes requested PR can be merged after some final changes have been requested labels Nov 21, 2024
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.

3 participants