Skip to content

Commit

Permalink
EDCD#2048 Validate RegKeys, Auth Flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed Aug 6, 2023
1 parent eedb9b8 commit 3b679c1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 15 deletions.
5 changes: 5 additions & 0 deletions companion.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import numbers
import os
import random
import sys
import threading
import time
import tkinter as tk
Expand Down Expand Up @@ -743,6 +744,10 @@ def auth_callback(self) -> None:
self.state = Session.STATE_INIT # Will try to authorize again on next login or query
self.auth = None
raise # Bad thing happened
if getattr(sys, 'frozen', False):
tk.messagebox.showinfo(title="Authentication Successful",
message="Authentication with cAPI Successful.\n"
"You may now close the Frontier login tab if it is still open.")

def close(self) -> None:
"""Close the `request.Session()."""
Expand Down
2 changes: 1 addition & 1 deletion config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# <https://semver.org/#semantic-versioning-specification-semver>
# Major.Minor.Patch(-prerelease)(+buildmetadata)
# NB: Do *not* import this, use the functions appversion() and appversion_nobuild()
_static_appversion = '5.9.2'
_static_appversion = '5.9.4-alpha1'
_cached_version: Optional[semantic_version.Version] = None
copyright = '© 2015-2019 Jonathan Harris, 2020-2023 EDCD'

Expand Down
42 changes: 28 additions & 14 deletions resources/EDMC_Installer_Config_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ LicenseFile=LICENSE
AlwaysShowDirOnReadyPage=yes
UninstallDisplayIcon={app}\{#MyAppExeName}
MinVersion=6.2

ChangesAssociations = yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Expand All @@ -53,28 +53,42 @@ Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChang

;Check if a WiX-based installation exists. If so, kill it with fire.
[Code]
function IsWixInstalled: Boolean;
var
Uninstall: String;
begin
Result := RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5E9AD4D3-0365-41D5-9586-9368745DD109}', 'UninstallString', Uninstall);
end;

procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
Uninstall: String;
begin
if (CurStep = ssInstall) then begin
if RegQueryStringValue(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5E9AD4D3-0365-41D5-9586-9368745DD109}', 'UninstallString', Uninstall) then begin
MsgBox('Warning: an old version of EDMC is installed! Please close EDMC while we remove the old version!', mbInformation, MB_OK);
Uninstall := '/x {5E9AD4D3-0365-41D5-9586-9368745DD109}';
Exec('MsiExec.exe', Uninstall, '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
if (CurStep = ssInstall) and IsWixInstalled then
begin
MsgBox('Warning: an old version of EDMC is installed! Please close EDMC while we remove the old version!', mbInformation, MB_OK);
Uninstall := '/x {5E9AD4D3-0365-41D5-9586-9368745DD109}';
Exec('MsiExec.exe', Uninstall, '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;



[Registry]
; Create the registry key for the custom file type
Root: HKCR; Subkey: "edmc"; Flags: uninsdeletekey
; Create the registry values for the custom file type
; Create the main registry key under HKCR
Root: HKCR; Subkey: "edmc"; Flags: uninsdeletevalue
; Create a default value under the "edmc" key
Root: HKCR; Subkey: "edmc"; ValueType: string; ValueName: ""; ValueData: "{#MyAppName}"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "edmc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"; Flags: uninsdeletevalue
Root: HKCR; Subkey: "edmc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""; Flags: uninsdeletevalue

; Register the URL protocol handler
; Create the "URL Protocol" value under the "edmc" key
Root: HKCR; Subkey: "edmc"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Flags: uninsdeletevalue
; Create the "DefaultIcon" subkey under the "edmc" key
Root: HKCR; Subkey: "edmc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\EDMarketConnector.exe,0"; Flags: uninsdeletevalue
; Create the "shell" subkey under the "edmc" key
Root: HKCR; Subkey: "edmc\shell"; Flags: uninsdeletevalue
; Create the "open" subkey under the "shell" subkey
Root: HKCR; Subkey: "edmc\shell\open"; Flags: uninsdeletevalue
; Create the "command" subkey under the "open" subkey
Root: HKCR; Subkey: "edmc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\EDMarketConnector.exe"" ""%1"""; Flags: uninsdeletevalue
; Create the "ddeexec" subkey under the "open" subkey
Root: HKCR; Subkey: "edmc\shell\open\ddeexec"; ValueType: string; ValueName: ""; ValueData: "Open(""%1"")"; Flags: uninsdeletevalue

0 comments on commit 3b679c1

Please sign in to comment.