ajnart / homarr

Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr)
https://homarr.dev
MIT License
5.84k stars 269 forks source link

šŸ› Walkx icon repository not using updates files - API #1206

Closed ajnart closed 10 months ago

ajnart commented 1 year ago

Environment

Docker

Version

No response

Describe the problem

@walk icon repository has now SVG icons, he spent a lot of time on it and they donā€™t seem to appear in homarr. Iā€™m not sure why Iā€™ve tried to look at it in the code but couldnā€™t really figure how it works.

ill assign this to you @manuel-rw since you did the icon picker component and all the logic with that ;)

Logs

No response

Context

No response

Please tick the boxes

manuel-rw commented 1 year ago

Sure. I'll look into it. Thanks for assigning

manuel-rw commented 1 year ago

Ok, so this is what's going on:

The API route https://data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@master?structure=flat returns the following item in the flat file list:

{
        "name": "/png/alpine-linux.png",
        "hash": "F2lnsPbJo2gph4hwkNwnKRBhdMsJs1jPJ2SVt68zdwQ=",
        "size": 22073
},

However, this file does not exist on the CDN data endpoint: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/alpine-linux.png :

Couldn't find the requested file /png/alpine-linux.png in walkxcode/dashboard-icons.

Other files, like the following work on both endpoints:

I don't get it, why this is happening. I double checked that we request the correct branch, that there is no caching going on and that it's not my device / network being the traitor. @walkxcode can you maybe assist us on this issue?

walkxcode commented 1 year ago

https://data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@master?structure=flat > https://data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@main?structure=flat :)

This actually doesn't work?.. I'll look further into the issue.

ajnart commented 1 year ago

~https://data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@master?structure=flat > https://data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@main?structure=flat :)~

This actually doesn't work?.. I'll look further into the issue.

So thereā€™s no way of getting the up to date files ? šŸ’€

walkxcode commented 1 year ago

There is. I just read that jsDelivr switched to a system where anything after the @ will be the NPM version tag. Problem is... There is no NPM in my project :') I'm going to try some possible fixes, and otherwise I might have to find another CDN (old CDN will still work no problem).

ajnart commented 1 year ago

@walkxcode your main branch is called ā€œmainā€ not ā€œmasterā€ anymore. Maybe thatā€™s the issue with the jsdelivr?

walkxcode commented 1 year ago

No. I've tried.

walkxcode commented 1 year ago

~data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@master?structure=flat > data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@main?structure=flat :)~ This actually doesn't work?.. I'll look further into the issue.

So thereā€™s no way of getting the up to date files ? šŸ’€

Yeah, I don't think it's possible...

manuel-rw commented 1 year ago

Does master maybe reference the first ever recorded version of the branch but not updates afterwards? If that's the case, we would have to tag a specific version instead of using master / main (eg. a commit hash). We could retrieve the latest commit hash via API and then retrieve the contents of that specific revision. Kind of breaks image caching, but probably our best bet?

walkxcode commented 1 year ago

I think that's the case, but I don't know if commit hashes will work.

manuel-rw commented 1 year ago

They do. It's documented in the docs. However, we need to know the hashes in the first place...

It's also weird that this issue only seems to exist for your icon repo.The other work fine.

ajnart commented 1 year ago

They do. It's documented in the docs. However, we need to know the hashes in the first place...

It's also weird that this issue only seems to exist for your icon repo.The other work fine.

Why not just use main and use the latest one ? The only issue is that the branch got renamed and the CDN didnt pick it up to alias it to main instead of master. replacing it with main should work.

walkxcode commented 1 year ago

No. It does not work, as I already said above.

manuel-rw commented 1 year ago

I can confirm that main doesn't work either.

manuel-rw commented 1 year ago

This API endpoint is working for me:

https://data.jsdelivr.com/v1/packages/gh/walkxcode/dashboard-icons@118c204a1c84245c98ec316e1918f42277d68248?structure=flat

{
        "name": "/png/alpine.png", // <-- correct file name, that was updated recently, as an example
        "hash": "okx+Xqqc45mGtY1o3GgZzTU+HBSnTKF9ybnpj5O/Ypw=",
        "size": 18264
}
ajnart commented 1 year ago

We could try to email jsdelivr to ask them how to get the link to the latest resources, it might be a bug on their end or something we werenā€™t able to find about online

manuel-rw commented 1 year ago

Interestingly, JsDelivr seems to "know" no versions: image

manuel-rw commented 1 year ago

At least JsDelivr seems to know the project:

curl -X GET "https://data.jsdelivr.com/v1/stats/packages/gh/walkxcode/dashboard-icons?period=week" \
 -H "accept: application/json" \
{
  "hits": {
    "rank": 817,
    "typeRank": 273,
    "total": 2077449,
    "dates": {
      "2022-10-15": 311693,
      "2022-10-16": 334698,
      "2022-10-17": 283700,
      "2022-10-18": 266822,
      "2022-10-19": 263361,
      "2022-10-20": 319285,
      "2022-10-21": 297890
    },
    "prev": {
      "rank": 819,
      "typeRank": 269,
      "total": 2038555
    }
  },
  "bandwidth": {
    "rank": 1174,
    "typeRank": 608,
    "total": 33431191086,
    "dates": {
      "2022-10-15": 5148082281,
      "2022-10-16": 5449361001,
      "2022-10-17": 4642068503,
      "2022-10-18": 4460342994,
      "2022-10-19": 4497136347,
      "2022-10-20": 4590028290,
      "2022-10-21": 4644171670
    },
    "prev": {
      "rank": 1160,
      "typeRank": 607,
      "total": 34557768886
    }
  },
  "links": {
    "self": "https://data.jsdelivr.com/v1/stats/packages/gh/twbs/bootstrap?period=week",
    "versions": "https://data.jsdelivr.com/v1/stats/packages/gh/twbs/bootstrap/versions?period=week"
  }
}
ajnart commented 1 year ago

At least JsDelivr seems to know the project:

curl -X GET "https://data.jsdelivr.com/v1/stats/packages/gh/walkxcode/dashboard-icons?period=week" \
 -H "accept: application/json" \
{
  "hits": {
    "rank": 817,
    "typeRank": 273,
    "total": 2077449,
    "dates": {
      "2022-10-15": 311693,
      "2022-10-16": 334698,
      "2022-10-17": 283700,
      "2022-10-18": 266822,
      "2022-10-19": 263361,
      "2022-10-20": 319285,
      "2022-10-21": 297890
    },
    "prev": {
      "rank": 819,
      "typeRank": 269,
      "total": 2038555
    }
  },
  "bandwidth": {
    "rank": 1174,
    "typeRank": 608,
    "total": 33431191086,
    "dates": {
      "2022-10-15": 5148082281,
      "2022-10-16": 5449361001,
      "2022-10-17": 4642068503,
      "2022-10-18": 4460342994,
      "2022-10-19": 4497136347,
      "2022-10-20": 4590028290,
      "2022-10-21": 4644171670
    },
    "prev": {
      "rank": 1160,
      "typeRank": 607,
      "total": 34557768886
    }
  },
  "links": {
    "self": "https://data.jsdelivr.com/v1/stats/packages/gh/twbs/bootstrap?period=week",
    "versions": "https://data.jsdelivr.com/v1/stats/packages/gh/twbs/bootstrap/versions?period=week"
  }
}

But why are the dates so far in time ?

manuel-rw commented 1 year ago

According to https://github.com/jsdelivr/jsdelivr/issues/18417#issuecomment-1163078689 , it should update within 12 hours. I tried purging the cache using https://purge.jsdelivr.net/walkxcode/dashboard-icons@main, but that didn't change anything (or it takes longer to propagate to the CDN). https://github.com/video-dev/hls.js/issues/1664#issuecomment-380941077

https://stackoverflow.com/a/69151200

Maybe we need to wait now? šŸ¤”

Related to https://github.com/mavoweb/mavo/issues/603

ajnart commented 10 months ago

Is this still an issue ? Im not sure

walkxcode commented 10 months ago

Yes it is

walkxcode commented 10 months ago

https://api.github.com/repos/walkxcode/dashboard-icons/git/trees/main?recursive=true

ajnart commented 10 months ago

Fixed with #1520