FEAT Получение пароля из файла

Теперь пароль от сайт-панели корректно берется из persistantDataPath.
Файл admin_password.txt
This commit is contained in:
_sega 2026-02-02 11:05:48 +03:00
parent 00462af4c3
commit ee79e312f1
4 changed files with 962 additions and 18 deletions

View File

@ -11349,7 +11349,7 @@ Material:
- _ClipRect: {r: -32767, g: -32767, b: 32767, a: 32767}
- _EnvMatrixRotation: {r: 0, g: 0, b: 0, a: 0}
- _FaceColor: {r: 1, g: 1, b: 1, a: 1}
- _GlowColor: {r: 0, g: 0.72760534, b: 1, a: 1}
- _GlowColor: {r: 0, g: 1, b: 0.39179158, a: 1}
- _MaskCoord: {r: 0, g: 0, b: 32767, a: 32767}
- _OutlineColor: {r: 0.554717, g: 0.554717, b: 0.554717, a: 1}
- _ReflectFaceColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -20,7 +20,11 @@ public static class AuthManager
if (File.Exists(path))
{
var s = File.ReadAllText(path, Encoding.UTF8).Trim();
if (!string.IsNullOrEmpty(s)) return s;
if (!string.IsNullOrEmpty(s))
{
Debug.Log($"Password loaded from file. {s}");
return s;
}
}
}
catch (Exception e)

View File

@ -25,7 +25,7 @@ public class WebServer : MonoBehaviour
[SerializeField] private string adminPasswordFallback = "1234"; // если файла нет
[SerializeField] private string passwordFileName = "admin_password.txt"; // лежит в persistentDataPath
private string AdminPassword => AuthManager.LoadPasswordOrFallback(adminPasswordFallback, passwordFileName);
private string AdminPassword;
public List<SettingAction> settingActions;
@ -33,6 +33,7 @@ public class WebServer : MonoBehaviour
async void Start()
{
AdminPassword = AuthManager.LoadPasswordOrFallback(adminPasswordFallback, passwordFileName);
LoadCss();
settingActions = GameManager.instance.AdminPanel.GetComponent<SettingsScreen>().settingActions;

File diff suppressed because one or more lines are too long