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

Custom Badge Maker #236

Closed
Bashamega opened this issue Aug 1, 2024 · 24 comments · Fixed by #253
Closed

Custom Badge Maker #236

Bashamega opened this issue Aug 1, 2024 · 24 comments · Fixed by #253
Assignees
Labels

Comments

@Bashamega
Copy link
Owner

Hello:)

My idea is to enable users to create custom badges for there repos.

There will be an api like /api/badge/ and it will take prams to customize the badge. Then there will be a tool where you can generate the url and get a preview.

Copy link
Contributor

github-actions bot commented Aug 1, 2024

Hello! 👋 Thanks for opening this issue. We appreciate your feedback and will look into it as soon as possible. Feel free to add more details if necessary.

@mathewalexKerala
Copy link
Contributor

Hello:)

My idea is to enable users to create custom badges for there repos.

There will be an api like /api/badge/ and it will take prams to customize the badge. Then there will be a tool where you can generate the url and get a preview.

I want to work on this .

@mathewalexKerala
Copy link
Contributor

Hello:)
My idea is to enable users to create custom badges for there repos.
There will be an api like /api/badge/ and it will take prams to customize the badge. Then there will be a tool where you can generate the url and get a preview.

I want to work on this .

Hello:)

My idea is to enable users to create custom badges for there repos.

There will be an api like /api/badge/ and it will take prams to customize the badge. Then there will be a tool where you can generate the url and get a preview.

I using a third party api here , Is that okay?

@Bashamega
Copy link
Owner Author

Hello:)
My idea is to enable users to create custom badges for there repos.
There will be an api like /api/badge/ and it will take prams to customize the badge. Then there will be a tool where you can generate the url and get a preview.

I want to work on this .

Hello:)
My idea is to enable users to create custom badges for there repos.
There will be an api like /api/badge/ and it will take prams to customize the badge. Then there will be a tool where you can generate the url and get a preview.

I using a third party api here , Is that okay?

Yes, you will use an external library. I would recommend using this cool library: https://www.npmjs.com/package/badge-maker

@mathewalexKerala
Copy link
Contributor

mathewalexKerala commented Aug 5, 2024 via email

@mathewalexKerala
Copy link
Contributor

like the badgen.net

@Bashamega
Copy link
Owner Author

like the badgen.net

No, you will be building the api from scratch using next js

@mathewalexKerala
Copy link
Contributor

Is there any image storage for this project . I need server to store this images so that they can be used in the readme file

@mathewalexKerala
Copy link
Contributor

Screenshot 2024-08-07 004935
this is the current state . I need a place to store the image .

@Bashamega
Copy link
Owner Author

Is there any image storage for this project . I need server to store this images so that they can be used in the readme file

There is no server. It will be an api that you will build that will generate the badge

@Bashamega
Copy link
Owner Author

@mathewalexKerala
Copy link
Contributor

github doesn't allow

Include an SVG (hosted on GitHub) in MarkDown
🌐
stackoverflow.com
› questions › 13808020 › include-an-svg-hosted-on-github-in-markdown
The purpose of raw.github.com is to allow users to view the contents of a file, so for text based files this means (for certain content types) you can get the wrong headers and things break in the browser.

When this question was asked (in 2012) SVGs didn't work. Since then Github has implemented various improvements. Now (at least for SVG), the correct Content-Type headers are sent.

The easiest way to add SVG is to use the upload assets feature. To quote the manual:

You can upload assets like images by dragging and dropping, selecting from a file browser, or pasting. You can upload assets to issues, pull requests, comments, and .md files in your repository.

Since 2022, "images" also includes SVG:

Some comments regarding changes that happened along the way:

Github has implemented a feature which makes it possible for SVG's to be used with the Markdown image syntax. The SVG image will be sanitized and displayed with the correct HTTP header. Certain tags (like <script>) are removed. To view the sanitized SVG or to achieve this effect from other places (i.e. from markdown files not hosted in repos on http://github.com/) simply append ?sanitize=true to the SVG's raw URL.
As stated by AdamKatz in the comments, using a source other than github.io can introduce potentially privacy and security risks. See the answer by CiroSantilli and the answer by DavidChambers for more details.
The issue to resolve this was opened on Github on October 13th 2015 and was resolved on August 31th 2017
Support for SVG drag-and-drop file upload was announced January 21 2022
Examples
All of the ways stated below will work.

I copied the SVG image from the question to a repo on github in order to create the examples below

Linking to files using relative paths (Works, but obviously only on github.com / github.io)
Code

!Alt text

Result

See the working example on github.com.

Linking to RAW files
Code

!Alt text

Result

Linking to RAW files using ?sanitize=true
Code

!Alt text

Result

Linking to files hosted on github.io
Code

!Alt text

Result

Answer from Potherca on Stack Overflow

@mathewalexKerala
Copy link
Contributor

what I can do is , I can store the image in the public folder inside the Nextjs application

@Bashamega
Copy link
Owner Author

what I can do is , I can store the image in the public folder inside the Nextjs application

The image will not be hosted on github.

It will be generated in the api. and then we can embed it.
Like the repo rater badge here: https://github.com/EddieHubCommunity/RepoRater

We won't be storing anything

@mathewalexKerala
Copy link
Contributor

no it doesn't support the image in the base64 version , we need to store it somewhere like all the badge-makers do

@Bashamega
Copy link
Owner Author

no it doesn't support the image in the base64 version , we need to store it somewhere like all the badge-makers do

It won't be base64. it will be a url like this: https://repo-rater.eddiehub.org/rate?owner=EddieHubCommunity&name=RepoRater. This is an api not a base64.

If you feel this is to complicated i can help you build the api.

@mathewalexKerala
Copy link
Contributor

mathewalexKerala commented Aug 7, 2024 via email

@Bashamega
Copy link
Owner Author

Bashamega commented Aug 7, 2024

yeah , I got it , when I send a request to a file like this it should generate the image , right ? So that we can paste it to the readme.md . Unfortunately the github only support the rendering of image that are hosted somewhere .

On Wed, Aug 7, 2024 at 2:12 PM Adam Basha @.> wrote: no it doesn't support the image in the base64 version , we need to store it somewhere like all the badge-makers do It won't be base64. it will be a url like this: https://repo-rater.eddiehub.org/rate?owner=EddieHubCommunity&name=RepoRater. This is an api not a base64. If you feel this is to complicated i can help you build the api. — Reply to this email directly, view it on GitHub <#236 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/A32P4C3IA3YLJABHFYY3V5LZQHMYBAVCNFSM6AAAAABLZYS5TGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZSHE2DCMRYGE . You are receiving this because you were assigned.Message ID: @.>

No, GitHub allows it. And the Edddie hub community made it.
image

@mathewalexKerala
Copy link
Contributor

can you please comment the code that you pasted in the readme.md to view the badge .

@Bashamega
Copy link
Owner Author

can you please comment the code that you pasted in the readme.md to view the badge .

Here:

[![RepoRater](https://repo-rater.eddiehub.org/api/badge?owner=EddieHubCommunity&name=RepoRater)](https://repo-rater.eddiehub.org/rate?owner=EddieHubCommunity&name=RepoRater)

@mathewalexKerala
Copy link
Contributor

Yes, the badge markdown is structured this way because the badge image is hosted on the https://repo-rater.eddiehub.org server. The URL https://repo-rater.eddiehub.org/api/badge?owner=EddieHubCommunity&name=RepoRater is used to dynamically generate and retrieve the badge image. The markdown format:

markdown
Copy code
RepoRater
can be broken down as follows:

RepoRater: This part generates the badge image using the provided URL.
...: This part makes the badge clickable, linking to the https://repo-rater.eddiehub.org/rate?owner=EddieHubCommunity&name=RepoRater URL.
In summary, the badge markdown links to a dynamically generated badge image hosted on the repo-rater.eddiehub.org server and provides a clickable link to a specific rating page on the same server.

@Bashamega
Copy link
Owner Author

Yes, this is what we want

@mathewalexKerala
Copy link
Contributor

successfully created badge-maker feature
Screenshot 2024-08-07 195711

@Bashamega
Copy link
Owner Author

successfully created badge-maker feature Screenshot 2024-08-07 195711

Great. Please file a pr

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

Successfully merging a pull request may close this issue.

2 participants