mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 23:37:14 +03:00
[555] Move WinSparkle Keys to Setup File
This commit is contained in:
parent
bd6f5466af
commit
8888d01760
6
build.py
6
build.py
@ -19,12 +19,16 @@ from config import (
|
|||||||
copyright,
|
copyright,
|
||||||
git_shorthash_from_head,
|
git_shorthash_from_head,
|
||||||
_static_appversion,
|
_static_appversion,
|
||||||
|
update_interval
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def iss_build(template_path: str, output_file: str) -> None:
|
def iss_build(template_path: str, output_file: str) -> None:
|
||||||
"""Build the .iss file needed for building the installer EXE."""
|
"""Build the .iss file needed for building the installer EXE."""
|
||||||
sub_vals = {"appver": _static_appversion}
|
sub_vals = {
|
||||||
|
"appver": _static_appversion,
|
||||||
|
"update_time": str(update_interval),
|
||||||
|
}
|
||||||
with open(template_path, encoding="UTF8") as template_file:
|
with open(template_path, encoding="UTF8") as template_file:
|
||||||
src = Template(template_file.read())
|
src = Template(template_file.read())
|
||||||
newfile = src.substitute(sub_vals)
|
newfile = src.substitute(sub_vals)
|
||||||
|
@ -60,7 +60,7 @@ _cached_version: semantic_version.Version | None = None
|
|||||||
copyright = '© 2015-2019 Jonathan Harris, 2020-2023 EDCD'
|
copyright = '© 2015-2019 Jonathan Harris, 2020-2023 EDCD'
|
||||||
|
|
||||||
update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'
|
update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'
|
||||||
update_interval = 8*60*60
|
update_interval = 8*60*60 # 8 Hours
|
||||||
# Providers marked to be in debug mode. Generally this is expected to switch to sending data to a log file
|
# Providers marked to be in debug mode. Generally this is expected to switch to sending data to a log file
|
||||||
debug_senders: list[str] = []
|
debug_senders: list[str] = []
|
||||||
# TRACE logging code that should actually be used. Means not spamming it
|
# TRACE logging code that should actually be used. Means not spamming it
|
||||||
|
@ -15,7 +15,7 @@ import uuid
|
|||||||
import winreg
|
import winreg
|
||||||
from ctypes.wintypes import DWORD, HANDLE
|
from ctypes.wintypes import DWORD, HANDLE
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
from config import AbstractConfig, applongname, appname, logger, update_interval
|
from config import AbstractConfig, applongname, appname, logger
|
||||||
|
|
||||||
assert sys.platform == 'win32'
|
assert sys.platform == 'win32'
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ def known_folder_path(guid: uuid.UUID) -> str | None:
|
|||||||
class WinConfig(AbstractConfig):
|
class WinConfig(AbstractConfig):
|
||||||
"""Implementation of AbstractConfig for Windows."""
|
"""Implementation of AbstractConfig for Windows."""
|
||||||
|
|
||||||
def __init__(self, do_winsparkle=True) -> None:
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.app_dir_path = pathlib.Path(known_folder_path(FOLDERID_LocalAppData)) / appname # type: ignore
|
self.app_dir_path = pathlib.Path(known_folder_path(FOLDERID_LocalAppData)) / appname # type: ignore
|
||||||
self.app_dir_path.mkdir(exist_ok=True)
|
self.app_dir_path.mkdir(exist_ok=True)
|
||||||
@ -77,8 +77,6 @@ class WinConfig(AbstractConfig):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.__reg_handle: winreg.HKEYType = create_key_defaults(sub_key=REGISTRY_SUBKEY)
|
self.__reg_handle: winreg.HKEYType = create_key_defaults(sub_key=REGISTRY_SUBKEY)
|
||||||
if do_winsparkle:
|
|
||||||
self.__setup_winsparkle()
|
|
||||||
|
|
||||||
except OSError:
|
except OSError:
|
||||||
logger.exception('Could not create required registry keys')
|
logger.exception('Could not create required registry keys')
|
||||||
@ -89,36 +87,6 @@ class WinConfig(AbstractConfig):
|
|||||||
docs = known_folder_path(FOLDERID_Documents)
|
docs = known_folder_path(FOLDERID_Documents)
|
||||||
self.set("outdir", docs if docs is not None else self.home)
|
self.set("outdir", docs if docs is not None else self.home)
|
||||||
|
|
||||||
def __setup_winsparkle(self):
|
|
||||||
"""Ensure the necessary Registry keys for WinSparkle are present."""
|
|
||||||
create_key_defaults = functools.partial(
|
|
||||||
winreg.CreateKeyEx,
|
|
||||||
key=winreg.HKEY_CURRENT_USER,
|
|
||||||
access=winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_64KEY,
|
|
||||||
)
|
|
||||||
|
|
||||||
try:
|
|
||||||
with create_key_defaults(sub_key=r'Software\EDCD\EDMarketConnector') as edcd_handle:
|
|
||||||
with winreg.CreateKeyEx(edcd_handle, sub_key='WinSparkle',
|
|
||||||
access=winreg.KEY_ALL_ACCESS | winreg.KEY_WOW64_64KEY) as winsparkle_reg:
|
|
||||||
# Set WinSparkle defaults - https://github.com/vslavik/winsparkle/wiki/Registry-Settings
|
|
||||||
UPDATE_INTERVAL_NAME = 'UpdateInterval' # noqa: N806
|
|
||||||
CHECK_FOR_UPDATES_NAME = 'CheckForUpdates' # noqa: N806
|
|
||||||
REG_SZ = winreg.REG_SZ # noqa: N806
|
|
||||||
|
|
||||||
winreg.SetValueEx(winsparkle_reg, UPDATE_INTERVAL_NAME, REG_RESERVED_ALWAYS_ZERO, REG_SZ,
|
|
||||||
str(update_interval))
|
|
||||||
|
|
||||||
try:
|
|
||||||
winreg.QueryValueEx(winsparkle_reg, CHECK_FOR_UPDATES_NAME)
|
|
||||||
except FileNotFoundError:
|
|
||||||
# Key doesn't exist, set it to a default
|
|
||||||
winreg.SetValueEx(winsparkle_reg, CHECK_FOR_UPDATES_NAME, REG_RESERVED_ALWAYS_ZERO, REG_SZ,
|
|
||||||
'1')
|
|
||||||
except OSError:
|
|
||||||
logger.exception('Could not open WinSparkle handle')
|
|
||||||
raise
|
|
||||||
|
|
||||||
def __get_regentry(self, key: str) -> None | list | str | int:
|
def __get_regentry(self, key: str) -> None | list | str | int:
|
||||||
"""Access the Registry for the raw entry."""
|
"""Access the Registry for the raw entry."""
|
||||||
try:
|
try:
|
||||||
|
@ -34,8 +34,7 @@ _('stuff')
|
|||||||
|
|
||||||
#### Edit `L10n/en.template` to add the phrase
|
#### Edit `L10n/en.template` to add the phrase
|
||||||
|
|
||||||
##### Hint: It is strongly recommended to use the find_localized_strings.py script to help automate this process!
|
##### Hint: It is strongly recommended to use the `find_localized_strings.py` script to help automate this process!
|
||||||
|
|
||||||
/* <use of this phrase> [<file it was first added in>] */
|
/* <use of this phrase> [<file it was first added in>] */
|
||||||
"<text as it appears in the code>" = "<English version of the text>";
|
"<text as it appears in the code>" = "<English version of the text>";
|
||||||
e.g.
|
e.g.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#define MyAppName "EDMarketConnector"
|
#define MyAppName "EDMarketConnector"
|
||||||
#define MyAppLongName "Elite Dangerous Market Connector"
|
#define MyAppLongName "Elite Dangerous Market Connector"
|
||||||
#define MyAppVersion "$appver"
|
#define MyAppVersion "$appver"
|
||||||
|
#define MyAppUpdateTime "$update_time"
|
||||||
#define MyAppPublisher "EDCD"
|
#define MyAppPublisher "EDCD"
|
||||||
#define MyAppURL "https://edcd.github.io/"
|
#define MyAppURL "https://edcd.github.io/"
|
||||||
#define SuppURL "https://github.com/EDCD/EDMarketConnector/"
|
#define SuppURL "https://github.com/EDCD/EDMarketConnector/"
|
||||||
@ -34,6 +35,7 @@ AlwaysShowDirOnReadyPage=yes
|
|||||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||||
MinVersion=6.2
|
MinVersion=6.2
|
||||||
ChangesAssociations = yes
|
ChangesAssociations = yes
|
||||||
|
UsedUserAreasWarning = no
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||||
@ -113,6 +115,11 @@ Root: HKCR; Subkey: "edmc\shell\open"; Flags: uninsdeletekey
|
|||||||
Root: HKCR; Subkey: "edmc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\EDMarketConnector.exe"" ""%1"""; Flags: uninsdeletekey
|
Root: HKCR; Subkey: "edmc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\EDMarketConnector.exe"" ""%1"""; Flags: uninsdeletekey
|
||||||
; Create the "ddeexec" subkey under the "open" subkey
|
; Create the "ddeexec" subkey under the "open" subkey
|
||||||
Root: HKCR; Subkey: "edmc\shell\open\ddeexec"; ValueType: string; ValueName: ""; ValueData: "Open(""%1"")"; Flags: uninsdeletekey
|
Root: HKCR; Subkey: "edmc\shell\open\ddeexec"; ValueType: string; ValueName: ""; ValueData: "Open(""%1"")"; Flags: uninsdeletekey
|
||||||
|
; Create WinSparkle related keys for update values
|
||||||
|
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector"; Flags: uninsdeletekey
|
||||||
|
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector\WinSparkle"; Flags: uninsdeletekey
|
||||||
|
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector\WinSparkle"; ValueType: string; ValueName: "UpdateInterval"; ValueData: "{#MyAppUpdateTime}"; Flags: createvalueifdoesntexist
|
||||||
|
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector\WinSparkle"; ValueType: string; ValueName: "CheckForUpdates"; ValueData: "1"; Flags: createvalueifdoesntexist
|
||||||
|
|
||||||
[InstallDelete]
|
[InstallDelete]
|
||||||
Type: filesandordirs; Name: "{app}"
|
Type: filesandordirs; Name: "{app}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user