pcislo / vscode-nuget-gallery

MIT License
64 stars 19 forks source link

Custom sources don't working #19

Closed EarsKilla closed 5 months ago

EarsKilla commented 4 years ago

Here is config item that i was added:

{"name": "nuget.emzi0767.com","url": "https://nuget.emzi0767.com/api/v3/index.json"}

I'm getting Error when trying to look for packages in this source.

Here is log from console.

[Embedded Page] Access to XMLHttpRequest at 'https://nuget.emzi0767.com/api/v3/index.json' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

As i can see, this server really don't response with any CORS header.
But maybe solutions from this issue can help you to fix this: https://github.com/electron/electron/issues/1990

If you need more information about my issue:

Version: 1.43.2
Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
Date: 2020-03-24T07:52:11.516Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.0.0-32-generic
pcislo commented 4 years ago

I'm afraid that right now there is no simple solution for that. More info: https://github.com/microsoft/vscode/issues/72900

EarsKilla commented 4 years ago

if fetch don't working inside webview...
what about local http server that proxify all requests and adding cors headers to response. I think it's not a good way but it can bypass this limitation.
or this solution won't work inside vs-code?

pcislo commented 4 years ago

I will think about proper solution for this problem. Local http server could solve this, but I'm not sure, if it won't add too much overhead to this simple extension.

Jyben commented 4 years ago

It is possible to add authentication for custom sources ? For exemple, on Github, you have to put your credentials to access Nuget packages.

pcislo commented 4 years ago

It is possible to add authentication for custom sources ? For exemple, on Github, you have to put your credentials to access Nuget packages.

Nuget Credentials provider is used to authenticate request. To use it, you need to provide path to the folder with the Credentials provider in extension settings. Not sure if it's compatible with Github.

Bomret commented 4 years ago

I have exactly this problem in my attempt to implement https://github.com/pcislo/vscode-nuget-gallery/issues/24. This is driving me nuts. If one comes up with an idea, please write it here 🙂

pcislo commented 4 years ago

To make it work, instead of sending request in webview, you can try passing the request object with url to the extension via command (the same way as for example list of projects is send right now) and then send back the request respone to the webview.

Bomret commented 4 years ago

I’m trying this currently. But this will mean a bit more work as functionality is shifted into the extension. I’ll prepare something and put up a PR as soon as I have it working.

Bomret commented 4 years ago

I have a PR ready that fixes this and #24 but have a problem with vue that I cannot figure out on my own. If you'd like to help out, take a look at #26

ammadj commented 4 years ago

Guys I have a similar query. My custom source has user/password as well. how is that going to work out with the current solution?

Bomret commented 4 years ago

I haven’t had time to investigate the one remaining issue with my PR. I’ll try to take a look at it ASAP.

devel0 commented 4 years ago

I got the same Error message if using this myget source:

{"name": "AvaloniaCI","url": "https://www.myget.org/F/avalonia-ci/api/v3/index.json"}
StefH commented 1 year ago

Any updates on this issue?