Skip to content

Commit

Permalink
mcdr plugin logic thing for auth token storing
Browse files Browse the repository at this point in the history
  • Loading branch information
Fallen-Breath committed Jun 19, 2022
1 parent c65428b commit bc4f7ed
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pcrc/mcdr/mcdr_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from mcdreforged.utils.logger import SyncStdoutStreamHandler

import pcrc as pcrc_module
import pcrc.config as pcrc_config
from pcrc.input import InputManager
from pcrc.mcdr.mcdr_config import McdrConfig
from pcrc.pcrc_client import PcrcClient
Expand All @@ -37,8 +36,19 @@ def input(self, message: str) -> str:
return user_inputs.get()


def tweaks_pcrc_constants():
def modify_based_dir(file_path: str) -> str:
return os.path.join(psi.get_data_folder(), os.path.basename(file_path))

import pcrc.config as pcrc_config
from pcrc.connection import pcrc_authentication

pcrc_config.CONFIG_FILE = modify_based_dir(pcrc_config.CONFIG_FILE)
pcrc_authentication.SAVED_TOKEN_FILE = modify_based_dir(pcrc_authentication.SAVED_TOKEN_FILE)


def on_load(server: PluginServerInterface, old):
pcrc_config.CONFIG_FILE = os.path.join(psi.get_data_folder(), 'config.json')
tweaks_pcrc_constants()
global pcrc
pcrc = PcrcClient(input_manager=MCDRInputManager())
pcrc.logger.set_console_handler(SyncStdoutStreamHandler())
Expand Down

0 comments on commit bc4f7ed

Please sign in to comment.