fix docs.rs show features#209
Conversation
|
Thanks, @light4. I ever didn't aware the feature flags were broken. 😅 |
| local INDEX_MANAGER_FILES = ['core/storage.js', 'index-manager.js']; | ||
| json.addIcons(icons()) | ||
| .addPermissions(['storage', 'unlimitedStorage']) | ||
| .addPermissions(['storage', 'unlimitedStorage', 'webRequest', 'webRequestBlocking', '*://crates.io/api/v1/crates/*']) |
There was a problem hiding this comment.
We use Manifest V3 already, after loading into Chrome, it said: webRequestBlocking' requires manifest version of 2 or lower. Actually, I think we can remove those permissions.
| let cargoTomUrl = `https://docs.rs/crate/${rawCrateName}/${crateVersion}/source/Cargo.toml`; | ||
| let response = await fetch(cargoTomUrl); | ||
| let content = await response.text(); | ||
| let crateAPIURL = `https://crates.io/api/v1/crates/${rawCrateName}/${crateVersion}`; |
There was a problem hiding this comment.
The crateVersion could be latest which is invalid for the API of crates.io. For example: https://crates.io/api/v1/crates/tokio/latest
We should ensure the enhanceFeatureFlagsMenu() function is called after crateVersion = parseCrateVersionFromDOM(), see line 97.
|
Also, don't forget to remove |
|
Updated, should I rebase to one commit? |
| local INDEX_MANAGER_FILES = ['core/storage.js', 'index-manager.js']; | ||
| json.addIcons(icons()) | ||
| .addPermissions(['storage', 'unlimitedStorage']) | ||
| .addPermissions(['storage', 'unlimitedStorage', '*://crates.io/api/v1/crates/*']) |
There was a problem hiding this comment.
We can remove *://crates.io/api/v1/crates/* too.
Permission '://crates.io/api/v1/crates/' is unknown or URL pattern is malformed.
There was a problem hiding this comment.
Without this, Firefox says TypeError: NetworkError when attempting to fetch resource.
There was a problem hiding this comment.
| crateVersion = parseCrateVersionFromDOM(); | ||
| } | ||
| // Use rawCrateName to fetch the Cargo.toml, otherwise will get 404. | ||
| let cargoTomUrl = `https://docs.rs/crate/${rawCrateName}/${crateVersion}/source/Cargo.toml`; |
There was a problem hiding this comment.
I'll squash it into one commit. |
|
I'll merge it. We can fix the permission issue in the next PR. |

use crates.io to get deps info
I don't remember how it looks like before, any advice?