Skip to content

Commit

Permalink
user_proxy_cmd.dev.scan
Browse files Browse the repository at this point in the history
  • Loading branch information
sebdelsol committed Feb 26, 2024
1 parent a9f9161 commit c882068
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 19 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
[^1]: External EPG doesn't work with **local** m3u accounts.
# Download
[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.31 x64-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="29"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="29">](https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.31/Install.Sfvip.All.1.4.12.31.x64.exe)
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.590.0_</sup></sup>
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.592.0_</sup></sup>

[<img src="https://custom-icon-badges.demolab.com/badge/Sfvip All v1.4.12.31 x86-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="29"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="29">](https://github.com/sebdelsol/sfvip-all/releases/download/Sfvip.All.1.4.12.31/Install.Sfvip.All.1.4.12.31.x86.exe)
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.590.0_</sup></sup>
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.592.0_</sup></sup>

Check the [***changelog***](build/changelog.md) and ***notes***[^2].
[***Sfvip Player***](https://github.com/K4L4Uz/SFVIP-Player/tree/master) will be automatically installed if missing.
Please use [***SfvipUserProxy***](user_proxy_cmd) if you need to add or remove an user proxy for ***all users*** in ***Sfvip Player*** database.

[![download](https://img.shields.io/github/downloads/sebdelsol/sfvip-all/total?color=blue&label=Downloads&logo=github)](https://tooomm.github.io/github-release-stats/?username=sebdelsol&repository=sfvip-all) <sup>for **v1.4.12.29** and above</sup>
[![download](https://img.shields.io/github/downloads/sebdelsol/sfvip-all/total?color=blue&label=Downloads&logo=github)](https://tooomm.github.io/github-release-stats/?username=sebdelsol&repository=sfvip-all) <sup><sub>for _Sfvip All v1.4.12.29_ and above</sub></sup>

[^2]:_**Sfvip All** will ask you for network connection its first run because it relies on local proxies to do its magic._
_On **old systems** you might need to install [**vc redist**](https://learn.microsoft.com/en-GB/cpp/windows/latest-supported-vc-redist) for [**x86**](https://aka.ms/vs/17/release/vc_redist.x86.exe) or [**x64**](https://aka.ms/vs/17/release/vc_redist.x64.exe)._
Expand All @@ -33,7 +33,7 @@ The logs are to be found in the app folder:
[![Python](https://img.shields.io/badge/Python-3.11.8-fbdf79?logo=python&logoColor=fbdf79)](https://www.python.org/downloads/release/python-3118/)
[![mitmproxy](https://custom-icon-badges.demolab.com/badge/Mitmproxy-10.2.2-informational.svg?logo=mitmproxy)](https://mitmproxy.org/)
[![Style](https://custom-icon-badges.demolab.com/badge/Style-Black-000000.svg?logo=file-code&logoColor=a0a0a0)](https://black.readthedocs.io/en/stable/)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc-7810-000000.svg?logo=file-code&logoColor=a0a0a0)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)
[![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc-7822-000000.svg?logo=file-code&logoColor=a0a0a0)](https://api.codetabs.com/v1/loc/?github=sebdelsol/sfvip-all)

[![Nuitka](https://custom-icon-badges.demolab.com/badge/Nuitka-2.0.4-informational.svg?logo=tools&logoColor=61dafb)](https://nuitka.net/)
<sup><sub>**or**</sub></sup>
Expand Down
16 changes: 12 additions & 4 deletions dev/scan.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
from build_config import Build, Environments, Github, Templates
from build_config import Github

from .tools.publisher import Publisher
from .tools.scanner import VirusScanner
from .tools.templater import Templater
from .tools.utils.protocols import CfgBuild, CfgEnvironments, CfgTemplates


def do_scan(build: CfgBuild, environments: CfgEnvironments, templates: CfgTemplates) -> None:
publisher = Publisher(build, environments, Github)
VirusScanner().scan_all(build, environments, publisher)
Templater(build, environments, Github, publisher).create(templates, "Readme")


if __name__ == "__main__":
publisher = Publisher(Build, Environments, Github)
VirusScanner().scan_all(Build, Environments, publisher)
Templater(Build, Environments, Github, publisher).create(Templates, "Readme")
import build_config

do_scan(build_config.Build, build_config.Environments, build_config.Templates)
12 changes: 8 additions & 4 deletions dev/tools/templater.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,18 @@ def _get_sloc(path: Path) -> int:
return 0


def _get_exe_kwargs(python_envs: PythonEnvs, publisher: Publisher) -> dict[str, str]:
def _get_exe_kwargs(name: str, python_envs: PythonEnvs, publisher: Publisher) -> dict[str, str]:
kwargs = {}
local_versions = {local_version.bitness: local_version for local_version in publisher.get_local_versions()}
for python_env in python_envs.all:
bitness = python_env.bitness
local_version = local_versions.get(bitness)
scan = ScanFile(local_version.exe) if local_version else ScanFile
print(Ok(f". {local_version.version}.{bitness}") if local_version else Warn(f". No {bitness} version"))
print(
Ok(f". {name} {local_version.version} {bitness}")
if local_version
else Warn(f". No {name} {bitness} version")
)
kwargs |= {
f"version_{bitness}": local_version.version if local_version else "0",
f"exe_{bitness}_release": local_version.url if local_version else "",
Expand All @@ -81,9 +85,9 @@ def __init__(
pyinstaller_version = _version_of(python_envs, "PyInstaller")
mitmproxy_version = _version_of(python_envs, "mitmproxy")
if python_version and nuitka_version and pyinstaller_version and mitmproxy_version:
print(Title("Build template for"), Ok(build.name))
print(Title("Build"), Ok("template for"))
self.template_format = dict(
**_get_exe_kwargs(python_envs, publisher),
**_get_exe_kwargs(build.name, python_envs, publisher),
py_major_version=str(PythonVersion(python_version).major),
py_version_compact=python_version.replace(".", ""),
github_path=f"{github.owner}/{github.repo}",
Expand Down
2 changes: 1 addition & 1 deletion resources/README_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Check the [***changelog***](build/changelog.md) and ***notes***[^2].
[***Sfvip Player***](https://github.com/K4L4Uz/SFVIP-Player/tree/master) will be automatically installed if missing.
Please use [***SfvipUserProxy***](user_proxy_cmd) if you need to add or remove an user proxy for ***all users*** in ***Sfvip Player*** database.

[![download](https://img.shields.io/github/downloads/{github_path}/total?color=blue&label=Downloads&logo=github)](https://tooomm.github.io/github-release-stats/?username={github_owner}&repository={github_repo}) <sup>for **v1.4.12.29** and above</sup>
[![download](https://img.shields.io/github/downloads/{github_path}/total?color=blue&label=Downloads&logo=github)](https://tooomm.github.io/github-release-stats/?username={github_owner}&repository={github_repo}) <sup><sub>for _{name} v1.4.12.29_ and above</sub></sup>

[^2]:_**{name}** will ask you for network connection its first run because it relies on local proxies to do its magic._
_On **old systems** you might need to install [**vc redist**](https://learn.microsoft.com/en-GB/cpp/windows/latest-supported-vc-redist) for [**x86**](https://aka.ms/vs/17/release/vc_redist.x86.exe) or [**x64**](https://aka.ms/vs/17/release/vc_redist.x64.exe)._
Expand Down
19 changes: 14 additions & 5 deletions user_proxy_cmd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,31 @@ SfvipUserProxy --remove

# Download
[<img src="https://custom-icon-badges.demolab.com/badge/SfvipUserProxy v0.4 x64-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="29"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="29">](https://github.com/sebdelsol/sfvip-all/releases/download/SfvipUserProxy.0.4/Install.SfvipUserProxy.0.4.x64.exe)
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.575.0_</sup></sup>
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.592.0_</sup></sup>

[<img src="https://custom-icon-badges.demolab.com/badge/SfvipUserProxy v0.4 x86-informational.svg?logo=download-cloud&logoSource=feather&logoColor=white&style=flat-square" height="29"><img src="https://custom-icon-badges.demolab.com/badge/clean-brightgreen.svg?logo=shield-check&logoColor=white&style=flat-square" height="29">](https://github.com/sebdelsol/sfvip-all/releases/download/SfvipUserProxy.0.4/Install.SfvipUserProxy.0.4.x86.exe)
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.575.0_</sup></sup>
<sup><sup>_by MS Defender • 1.1.24010.10 • 1.405.592.0_</sup></sup>

# Build
[![Python](https://img.shields.io/badge/Python-3.11.8-fbdf79?logo=python&logoColor=fbdf79)](https://www.python.org/downloads/release/python-3118/)
[![Style](https://custom-icon-badges.demolab.com/badge/Style-Black-000000.svg?logo=file-code&logoColor=a0a0a0)](https://black.readthedocs.io/en/stable/)
![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc-173-000000.svg?logo=file-code&logoColor=a0a0a0)
![Sloc](https://custom-icon-badges.demolab.com/badge/Sloc-203-000000.svg?logo=file-code&logoColor=a0a0a0)

[![Nuitka](https://custom-icon-badges.demolab.com/badge/Nuitka-2.0.3-informational.svg?logo=tools&logoColor=61dafb)](https://nuitka.net/)
[![Nuitka](https://custom-icon-badges.demolab.com/badge/Nuitka-2.0.4-informational.svg?logo=tools&logoColor=61dafb)](https://nuitka.net/)
<sup><sub>**or**</sub></sup>
[![PyInstaller](https://custom-icon-badges.demolab.com/badge/PyInstaller-6.4.0-informational.svg?logo=tools&logoColor=61dafb)](https://pyinstaller.org/en/stable/)

[![Nsis](https://img.shields.io/badge/Nsis-3.09-informational?logo=NSIS&logoColor=fbdf79)](https://nsis.sourceforge.io/Download)

```console
python -m user_proxy_cmd.dev.build [--x86 | --x64 | --both] [--pyinstaller | --mingw] [--nobuild | --noinstaller | --readme] [--publish]
```
```
### Publish a release
```console
python -m user_proxy_cmd.dev.publish [--x86 | --x64 | --both] [--version VERSION] [--info]
```
### Scan for virus
It updates _Microsoft Defender_ engine and signatures before scanning:
```console
python -m user_proxy_cmd.dev.scan [--x86 | --x64 | --both]
```
5 changes: 5 additions & 0 deletions user_proxy_cmd/dev/scan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from dev.scan import do_scan
from user_proxy_cmd import cmd_build_config

if __name__ == "__main__":
do_scan(cmd_build_config.Build, cmd_build_config.Environments, cmd_build_config.Templates)
11 changes: 10 additions & 1 deletion user_proxy_cmd/resources/README_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,13 @@ _Remove it:_

```console
python -m user_proxy_cmd.dev.build [--x86 | --x64 | --both] [--pyinstaller | --mingw] [--nobuild | --noinstaller | --readme] [--publish]
```
```
### Publish a release
```console
python -m user_proxy_cmd.dev.publish [--x86 | --x64 | --both] [--version VERSION] [--info]
```
### Scan for virus
It updates _Microsoft Defender_ engine and signatures before scanning:
```console
python -m user_proxy_cmd.dev.scan [--x86 | --x64 | --both]
```

0 comments on commit c882068

Please sign in to comment.