Skip to content

Commit

Permalink
v1.4.12.45 beta 1
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdelsol committed Mar 29, 2024
1 parent f0a05d0 commit db2a2df
Show file tree
Hide file tree
Showing 22 changed files with 222 additions and 143 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ You'll find them in the app folder[^3]:
[^3]:The app is installed by default in `%LocalAppData%\Programs\Sfvip All x64`, `%LocalAppData%\Programs\Sfvip All x86` or the installation directory you've specified during the installation.

# Build
[![version](https://custom-icon-badges.demolab.com/badge/Build%201.4.12.44-informational?logo=github)](/build_config.py#L27)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc%208.4k-informational?logo=file-code)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)
[![version](https://custom-icon-badges.demolab.com/badge/Build%201.4.12.45-informational?logo=github)](/build_config.py#L27)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc%208.5k-informational?logo=file-code)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)
[![Ruff](https://custom-icon-badges.demolab.com/badge/Ruff-informational?logo=ruff-color)](https://docs.astral.sh/ruff/)
[![Python](https://custom-icon-badges.demolab.com/badge/Python%203.11.8-linen?logo=python-color)](https://www.python.org/downloads/release/python-3118/)
[![mitmproxy](https://custom-icon-badges.demolab.com/badge/Mitmproxy%2010.2.4-linen?logo=mitmproxy-black)](https://mitmproxy.org/)
[![Nsis](https://custom-icon-badges.demolab.com/badge/Nsis%203.09-linen?logo=nsis-color)](https://nsis.sourceforge.io/Download)
[![Nuitka](https://custom-icon-badges.demolab.com/badge/Nuitka%202.1.3-linen?logo=nuitka)](https://nuitka.net/)
[![Nuitka](https://custom-icon-badges.demolab.com/badge/Nuitka%202.1.4-linen?logo=nuitka)](https://nuitka.net/)
[![PyInstaller](https://custom-icon-badges.demolab.com/badge/PyInstaller%206.5.0-linen?logo=pyinstaller-windowed)](https://pyinstaller.org/en/stable/)

* [***NSIS***](https://nsis.sourceforge.io/Download) will be automatically installed if missing.
Expand Down
5 changes: 5 additions & 0 deletions build/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.4.12.45
* Bump _Nuitka_ to 2.1.4.
* Fix MAC account update info.
* Fix MAC account progress not correctly hiding.

## 1.4.12.44
* Fix UI minor bug when launching several _Sfvip All_.
* Fix uninstall old version if the installation folder differs.
Expand Down
2 changes: 1 addition & 1 deletion build_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Build:
main: ClassVar = "sfvip_all.py"
company: ClassVar = "sebdelsol"
name: ClassVar = "Sfvip All"
version: ClassVar = "1.4.12.44"
version: ClassVar = "1.4.12.45"
dir: ClassVar = "build"
enable_console: ClassVar = False
logs_dir: ClassVar = "../logs"
Expand Down
73 changes: 35 additions & 38 deletions dev/tools/nsis/template.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,36 @@ ShowUninstDetails hide

!define MUI_ICON "{{dist}}\{{ico}}"
!define MUI_UNICON "{{dist}}\{{ico}}"
!define UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\{{name}} {{bitness}}"

; -------------
; directory page
; -------------
!define MUI_PAGE_CUSTOMFUNCTION_PRE "SetInstDir"
!insertmacro MUI_PAGE_DIRECTORY

var OldInstDir

; Set install directory if in the registry
Function SetInstDir
; check in the registry for already installed version
ReadRegStr $0 HKCU "${UNINSTALL_KEY}" "InstallLocation"
${If} ${Errors}
ClearErrors
${Else}
StrCpy $InstDir $0
${Endif}
; save $InstDir
StrCpy $OldInstDir $InstDir
; no directory page if /AUTOINSTDIR=yes
${GetParameters} $0
${GetOptions} $0 "/AUTOINSTDIR=" $1
ClearErrors
${If} $1 == "yes"
Abort
${Endif}
FunctionEnd

; -------------
; install pages
; -------------
Expand All @@ -33,6 +56,18 @@ Page Custom old.AppRunningPage old.AppRunningPageFinalize
Page Custom AppRunningPage AppRunningPageFinalize
!insertmacro MUI_PAGE_INSTFILES

; Uninstall version stored in the registry if different from instdir
Function UninstallOldVersionIfNeeded
ReadRegStr $0 HKCU "${UNINSTALL_KEY}" "InstallLocation"
${If} ${Errors}
ClearErrors
${ElseIf} $InstDir != $0
${If} ${FileExists} "$0\uninstall.exe"
ExecWait "$0\uninstall.exe /S"
${EndIf}
${Endif}
FunctionEnd

; -------------
; finish pages
; -------------
Expand Down Expand Up @@ -108,7 +143,6 @@ FunctionEnd
!define GetProcess "Get-Process '{{name}}' -ErrorAction SilentlyContinue"

var NbAppRunning
var OldInstDir

!macro GetNbAppRunning old
; MessageBox MB_OK "old=`${old}`"
Expand Down Expand Up @@ -184,7 +218,6 @@ var NextButton
; ------------
; Install Page
; ------------
!define UNINSTALL_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\{{name}} {{bitness}}"

Section "Install"
SectionIn RO ; Read-only
Expand Down Expand Up @@ -225,39 +258,3 @@ Section "Uninstall"
Delete "$InstDir\uninstall.exe"
Delete "$SMPROGRAMS\{{name}} {{bitness}}.lnk"
SectionEnd

; --------------
; Set install directory if in the registry
; --------------
Function SetInstDir
; check in the registry for already installed version
ReadRegStr $0 HKCU "${UNINSTALL_KEY}" "InstallLocation"
${If} ${Errors}
ClearErrors
${Else}
StrCpy $InstDir $0
${Endif}
; save $InstDir
StrCpy $OldInstDir $InstDir
; no directory page if /AUTOINSTDIR=yes
${GetParameters} $0
${GetOptions} $0 "/AUTOINSTDIR=" $1
ClearErrors
${If} $1 == "yes"
Abort
${Endif}
FunctionEnd

; --------------
; Uninstall version stored in the registry if different from instdir
; --------------
Function UninstallOldVersionIfNeeded
ReadRegStr $0 HKCU "${UNINSTALL_KEY}" "InstallLocation"
${If} ${Errors}
ClearErrors
${ElseIf} $InstDir != $0
${If} ${FileExists} "$0\uninstall.exe"
ExecWait "$0\uninstall.exe /S"
${EndIf}
${Endif}
FunctionEnd
15 changes: 8 additions & 7 deletions src/mitm/addon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from mitmproxy import http
from mitmproxy.proxy.server_hooks import ServerConnectionHookData

from ..cache import AllCached, MACCache, UpdateCacheProgressT
from ..cache import AllCached, MacCache, UpdateCacheProgressT
from ..epg import EPG, EpgCallbacks
from ..utils import APItype, get_query_key, response_json
from .all import AllCategoryName, AllPanels
Expand Down Expand Up @@ -156,11 +156,14 @@ def __init__(
timeout: int,
) -> None:
self.api_request = ApiRequest(accounts_urls)
self.mac_cache = MACCache(roaming, update_progress, all_config.all_cached)
self.mac_cache = MacCache(roaming, update_progress, all_config.all_cached)
self.epg = EPG(roaming, epg_callbacks, timeout)
self.m3u_stream = M3UStream(self.epg)
self.panels = AllPanels(all_config.all_name)

def cache_stop_all(self) -> None:
self.mac_cache.stop_all()

def epg_update(self, url: str) -> None:
self.epg.ask_update(url)

Expand All @@ -171,10 +174,12 @@ def epg_prefer_update(self, prefer_internal: bool) -> None:
self.epg.update_prefer(prefer_internal)

def running(self) -> None:
self.mac_cache.start()
self.epg.start()

def done(self) -> None:
self.epg.stop()
self.mac_cache.stop()

def wait_running(self, timeout: int) -> bool:
return self.epg.wait_running(timeout)
Expand All @@ -185,8 +190,6 @@ async def request(self, flow: http.HTTPFlow) -> None:
match api, get_query_key(flow, "action"):
case APItype.MAC, "get_ordered_list":
await self.mac_cache.load_response(flow)
case APItype.MAC, _:
self.mac_cache.stop(flow)
case APItype.XC, action if action:
self.panels.serve_all(flow, action)

Expand Down Expand Up @@ -224,16 +227,14 @@ async def response(self, flow: http.HTTPFlow) -> None:
set_epg_server(flow, self.epg, api)
else:
self.m3u_stream.start(flow)
self.mac_cache.stop_all()

# TODO progress for MAC Cache not hiding !! nee to call self.mac_cache.stop_all(), but where?
async def error(self, flow: http.HTTPFlow) -> None:
# logger.debug("ERROR %s", flow.request.pretty_url)
if not self.m3u_stream.stop(flow):
if api := await self.api_request(flow):
match api, get_query_key(flow, "action"):
case APItype.MAC, "get_ordered_list":
self.mac_cache.stop(flow)
self.mac_cache.done(flow)

def server_disconnected(self, data: ServerConnectionHookData) -> None:
# logger.debug("DISCONNECT %s %s", data.server.peername, data.server.transport_protocol)
Expand Down
Loading

0 comments on commit db2a2df

Please sign in to comment.