Closed arthurfiorette closed 2 years ago
Hi, the idea is great and I am sure lots of people would use it. However I think we should ask broskins if we can use it, for ethical and technical reasons. I think it's only fair to them since they provide this service which they developed and host, they should be asked whether they can/want to handle the additional load. From a technical perspective they could just restrict the usage if they wanted to with CORS, it would be unfortunate to spend time implementing it for them shut us out. Some technical insights that might be useful if we add it or you make an extension of your own:
Do you want me to try to contact someone at broskins?
The socket.io 2.0 version can also be installed via NPM, so it would be shipped in the extension bundle. As for broskins, I support this idea and probably many others. I think it's worth trying to contact them first.
I don't know the requirements of an extension and its manifest.json, but as I understand this would be added as an optional feature that is disabled and can only be enabled after the user goes to the panel and accepts the required permission?
I contacted them through their website content form, I will post their response here. As an optional permission the user would have to go to the extension settings, enable the feature (this is when the permission grant popip would appear). If the accept the additional permission then the extension would have access to the broskins domain and to this feature.
Got any response?
Nope, unfortunately no.
How about just adding a button to generate the code, but without a link to get into your servers, I'd love to see this feature ASAP.
Can you elaborate on what you are proposing here? I just tweeted about this, hopefuly someone can get us into contact with them: https://twitter.com/gergelyszabo94/status/1458425806053588997
I'm a little busy rn, but the first few paragraphs explain what I'm proposing.
This is the reply that I got: "Hey, yes of course you can use my server-side generation (!gen), but can you take the inspesct api from https://api.csgofloat.com (https://github.com/csgofloat/inspect) ?"
We already use the csgofloat api, so that does not sound like an issue but I will get into the details tomorrow.
Great! i thought their api data was internal, not a proxy for csgofloat api.
@ArthurFiorette I started working on this, hopefully I will have something concrete to show for by tomorrow.
If you need help, I'm here.
@arthurfiorette the first version for inventories is available now. I had to change your generation logic a bit because it mishandled stickered items where for example a single sticker was on the weapon and the sticker was not on the first slot.
Give it a try and let me know what you think!
@arthurfiorette the first version for inventories is available now. I had to change your generation logic a bit because it mishandled stickered items where for example a single sticker was on the weapon and the sticker was not on the first slot.
Give it a try and let me know what you think!
Right! have you published any kind of development release or will i have to compile it myself?
@arthurfiorette I don't really do dev builds, you can try it following these instructions: https://github.com/gergelyszabo94/csgo-trader-extension/tree/master/extension#development
Sorry for the delay, I had some "free" time just now. After almost an hour trying to compile node-sass on my freshly formatted machine, I managed to build and test it.
It gets stuck in this:
Apparently no console errors and no network requests
@arthurfiorette What browser do you use? Float values load otherwise?
I'm using brave, -> chromium.
Float shows that even if the skin is FT.
I think the issue is that CSGOFloat checks the origin and if it is not whitelisted it rejects the requests. If you use Chrome then you should get the same id as the one on the webstore and the requests go through.
I am finishing up the same feature in trade offers atm btw.
Tried on MS Edge, same thing. For some reason, I could have built the project the wrong way??
I think the issue is that CSGOFloat checks the origin and if it is not whitelisted it rejects the requests.
There is no requests being made.
Hmm, with store extensions everything is fine, on the extensions error page I found these:
Access to fetch at 'https://api.csgofloat.com/?url=steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198850668121A23940345439D14763996828646874370' from origin 'chrome-extension://dgcjfnnlegeodpcgieldcndpkonjcfol' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Can you just simply try in Google Chrome?
I asked the csgofloat guys to whitelist the Edge ID but I don't think they have done it.
So floats only load in Chrome and FF but Chrome is better for development.
Figured it out. IDK if there's a better way to add local browser extensions. Because the browser was blocking external requests because CORS.
Things I noticed (in the local extension)
the origin of the request was the extension ID. (I don't know if the store's extension is like this) This line was being blocked by colors.
So, when I used cors-anywhere to get around the cors problem (just for now), the request worked.
const getRequest = new Request('https://cors-anywhere.herokuapp.com/' + `https://api.csgofloat.com/?url=${inspectLink}${price}`);
Since in the store's extension doesn't happen the cors problem, I think it's some limitation that I have to configure locally and I don't know where.
The result with cors bypassed:
Now, for the sake of design, I think it would be nicer when you click the inspect button, your text becomes (temporarily) copied to the clipboard
or server url
and the inspect command appears at the bottom. But that doesn't matter too much.
Something like that (Once already generated):
The gen code (for that image) is inside a <code>
tag with 0.8rem of font-size :)
But, it's my opinion, of course.
CSGOFloat uses CORS to prevent abuse by other extensions. The Chrome Webstore version's ID is whitelisted along with any Firefox extension id. I think if you install the Chrome Webstore verison and load it in dev mode too in Chrome then they are merged and have the Webstore ID in dev mode. I think that is my setup for development. Sorry for not explaining it in advance, I thought you would just use Chrome and it would work.
Your UI idea looks nice indeed, feel free to make a PR. I will add it this feature to the market listings tomorrow and might take a second look at the design.
The logic is all there now, I decided not to work on the design so I am closing the issue now, feel free to reopen or send a PR if you end up working on it.
Happy to help! I'm a lot busy these days, so the design will have to wait. But that doesn't matter, what matter is that it is working.
Add an inspect side button for an in-game inspect where !gen code from the broskins server is generated and you are connected to their server. I was thinking about doing an extension of my own for that, but I think here would be better.
Example while viewing a steam inventory:
When clicking at the inspect on server button, should be open
steam://connect/51.75.73.121:27015
to automatically connect you to the server and copy the code to clipboard (showing a popup telling that).I'm also a programmer and i can create a PR to do that, if you mind to show where i could begin.
How to do
While i was testing if it can be possible, i reversed engineered this page and found how to generate the commands.
https://gist.github.com/ArthurFiorette/146c9b079b5586df2d4ed57ed81e1d51.
Simple explanation
To get all the necessary information, we need to connect to their socket v2 api.
After connected, we can emit a `lookup* event with the inspect link.
Then is just wait for the response:
And you can use this code that i created to generate the gen command
And joining everything you'll end with something like that: