JustArchiNET / ArchiSteamFarm

C# application with primary purpose of farming Steam cards from multiple accounts simultaneously.
Apache License 2.0
10.92k stars 1.04k forks source link

IPC GUI todo #732

Closed JustArchi closed 6 years ago

JustArchi commented 6 years ago

I'm opening a single issue for this one, as most tasks won't be coded by me.

IPC GUI source code is available here. Feel free to make appropriate modifications and send a PR.

Best practice

Bugs

Suggestions

JourneyOver commented 6 years ago

Mark 2 is still an issue but I guess it's because the bots thing is currently not fully implemented so it'll always show 0 / 0 / 0 on bots until it's fully implemented?

Mark 5 is fixed, no more errors in the chrome dev console window.

See you moved the log update function to the log.html, had me confused at first on why I couldn't find it in app.js file to change the url bit to how I have things laid out for ASF.

JourneyOver commented 6 years ago

mm still shows 0 / 0 / 0 for me, have tried with and without "CurrentCulture": null in my ASF.json file. Maybe it's due to the whole running only 1 account thing? unless I'm reading the whole bots thing completely wrong on what the green/orange/red stat things are for..

Screenshot ![chrome_01-27-2018_08-11-16](https://user-images.githubusercontent.com/13910285/35472710-cc8635f6-0339-11e8-870e-51c6b5a11a0c.png)


Edit: realtime feature in Log doesn't seem to work either, have to either press the green button (even though it's already on) or refresh the page for the page to fetch the log and update it. tested with updated log and waiting a full minute without it doing anything.

JustArchi commented 6 years ago

@MrBurrBurr You shouldn't use any ASF strings being used for display purposes - this includes e.g. parsing log.txt or commands output. It's not only because your GUI won't work in any ASF language other than english, but also because original english strings can change anytime as well, together with their structure. That's what API calls are for, and that's what my first 2 points are for.

Do you think it would be a good idea to add some kind of IPC Api where I can read the current state of bots? Or is there already a way for it I didnt see?

That's what /Api/Bot/{Bot} is for.

JustArchi commented 6 years ago

Version yes - there is no endpoint for that yet. I'll add it once I get some time. You can open a separate issue so I won't forget.

JourneyOver commented 6 years ago

@MrBurrBurr Still shows 0 / 0 / 0 for bot status, as for the log function it now looks to be working on it updating the log without intervention.

JourneyOver commented 6 years ago

like in the picture I put above, in the normal status page I see

Bot is not idling anything.
There are 1/1 bots running, with total of 0 games (0 cards) left to idle

which indicated that the status is being seen somewhat, but the green/orange/red status things on the "bots" tab just continue to show as the 0 / 0 / 0

JourneyOver commented 6 years ago

Yes I have values for KeepRunning, SteamID and TimeRemaining when I do the API call.

{"Message":"OK","Result":[{"BotName":"Main","CardsFarmer":{"CurrentGamesFarming":[],"GamesToFarm":[],"TimeRemaining":"00:00:00","Paused":false},"AccountFlags":540805,"SteamID":76561198037630370,"BotConfig":{"AcceptGifts":true,"AutoSteamSaleEvent":false,"CustomGamePlayedWhileFarming":null,"CustomGamePlayedWhileIdle":null,"DismissInventoryNotifications":true,"Enabled":true,"FarmingOrder":9,"FarmOffline":true,"GamesPlayedWhileIdle":[],"HandleOfflineMessages":false,"HoursUntilCardDrops":0,"IdleRefundableGames":true,"IsBotAccount":false,"LootableTypes":[1,3,5],"MatchableTypes":[5],"PasswordFormat":0,"Paused":false,"RedeemingPreferences":0,"SendOnFarmingFinished":false,"SendTradePeriod":0,"ShutdownOnFarmingFinished":false,"SteamTradeToken":null,"SteamUserPermissions":{"76561198037630370":3},"TradingPreferences":1,"UseLoginKeys":true,"SteamMasterClanID":0},"KeepRunning":true}],"Success":true}

Don't think there is anything bad in that to throw it on here..but if there is let me know so I can take it down..though I'll have to have @JustArchi delete the #github-updates notification on discord that corresponds with this message..

JustArchi commented 6 years ago

There is no sensitive info in any API call, if by sensitive we understand passwords or other login details.

JourneyOver commented 6 years ago

There is no sensitive info in any API call, if by sensitive we understand passwords or other login details.

Good to know! ^^ kinda figured that was the case as I didn't see any login details in the api call anyways

JustArchi commented 6 years ago

/Api/Bot/ASF already exists.

JourneyOver commented 6 years ago

@JustArchi you can remove

If running with only 1 account, the bots dropdown is completely blank. Along with 1, if running only 1 account the bot status buttons end up just showing 0 / 0 / 0 and the bots page is blank other than the content-header bit. Dashboard is blank except for content-header (dunno if this is supposed to be blank or not exactly?) both Config Generator and Config Manager are blank pages except for content-header (dunno if these are currently supposed to be blank or not exactly?). below screenshot is being thrown on every single page in chrome console constantly other than the logs page. Screenshot Layout Options do not seem to stay at all when moving between pages.

for the most part as everything has been squashed in #733 for all that other than the layout options bug. You can replace it with

if you want, as they are things that should/will be added over time.

JustArchi commented 6 years ago

What stats?

JustArchi commented 6 years ago

That's not Bot info, that requires another API endpoint.

JustArchi commented 6 years ago

IPC GUI should not do any parsing of output of /Api/Command

JustArchi commented 6 years ago

No, you should use /Api/Bot/ASF.

JustArchi commented 6 years ago

Everything that !status gives is already available through various pieces of /Api/Bot/ASF - redundancy is unwanted, not needed and would degrade API quality. Instead, analyze more deeply what data you have, and make use of it.

JustArchi commented 6 years ago

You're designing the web UI and what exactly it provides. You don't have to use all data that API provides, you can cherry-pick the information you're interested in. Personally I see no reason for doing that - I'd instead add basic overview of active bots in the panel, like now, and provide more info (e.g. about currently farmed game/games, and remaining ones, even with fancy banners or anything) when user asks about that, e.g. on-hover as a popup, or some detailed bot info.

In any case, that's your choice.

JourneyOver commented 6 years ago

like the little tweaks you did to our todo list @MrBurrBurr :p btw you know you can checkmark them on there, instead of deleting them when they are done lol xD

Luckz commented 6 years ago

For main account usage, a one-click 2faok button would be desirable. I'll probably add a separate !r input box of some form for myself, maybe as a multi-line textarea.

As an option, people might not want the #commandReply and cmdInput automagically cleared before/after commands. For personal usage I made both persist => https://github.com/Luckz/ArchiSteamFarm/commit/e990424357c978ca276fd71284d3ece683cdae46 (one could even go as far as persist output in localStorage)

Nice-to-have would be a command history accessible via keyboard up & down arrows (like this) - this one definitely is a candidate to keep the last 25 commands or so in localStorage.

Luckz commented 6 years ago

@MrBurrBurr I mean having user-set per-bot "quick commands". Some people mainly use ASF to control single bots with one/two/three repetitive commands like key redemption and market confirmation, others have vastly different use cases and desires. Actually, I think most powerful would be configurable buttons/textboxes stored in localStorage or some additional config file. Config file has the advantage of being "portable" for all that access it, localStorage has the advantage that multiple IPC UI users (shared ASF) can have different settings. I suppose a "real" (beyond people you trust 101%) multi-user setup would require per-ID64 (SteamOwnerID & SteamUserPermissions) IPCPassword in ASF. Don't know if that last one is the best feature to add.

image

Btw even if one doesn't show more than one reply at a time by wiping the #commandReply between responses, maybe it should still be scrollable (css: overflow-y: auto;?) for users with more bots than lines or who want to redeem more keys than they have available lines.

Nuklon commented 6 years ago

Just gonna list some features I'm missing still in the UI or don't find very useful as-is @MrBurrBurr . Hope you don't mind 👍

JustArchi commented 6 years ago

@MrBurrBurr Time remaining doesn't work when TimeSpan exceeds 1 day. It's then encoded as e.g. "TimeRemaining":"16.21:00:00" (for 16 days and 21 hours). You might want to correct it. The default format is [-][d.]hh:mm:ss[.fffffff] - https://msdn.microsoft.com/en-US/library/1ecy8h51(v=vs.110).aspx

JustArchi commented 6 years ago

@MrBurrBurr Also games redeemer doesn't work since you encode data as gameName:cd-key and not cd-key:gameName. From user we expect input as GameName Cd-Key because it's more natural, but for ASF data we expect cd-key:gameName, since cd-key is unique and serves as a key in the dictionary - you can't have two same cd-keys, while you can totally have 2 different cd-keys for the same game. You must construct dictionary from arg[1]: arg[0].

JustArchi commented 6 years ago

Also the textbox should be much bigger, I can barely input things.

image

JustArchi commented 6 years ago

Other than that the feature works OK after my fix from https://github.com/JustArchi/ArchiSteamFarm/commit/2b67138b7296274ddcffe8b6441132bce7596b99 - thanks a lot 🙂

JustArchi commented 6 years ago

@MrBurrBurr Also I noticed that you show the user number of games that were successfully added - this is nice, but improper since ASF's IPC API explicitly says that invalid entries will be removed during import process, so you can't actually state how many games were added based only on API success response.

For this reason I added final collection of the games to the ASF response, so you can actually make use of it now, or even tell user which keys were invalid and rejected by ASF - https://github.com/JustArchi/ArchiSteamFarm/wiki/IPC#post-apigamestoredeeminbackgroundbotname 🙂

JustArchi commented 6 years ago

@MrBurrBurr Priority right now would be to make IPC GUI comply with https://github.com/JustArchi/ArchiSteamFarm/commit/082fedfa0b9f5971e36198e97dae525a0fb33d47

ASF will block all /Api requests for full hour if you fail to authorize properly in 5 consecutive tries. Right now IPC GUI is sending requests like crazy and totally doesn't respect ASF returning 401 after user inputs his IPCPassword, which means that instead of giving user 5 tries, you get block after first one. Moreover, you don't have even one try, since ajax function in background tries to send requests regardless all the time, before user even has a chance to input his password.

You might want to correct this - the fact that IPC GUI kept sending requests after getting first 401 was unacceptable from the very start, but right now ASF treats those attempts as bruteforcing attempts, and blocks you entirely.

Suggested solution - send one /Api/ASF or whatever request you want on website being opened. If it returns 401, offer user IPCPassword to input and try again after user inputs it. If request succeeded, then you can assume that password is correct and call API on usual basis according to your logic, by starting all background functions that are currently called unconditionally. If it didn't, repeat ask for password, and do not send excessive requests that will trigger ASF anti-bruteforce mechanisms.

You might also want to handle new 403 response by showing user some friendly tooltip that he failed to authenticate too many times and is blocked for an hour.

JustArchi commented 6 years ago

@Benman2785 GitHub is not technical support, refrain from asking questions unrelated to development.

Yur0K commented 6 years ago

@MrBurrBurr Hi. I'm really enjoying of using you GUI and very appreciated for you hard work. I want to make some suggestions:

  1. Make some kind of Simple (Detailed) View of Bots page. As I see it is a name of bot and a list of games located under the bot name, instead of game logos (to be able to quickly see all games are farming).
  2. Make a list of last used command more easily accessible on Commands page. Save last commands (10, for example ) to some kind of clickable list, so the user can just with one click send one of the last commands.
Yur0K commented 6 years ago

@MrBurrBurr For the first suggestion is yes, you are right. As for the second: I ment that user needs to press arrowUp key 15 times, for example, to repeat a command he used 14 commands back. So the list of 10-20 last commands in form of clickable links or buttons would be easier. And one more thing: what about saving last used command and bot in drop-down menus? For example, I want to use redeem command for different bots. Each time I need to click and choose redeem, choose a bot and paste a key. I will provide screenshots later to show exactly what I suggested)

Yur0K commented 6 years ago

First two screenshots is about saving last used command and bot in drop-down menus. So after sending addlicense command for example to all bots (screenshot 1), you paste another apdID and send it without choosing command and that bot again (screenshot 2). asf gui 1 step asf gui 2 step This one is about list of recent commands. Command (link) on the left and an argument (key, appID, etc.). When user clicks the link command goes to commands dropdown, bot to bots dropdown and the input field is empty.
asf gui commands

MrMarble commented 6 years ago

I'm having this error when trying to display the logs, currently i'm 3.1.1.1 docker x64 but it also appears in windows version **EDIT: I've updated to version 3.1.1.7 and still same error

image

JourneyOver commented 6 years ago

@MrMarble do you use an adblocker of any sorts?

MrMarble commented 6 years ago

@JourneyOver Yes, I'm using uBlock Origin, but I already tried to disable it and still the same error

JourneyOver commented 6 years ago

firewall, router, anything else that could be blocking it? I know someone else was having this issue as well on discord with the log throwing an error for them, dunno if they fixed it or not though :x

MrMarble commented 6 years ago

I don't think so, I'm currently abroad in a different country with my laptop, also is the first time i'm installing it in that system, I had the same problem at home with my main windows pc

JourneyOver commented 6 years ago

Then I'm not sure, sorry :/ since it works fine on my end on both windows and a raspberry pi then I am unable to help troubleshoot much further since I can't produce it.

Luckz commented 6 years ago

WebSocket stuff (ASF Log) isn't supported on Win 7 clients. I assume it's that, @MrMarble

JourneyOver commented 6 years ago

oh yes, I totally forget that is a thing xD guess I could of helped him troubleshoot with just one more question.

MrMarble commented 6 years ago

@Luckz My main pc is Windows 10 and currently I have it running in my server with Debian 8 and my laptop is Ubuntu 17, I'm using Firefox if it helps

MrMarble commented 6 years ago

@MrBurrBurr Yes, this is the response I got: HTTP/1.1 200 OK Server: Microsoft-NetCore/2.0 Date: Mon, 19 Mar 2018 08:24:01 GMT Transfer-Encoding: chunked

mxalbert1996 commented 6 years ago

Is there any settings needed to enable IPC GUI command execution? I got a 405 - Method Not Allowed with any commands submitted in the web GUI. And I don't quite understand the explanation for it in the wiki.

JourneyOver commented 6 years ago

@mxalbert1996 You can wait until https://github.com/JustArchi/ArchiSteamFarm/pull/759 gets merged and ASF updates to include the changes, or if you want for now until then you can go in to the app.js file in the www/js folder, and change line 201 from

type: 'GET',

to

type: 'POST',

if you update ASF before the pull request gets merged in, you'll of course have to go in and change that line again any time you update until the pull request gets merged.

JustArchi commented 6 years ago

@MrBurrBurr

oubeichen commented 6 years ago

@JourneyOver I am currently using windows 7 and got the same error while it works flawlessly on my laptop running OS X. I checked the chrome console and found there was a 403 Forbidden.

wx20180327-112619 2x

Please check, thank you.

JourneyOver commented 6 years ago

@oubeichen WebSocket stuff (ASF Log) isn't supported on Win 7, you'll either have to upgrade to windows 8/8.1/10 or live without seeing the log in the IPC GUI on machines that are using windows 7 and below.

oubeichen commented 6 years ago

@JourneyOver No, the ASF server is running on my VPS, using CentOS 7 with Docker.

JourneyOver commented 6 years ago

@oubeichen yet above you said

I am currently using windows 7

so make up your mind on what you are running.

Either way it doesn't really matter what OS you are running the server on, it all depends on what OS you are using to access the IPC GUI on, which is why it works when you view the log on OS X but not on windows 7

MrMarble commented 6 years ago

Currently I'm using ASF version 3.1.1.8 in a docker container running in Debian 8. In my client pc I have Ubuntu 17 running latest version of Firefox without adblocker and still can't access log page:

Error! Event code: 1006

JustArchi commented 6 years ago

But this is not IPC GUI support page, this is IPC GUI development. You already reported your bug, it's pointless to spam about it.