pagefaultgames / pokerogue

A browser based Pokémon fangame heavily inspired by the roguelite genre.
https://pokerogue.net
GNU Affero General Public License v3.0
3.98k stars 1.59k forks source link

[BUG] No Import Session/Data options when Self Hosting? #1775

Open Charlielx opened 1 month ago

Charlielx commented 1 month ago

Just got my install up and running in debian once I found this repo, and it works great (except for accounts, gotta get the server figured out and running) but when I go to Manage Data I still only have the Export Session and Export Data options, no Import Session nor Import Data. Is there something specific I need to do for these to show up? Everything that I'm seeing talk about it just says "when you're self-hosting, you'll have additional options for Import appear in the Manage Data menu".

Expected behavior

Screenshots / Videos image

Device Install on Debian 12, browser with game on Thorium 117.0.5938.157, Windows 11 Pro

mjferrante83 commented 1 month ago

Not a bug -- it depends on your instance is configured. Take a look at the ./src/utils.ts and ./src/ui/menu-ui-handler.ts -- there's a variable defined as isLocal that's evaluated on initialization. If isLocal = true , it'll disable the Import Session and Import Data options. For my setup, I wrote a script to modify parts of these two files every time I pull from Git and spin up.

Charlielx commented 1 month ago

Isn't that backwards though? Shouldn't it default to having Import options when isLocal is true, since those options are only available when running locally?

Appreciate the assistance though, would you mind sharing your script?

mjferrante83 commented 1 month ago

Sorry, my initial reply was quick. Not in a good spot to share the script but I can elaborate on what I was saying beforehand.

You are indeed correct, if isLocal=true then ImportData and ImportSession will be available. You'll need to check the logic of how isLocal is generated to see what's happening on your end

My setup utilizes 3 containers in Docker Swarm and I pass my SSL certificate via a reverse proxy so I end up using a script to modify the utils.ts to force isLocal to false and hard add my subdomain. The isLocal variable modifies a few behaviors like how Daily Run information is saved as well as if the Import functionality is enabled/disabled. I have a few friends playing on my instance so having isLocal hard disabled gives me the desired functionality outside of the Import functions being enabled. To account for this, my script then modifies menu-ui-handler.ts to hard enable Import functionality.

My script is basically a lot of sed functions being passed to those 2 files to configure things the way I want them

I hope this helps you. Basically, if you are playing solo, you could just modify your utils.ts as a test and hard set isLocal = true and see if that helps.

On Mon, Jun 3, 2024, 22:44 Charlie @.***> wrote:

Isn't that backwards though? Shouldn't it default to having Import options when isLocal is true, since those options are only available when running locally?

Appreciate the assistance though, would you mind sharing your script?

— Reply to this email directly, view it on GitHub https://github.com/pagefaultgames/pokerogue/issues/1775#issuecomment-2146528953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIY4OJTF23QR662YRPPSJG3ZFUZZHAVCNFSM6AAAAABIXRUWXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBWGUZDQOJVGM . You are receiving this because you commented.Message ID: @.***>

Charlielx commented 1 month ago

Awesome thank you, I might open my instance up eventually but I was having issues with the server on Debian cause I'm dumb and prefer to use Proxmox CTs over Docker Containers despite not probably not having a level of expertise that would lend itself to that 😂 Forces me to learn stuff though so thats good.

I definitely appreciate the help though! Will try this out.

Thanks!