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 Winget in Third Party Packages #207

Merged
merged 6 commits into from
Jun 18, 2022
Merged

Add Winget in Third Party Packages #207

merged 6 commits into from
Jun 18, 2022

Conversation

sitiom
Copy link
Contributor

@sitiom sitiom commented Jun 17, 2022

Description

Not too sure about the badge, shields.io does not support Winget yet (badges/shields#5548), so I just used the Repology badge. This would make the styling inconsistent from the other ones, not sure how to solve that.

Screenshot

image

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring/documentation-blocks for new or existing methods/components

Copy link
Member

@ReenigneArcher ReenigneArcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some issues with this...

  1. Is not in alphabetical order.
  2. It's ugly.

Advanced example

.. image:: https://img.shields.io/static/v1?style=for-the-badge&label=Feature+Upvote&message=Request&color=important&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIKSURBVDhPnZM9aFNRFIDPeWkFlw5uEW3TqojiYqIO71GHSPOGdlNxEgRBEXGTIhkK/g6hKHQQzFYquOggRfFlKAjmKcLLoqIOXRQMqDh0kSrN9Tt58RkERXvg45577/m9Pyq/SSkIdzjnTqEeglHowDI0RLTeiqN36JlkAXAcwPES6nkYgJfwBsxmD+yEVbjIUo1AFjgNgHMO5zuoR+Ghqk4nzeiV7f0UbErYXEc9CLdU9EwSRy5nm/mt26oM5+AGMU8Q/WPRDz3WZ8HfvGXscRI3PuSHt9/GZgROQrv9fjlRIueJbD0+JfMEmTvmLOLqPUOTGhkvWMaiXxlk/gwK2I96OB9nspHM1a5zUDHnm6yZs+sx7cRdYZRW3PjOMAOb8D2CsZSBk3XP9wehYj7H/DTMw2uI4T5UqYwDRFS5EVmBsgUowFsiuzWRcfSzQK9qFdhJf6PUY4wPSDJDy7tbzciqsLbHLEAm6iTGeErVs4MkXiq0tkrWw+xNdtyaVZWJciiPGHdBwarorvaEvRcMn1i3NjMp+eEgZ/IZddEqWIJhYh2wzX8RslQYhmDJ43oWUL6yfG1fYNf3dykG4QZsL6N+oaW7HnfbZnIVyh0ns5Td/z/uwWKqps9dXPd97AW79pX0KfuVHGX931P2eMpPIreuz6QqtaTZ+PWZ+oVAf/zOVFansr7vLPIDh9/cyYgVQMYAAAAASUVORK5CYII=
   :alt: Feature Upvote
   :target: https://retroarcher.github.io/featurereq/

Markdown Preview:
Feature Upvote

You need to encode the image to base 64 (google how to do this, there are online converters). Use this image, from their github: https://avatars.githubusercontent.com/u/6154722?s=200&v=4

You can change the size of the image in the url by changing the 200. The encoded image must be below a certain size for it to render properly.

Alternatively use the named logo microsoft

I'd rather the styling match than it show the version number, although you can also do a query to get the version number.

https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/s/SunshineStream/Sunshine

Here are examples using the json query: https://github.com/SunshineStream/Sunshine/blob/master/docs/source/contributing/localization.rst

So let's take what we know and make it into a proper shield.

Winget Version

.. image:: https://img.shields.io/badge/dynamic/json?color=blue&label=Winget&style=for-the-badge&query=0.name&url=https%3A%2F%2Fapi.github.com%2Frepos%2Fmicrosoft%2Fwinget-pkgs%2Fcontents%2Fmanifests%2Fs%2FSunshineStream%2FSunshine&logo=microsoft
   :alt: Winget Version
   :target: https://github.com/microsoft/winget-pkgs/tree/master/manifests/s/SunshineStream/Sunshine

@ReenigneArcher
Copy link
Member

While you're at it... how about adding something in the docs about GitHub etiquette? You can link people to this article.

https://developer.mozilla.org/en-US/docs/MDN/Contribute/Open_source_etiquette

@sitiom
Copy link
Contributor Author

sitiom commented Jun 17, 2022

I'd rather the styling match than it show the version number, although you can also do a query to get the version number.

api.github.com/repos/microsoft/winget-pkgs/contents/manifests/s/SunshineStream/Sunshine

The problem with using this is that the results are alphabetically arranged. Let's take another this example (https://api.github.com/repos/microsoft/winget-pkgs/contents/manifests/s/Sandboxie/Plus):
image
Not sure how you can query the latest version from that list.

While you're at it... how about adding something in the docs about GitHub etiquette? You can link people to this article.

developer.mozilla.org/en-US/docs/MDN/Contribute/Open_source_etiquette

How about adding this in a separate PR? I don't like to jam-pack unrelated changes in a single PR.

@ReenigneArcher
Copy link
Member

Any idea where is the built in search querying data from? https://docs.microsoft.com/en-us/windows/package-manager/winget/search

I don't like to jam-pack unrelated changes in a single PR.

This is hardly a "jam-packed" pr, and it's certainly related. This is just a documentation update, and quite a small one.

@sitiom
Copy link
Contributor Author

sitiom commented Jun 18, 2022

Any idea where is the built in search querying data from? docs.microsoft.com/en-us/windows/package-manager/winget/search

A database inside source.msix in https://cdn.winget.microsoft.com/cache/source.msix. They are working on a REST API, but it is still a work in progress.

I finally got it however, I just had to scrape from Repology.

URL: https://repology.org/project/sunshine/versions

Query:
//tr[@id='winget']/td[3]/span/a
Packages are conveniently sorted by version number, so this always gets the latest packaged version.

Final result:
Winget Version

Added v prefix because the result does not return one.

.. image:: https://img.shields.io/badge/dynamic/xml?color=blue&label=Winget&style=for-the-badge&prefix=v&query=%2F%2Ftr%5B%40id%3D%27winget%27%5D%2Ftd%5B3%5D%2Fspan%2Fa&url=https%3A%2F%2Frepology.org%2Fproject%2Fsunshine%2Fversions&logo=microsoft
   :alt: Winget Version
   :target: https://github.com/microsoft/winget-pkgs/tree/master/manifests/s/SunshineStream/Sunshine

Example with Firefox (properly returning the latest version):
Winget Version

@ReenigneArcher ReenigneArcher merged commit e45452b into LizardByte:nightly Jun 18, 2022
@sitiom sitiom deleted the patch-1 branch June 18, 2022 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants