Files
Password-Manager/delphi-backend/PMServer.dpr
T
Zaki 33e4b4b614 feat(autostart): "Start with Windows" toggle
- PM.AutoStart wraps HKCU\Software\Microsoft\Windows\CurrentVersion\Run.
  Value "PMServer" = "<exe>" -tray. Per-user, no admin required, shows
  up in Task Manager → Startup so the user can override from there.

- UMainForm honours the -tray CLI flag (set by the registry entry):
  after the server starts, MinimizeToTray via TThread.ForceQueue so the
  app comes up directly in the tray with no visible window flash.

- Bridge cmd://autostart/{get,set} + Bridge.getAutoStart() /
  setAutoStart() / onAutoStartStatus(). Settings exposes a toggle in
  the Security section, visible only when Bridge.active (the PHP
  frontend can't touch the registry).

- Toggle reads "on" only when the registered command matches the
  current exe path, so a stale entry from a moved exe lets the user
  re-enable to refresh.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-08 21:39:37 +01:00

46 lines
1.7 KiB
ObjectPascal

program PMServer;
uses
System.StartUpCopy,
FMX.Forms,
PM.SingleInstance in 'Source\PM.SingleInstance.pas',
UMainForm in 'UMainForm.pas' {MainForm},
PM.JSON in 'Source\PM.JSON.pas',
PM.Database in 'Source\PM.Database.pas',
PM.Router in 'Source\PM.Router.pas',
PM.StaticFiles in 'Source\PM.StaticFiles.pas',
PM.EmbeddedAssets in 'Source\PM.EmbeddedAssets.pas',
PM.Crypto in 'Source\PM.Crypto.pas',
PM.RateLimit in 'Source\PM.RateLimit.pas',
PM.Audit in 'Source\PM.Audit.pas',
PM.Session in 'Source\PM.Session.pas',
PM.HTTPServer in 'Source\PM.HTTPServer.pas',
PM.Bridge in 'Source\PM.Bridge.pas',
PM.QuickUnlock in 'Source\PM.QuickUnlock.pas',
PM.UserPrefs in 'Source\PM.UserPrefs.pas',
PM.AutoStart in 'Source\PM.AutoStart.pas',
PM.ProcessLockdown in 'Source\PM.ProcessLockdown.pas',
PM.Handler.Ping in 'Handlers\PM.Handler.Ping.pas',
PM.Handler.Auth in 'Handlers\PM.Handler.Auth.pas',
PM.Handler.Folders in 'Handlers\PM.Handler.Folders.pas',
PM.Handler.Entries in 'Handlers\PM.Handler.Entries.pas',
PM.Handler.Passkey in 'Handlers\PM.Handler.Passkey.pas',
PM.Handler.Recovery in 'Handlers\PM.Handler.Recovery.pas',
PM.Handler.Audit in 'Handlers\PM.Handler.Audit.pas',
PM.Handler.Settings in 'Handlers\PM.Handler.Settings.pas';
{$R *.res}
{$R assets\assets.res}
begin
// Single-instance: if another PMServer is running, bring it to front
// (it'll handle WM_PMSHOW on its message-only window) and exit. Avoids
// two icons in the tray and two HTTP servers fighting for the port.
if not PM.SingleInstance.AcquireOrSignal then
Exit;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.