pyscsd / steamCloudSaveDownloader

Download/Backup Steam Cloud Save
MIT License
20 stars 2 forks source link

Session doesnt persist after container restart #9

Closed plumleytristan closed 2 months ago

plumleytristan commented 2 months ago

Describe the bug Session doesn't persist after container restart

To Reproduce Steps to reproduce the behavior: Running scsd container:

steamcloudsave:
    image: hhhhojeihsu/scsd
    restart: unless-stopped
    environment:
      CRON_VAR: "* * * * *"
    volumes:
      - ./scsd/data:/data
      - ./scsd/config:/config
      - /etc/localtime:/etc/localtime:ro

Using scsd.conf:

[General]
save_dir = ./data

[Log]
log_level = 3

[Rotation]
rotation = 15

[Notifier]
notifier = discord
webhook = https://discord.com/api/webhooks/xxx
notify_if_no_change = false
level = 3

[Target]
mode = include
list = 275850

container starts and reads config properly:

$ docker exec -it tools-steamcloudsave-1 scsd_auth steamaccount
[run.sh] Config specified /config/scsd.conf
2024-09-07 12:00:10 [INFO] Config read from '/config/scsd.conf'
2024-09-07 12:00:10 [INFO] Options: {'General': {'save_dir': './data', '2fa': 'mobile'}, 'Rotation': {'rotation': 15}, 'Log': {'log_level': 3}, 'Notifier': {'notify_if_no_change': True, 'notifier': 'discord', 'webhook': 'https://discord.com/api/webhooks/xxx', 'path': '', 'level': 3}, 'Target': {'mode': 'include', 'list': [275850]}, 'Danger Zone': {'wait_interval': [3, 5]}, 'auth': 'steamaccount'}
2024-09-07 12:00:10 [INFO] CWD: /
2024-09-07 12:00:10 [INFO] Files will be saved to './data'
This program will NOT save your credential locally
Username: steamaccount
Password:
2FA code on Steam Authenticator (Please get the 5 digits code manually)
2FA code (case insensitive): 12345
Login success. Please rerun scsd to start downloading

after restarting the container, session doesnt exist:

$ docker compose restart steamcloudsave
[+] Restarting 1/1
 ✔ Container tools-steamcloudsave-1  Started                                                                                                                           10.4s
$ docker compose logs steamcloudsave -f
steamcloudsave-1  | [entry.sh] Add user(1000) and group(1000)
steamcloudsave-1  | [entry.sh] Setting permission
steamcloudsave-1  | [entry.sh] Setting cron
steamcloudsave-1  | [entry.sh] Crontab schedule:  * * * * *
steamcloudsave-1  | [entry.sh] Setting up auto update
steamcloudsave-1  | [entry.sh] Auto update set to disabled
steamcloudsave-1  | [entry.sh] Config exist. Skip default config creation
steamcloudsave-1  | [entry.sh] Creating .scsd_dockerenv
steamcloudsave-1  | crond: crond (busybox 1.35.0) started, log level 8
steamcloudsave-1  | crond: USER user pid  18 cmd /bin/sh /opt/run.sh
steamcloudsave-1  | [run.sh] Config specified /config/scsd.conf
steamcloudsave-1  | 2024-09-07 12:00:00 [INFO] Config read from '/config/scsd.conf'
steamcloudsave-1  | 2024-09-07 12:00:00 [INFO] Options: {'General': {'save_dir': './data', '2fa': 'mobile'}, 'Rotation': {'rotation': 15}, 'Log': {'log_level': 3}, 'Notifier': {'notify_if_no_change': True, 'notifier': 'discord', 'webhook': 'https://discord.com/api/webhooks/xxx', 'path': '', 'level': 3}, 'Target': {'mode': 'include', 'list': [275850]}, 'Danger Zone': {'wait_interval': [3, 5]}}
steamcloudsave-1  | 2024-09-07 12:00:00 [INFO] CWD: /user
steamcloudsave-1  | 2024-09-07 12:00:00 [INFO] Files will be saved to './data'
steamcloudsave-1  | 2024-09-07 12:00:01 [ERROR] No session found. Please re-run the program with -a <username> first

When manually running it right after re-authenticating, it seems to skip pulling the scsd.conf yet is capable of using the saved session: I'm assuming i had to add a flag to import the config on the manual run, probably not an issue.

docker exec -it tools-steamcloudsave-1 scsd
2024-09-07 12:01:32 [INFO] Config file not provided
2024-09-07 12:01:32 [WARNING] Detect container environment. Please run scsd with `/opt/run.sh` and authentication with `scsd_auth`
2024-09-07 12:01:32 [INFO] Options: {'General': {'save_dir': './data', '2fa': 'mobile'}, 'Rotation': {'rotation': 15}, 'Log': {'log_level': 2}, 'Notifier': {'notify_if_no_change': False, 'notifier': '', 'webhook': '', 'path': '', 'level': 1}, 'Target': {'mode': '', 'list': []}, 'Danger Zone': {'wait_interval': [3, 5]}, 'auth': None}
2024-09-07 12:01:32 [INFO] CWD: /
2024-09-07 12:01:32 [INFO] Files will be saved to './data'
2024-09-07 12:01:32 [INFO] Refreshing session
2024-09-07 12:01:34 [INFO] Getting Game Save List
2024-09-07 12:01:34 [INFO] Random sleep for 3 seconds
2024-09-07 12:01:40 [INFO] (1/95) Processing Steam Client
2024-09-07 12:01:40 [INFO] Random sleep for 3 seconds
2024-09-07 12:01:43 [INFO] Downloading serverbrowser_hist.vdf
2024-09-07 12:01:45 [INFO] Downloading sharedconfig.vdf
2024-09-07 12:01:47 [INFO] (2/95) Processing Half-Life
2024-09-07 12:01:47 [INFO] Random sleep for 3 seconds
2024-09-07 12:01:50 [INFO] Downloading autoexec.cfg
2024-09-07 12:01:51 [INFO] Downloading config.cfg
2024-09-07 12:01:53 [INFO] Downloading controller.cfg
2024-09-07 12:01:54 [INFO] Downloading default.cfg
2024-09-07 12:01:55 [INFO] Downloading game.cfg
2024-09-07 12:01:56 [INFO] Downloading 3Dfx.cfg
2024-09-07 12:01:58 [INFO] Downloading 3DfxVoodoo1.cfg
2024-09-07 12:01:59 [INFO] Downloading 3DfxVoodoo2.cfg
2024-09-07 12:02:00 [INFO] Downloading 3Dlabs.cfg
2024-09-07 12:02:02 [INFO] Downloading ATIRage128.cfg
2024-09-07 12:02:03 [INFO] Downloading ATIRage128d3d.cfg
2024-09-07 12:02:04 [INFO] Downloading d3d.cfg
2024-09-07 12:02:05 [INFO] Downloading geforce.cfg
TRI5tinjin82024-09-07 12:02:06 [INFO] Downloading matrox.cfg
2024-09-07 12:02:08 [INFO] Downloading nvidiad3d.cfg
^CKeyboard interrupt received

data/scsd.log:

$ cat scsd.log
2024-09-07 12:00:10 [INFO] Options: {'General': {'save_dir': './data', '2fa': 'mobile'}, 'Rotation': {'rotation': 15}, 'Log': {'log_level': 3}, 'Notifier': {'notify_if_no_change': True, 'notifier': 'discord', 'webhook': 'https://discord.com/api/webhooks/xxx', 'path': '', 'level': 3}, 'Target': {'mode': 'include', 'list': [275850]}, 'Danger Zone': {'wait_interval': [3, 5]}, 'auth': 'steamaccount'}
2024-09-07 12:00:10 [INFO] CWD: /
2024-09-07 12:00:10 [INFO] Files will be saved to './data'
2024-09-07 12:01:32 [INFO] Options: {'General': {'save_dir': './data', '2fa': 'mobile'}, 'Rotation': {'rotation': 15}, 'Log': {'log_level': 2}, 'Notifier': {'notify_if_no_change': False, 'notifier': '', 'webhook': '', 'path': '', 'level': 1}, 'Target': {'mode': '', 'list': []}, 'Danger Zone': {'wait_interval': [3, 5]}, 'auth': None}
2024-09-07 12:01:32 [INFO] CWD: /
2024-09-07 12:01:32 [INFO] Files will be saved to './data'
2024-09-07 12:01:32 [INFO] Refreshing session
2024-09-07 12:01:34 [INFO] Getting Game Save List
2024-09-07 12:01:34 [INFO] Random sleep for 3 seconds
2024-09-07 12:01:40 [INFO] (1/95) Processing Steam Client
2024-09-07 12:01:40 [INFO] Random sleep for 3 seconds
2024-09-07 12:01:43 [INFO] Downloading serverbrowser_hist.vdf
2024-09-07 12:01:45 [INFO] Downloading sharedconfig.vdf
2024-09-07 12:01:47 [INFO] (2/95) Processing Half-Life
2024-09-07 12:01:47 [INFO] Random sleep for 3 seconds
2024-09-07 12:01:50 [INFO] Downloading autoexec.cfg
2024-09-07 12:01:51 [INFO] Downloading config.cfg
2024-09-07 12:01:53 [INFO] Downloading controller.cfg
2024-09-07 12:01:54 [INFO] Downloading default.cfg
2024-09-07 12:01:55 [INFO] Downloading game.cfg
2024-09-07 12:01:56 [INFO] Downloading 3Dfx.cfg
2024-09-07 12:01:58 [INFO] Downloading 3DfxVoodoo1.cfg
2024-09-07 12:01:59 [INFO] Downloading 3DfxVoodoo2.cfg
2024-09-07 12:02:00 [INFO] Downloading 3Dlabs.cfg
2024-09-07 12:02:02 [INFO] Downloading ATIRage128.cfg
2024-09-07 12:02:03 [INFO] Downloading ATIRage128d3d.cfg
2024-09-07 12:02:04 [INFO] Downloading d3d.cfg
2024-09-07 12:02:05 [INFO] Downloading geforce.cfg
2024-09-07 12:02:06 [INFO] Downloading matrox.cfg
2024-09-07 12:02:08 [INFO] Downloading nvidiad3d.cfg

Expected behavior (from the readme):

Authentication By running scsd -a scsd save a session file with NO password within. This session last approximately about a month if your IP has not been changed. Once expired scsd will notify you if the notification options are given.

hhhhhojeihsu commented 2 months ago

Hi plumleytristan,

The working directories when you run the command scsd_auth and crontab triggers are different. One is / and the other one is /user. So ./data points to different location. Changing the save_dir in config file to /data shall solve this issue.

plumleytristan commented 2 months ago

Thanks, that worked.

I was using the example conf file template here:

https://github.com/pyscsd/steamCloudSaveDownloader/blob/master/scsd.conf.sample

and the instructions here:

https://github.com/pyscsd/steamCloudSaveDownloader/tree/master#volumes

so i assumed they were both referring to the same location.

Thank you!

hhhhhojeihsu commented 2 months ago

Glad to be of help 😄.