Skip to content

Commit b472e18

Browse files
authored
Dev 3.2.6 (#16)
updated: - codeql workflow added: - compatibility mode (NO_COLOR) - main/dev branch to updater.py Former-commit-id: 1187cb3
1 parent 378a90f commit b472e18

File tree

7 files changed

+139
-71
lines changed

7 files changed

+139
-71
lines changed

.github/workflows/codeql.yml

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,61 +19,73 @@ on:
1919

2020
jobs:
2121
analyze:
22-
name: Analyze
22+
name: Analyze (${{ matrix.language }})
2323
# Runner size impacts CodeQL analysis time. To learn more, please see:
2424
# - https://gh.io/recommended-hardware-resources-for-running-codeql
2525
# - https://gh.io/supported-runners-and-hardware-resources
26-
# - https://gh.io/using-larger-runners
27-
# Consider using larger runners for possible analysis time improvements.
26+
# - https://gh.io/using-larger-runners (GitHub.com only)
27+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
2828
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
2929
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
3030
permissions:
31+
# required for all workflows
32+
security-events: write
33+
34+
# required to fetch internal or private CodeQL packs
35+
packages: read
36+
37+
# only required for workflows in private repositories
3138
actions: read
3239
contents: read
33-
security-events: write
3440

3541
strategy:
3642
fail-fast: false
3743
matrix:
38-
language: [ 'python' ]
39-
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
40-
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
41-
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
42-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
43-
44+
include:
45+
- language: python
46+
build-mode: none
47+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
48+
# Use `c-cpp` to analyze code written in C, C++ or both
49+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
50+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
51+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
52+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
53+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
54+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
4455
steps:
4556
- name: Checkout repository
46-
uses: actions/checkout@v3
57+
uses: actions/checkout@v4
4758

4859
# Initializes the CodeQL tools for scanning.
4960
- name: Initialize CodeQL
50-
uses: github/codeql-action/init@v2
61+
uses: github/codeql-action/init@v3
5162
with:
5263
languages: ${{ matrix.language }}
64+
build-mode: ${{ matrix.build-mode }}
5365
# If you wish to specify custom queries, you can do so here or in a config file.
5466
# By default, queries listed here will override any specified in a config file.
5567
# Prefix the list here with "+" to use these queries and those in the config file.
5668

5769
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
5870
# queries: security-extended,security-and-quality
5971

60-
61-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
62-
# If this step fails, then you should remove it and run the build manually (see below)
63-
- name: Autobuild
64-
uses: github/codeql-action/autobuild@v2
65-
72+
# If the analyze step fails for one of the languages you are analyzing with
73+
# "We were unable to automatically build your code", modify the matrix above
74+
# to set the build mode to "manual" for that language. Then modify this step
75+
# to build your code.
6676
# ℹ️ Command-line programs to run using the OS shell.
6777
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
68-
69-
# If the Autobuild fails above, remove it and uncomment the following three lines.
70-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
71-
72-
# - run: |
73-
# echo "Run, Build Application using script"
74-
# ./location_of_script_within_repo/buildscript.sh
78+
- if: matrix.build-mode == 'manual'
79+
shell: bash
80+
run: |
81+
echo 'If you are using a "manual" build mode for one or more of the' \
82+
'languages you are analyzing, replace this with the commands to build' \
83+
'your code, for example:'
84+
echo ' make bootstrap'
85+
echo ' make release'
86+
exit 1
7587
7688
- name: Perform CodeQL Analysis
77-
uses: github/codeql-action/analyze@v2
89+
uses: github/codeql-action/analyze@v3
7890
with:
7991
category: "/language:${{matrix.language}}"

__src__/dank.tool.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def dank_tool_banner():
5858

5959
def palestine_banner():
6060

61-
cls()
61+
#cls()
6262
banner = '\n[red]###[black]###########################################\n[red]#####[black]#########################################\n[red]########[black]######################################\n[red]##########[black]####################################\n[red]############[white]##################################\n[red]##############[white]################################\n[red]################[white]##############################\n[red]##############[white]################################\n[red]############[white]##################################\n[red]##########[green]####################################\n[red]########[green]######################################\n[red]#####[green]#########################################\n[red]###[green]###########################################\n'
6363
console = Console(highlight=False)
6464
console.print(Align.center(banner), style="blink")
@@ -755,7 +755,7 @@ def dank_github_software(software):
755755
if os.path.isfile(r"C:\Users\SirDank\AppData\Local\Discord\Update.exe"):
756756
print(clr(f"\n - {_translate('Discord found!')}"))
757757
else:
758-
print(clr(f"\n - {_translate('Discord not found!')}\n\n - {_translate('Downloading Discord...')}"))
758+
print(clr(f"\n - {_translate('Discord not found!')}\n\n - {_translate('Downloading Discord...')}\n"))
759759
os.system("winget install --accept-source-agreements --interactive --id Discord.Discord")
760760
input(clr(f"\n > {_translate('Press [ ENTER ] after installing Discord...')} "))
761761
asset = [_ for _ in session.get("https://api.github.com/repos/Vencord/Installer/releases/latest").json()["assets"] if _["browser_download_url"].endswith("VencordInstaller.exe")][0]
@@ -883,7 +883,7 @@ def patch():
883883
else:
884884
print(clr(f"\n - {_translate('WinRAR not installed!')}"))
885885
if ONLINE_MODE:
886-
print(clr(f"\n - {_translate('Downloading WinRAR...')}"))
886+
print(clr(f"\n - {_translate('Downloading WinRAR...')}\n"))
887887
os.system("winget install --accept-source-agreements --interactive --id RARLab.WinRAR")
888888
input(clr(f"\n > {_translate('Press [ENTER] after installing WinRAR to start patching...')} "))
889889
patch()
@@ -930,7 +930,7 @@ def patch():
930930
else:
931931
print(clr(f"\n - {_translate('RevoUninstallerPro not installed!')}"))
932932
if ONLINE_MODE:
933-
print(clr(f"\n - {_translate('Downloading RevoUninstallerPro...')}"))
933+
print(clr(f"\n - {_translate('Downloading RevoUninstallerPro...')}\n"))
934934
os.system("winget install --accept-source-agreements --interactive --id RevoUninstaller.RevoUninstallerPro")
935935
input(clr(f"\n > {_translate('Press [ENTER] after installing RevoUninstallerPro to start patching...')} "))
936936
patch()
@@ -942,7 +942,6 @@ def patch():
942942
set_globals_one()
943943
_translator = Translator()
944944
palestine_banner() # 🍉
945-
time.sleep(2) # 🍉
946945

947946
# multithreaded requests responses, download modules / assets
948947

__src__/executor.py

Lines changed: 87 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
import subprocess
2525
import tkinter as tk
2626
from locale import getlocale
27+
from rich.align import Align
2728
from psutil import process_iter
2829
from playsound import playsound
30+
from rich.console import Console
2931
from translatepy import Translator
3032
from gzip import compress, decompress
3133
from dateutil.tz import tzlocal, tzutc
@@ -54,18 +56,6 @@
5456
import winreg
5557
from win11toast import notify
5658

57-
# variables
58-
59-
DANK_TOOL_VERSION = "3.2.5"
60-
session = requests.Session()
61-
_executor = ThreadPoolExecutor(10)
62-
headers = {"User-Agent": f"dank.tool {DANK_TOOL_VERSION}"}
63-
os.environ['DANK_TOOL_VERSION'] = DANK_TOOL_VERSION
64-
65-
os.chdir(os.path.dirname(__file__))
66-
title("𝚍𝚊𝚗𝚔.𝚝𝚘𝚘𝚕 [ 𝚒𝚗𝚒𝚝𝚒𝚊𝚕𝚒𝚣𝚒𝚗𝚐 ]")
67-
print(clr(f"\n - Version: {DANK_TOOL_VERSION}"))
68-
6959
# rediect stderr to a file
7060
#if not os.path.exists('__logs__'): os.mkdir('__logs__')
7161
#sys.stderr = open('__logs__/dank.tool.log', 'w', encoding='utf-8')
@@ -76,15 +66,16 @@ def settings_json():
7666

7767
overwrite = False
7868
default_settings = {
79-
"offline-src": "0",
80-
"offline-mode": "0",
81-
"dev-branch": "0",
82-
"force-update": "0",
83-
"force-translate": "0",
84-
"disable-translate": "0",
85-
"force-startup-audio": "0",
86-
"disable-startup-audio": "0",
87-
}
69+
"offline-src": "0",
70+
"offline-mode": "0",
71+
"dev-branch": "0",
72+
"force-update": "0",
73+
"force-translate": "0",
74+
"disable-translate": "0",
75+
"compatibility-mode": "0",
76+
"force-startup-audio": "0",
77+
"disable-startup-audio": "0",
78+
}
8879

8980
if not os.path.isfile('settings.json'):
9081
overwrite = True
@@ -97,10 +88,11 @@ def settings_json():
9788
else:
9889
default_settings[key] = data[key]
9990

100-
default_settings["force-translate"] = ("0" if not os.path.isfile("force-translate") else "1")
101-
default_settings["disable-translate"] = ("0" if not os.path.isfile("disable-translate") else "1")
102-
default_settings["force-startup-audio"] = ("0" if not os.path.isfile("force-startup-audio") else "1")
103-
default_settings["disable-startup-audio"] = ("0" if not os.path.isfile("disable-startup-audio") else "1")
91+
default_settings["force-translate"] = ("1" if os.path.isfile("force-translate") else "0")
92+
default_settings["disable-translate"] = ("1" if os.path.isfile("disable-translate") else "0")
93+
default_settings["compatibility-mode"] = ("1" if os.path.isfile("compatibility-mode") else "0")
94+
default_settings["force-startup-audio"] = ("1" if os.path.isfile("force-startup-audio") else "0")
95+
default_settings["disable-startup-audio"] = ("1" if os.path.isfile("disable-startup-audio") else "0")
10496

10597
if not overwrite and default_settings != data:
10698
overwrite = True
@@ -114,17 +106,75 @@ def settings_json():
114106

115107
with open('settings.json', 'r', encoding='utf-8') as _:
116108
DANK_TOOL_SETTINGS = json.loads(_.read())
109+
os.environ['DANK_TOOL_COMPATIBILITY_MODE'] = DANK_TOOL_SETTINGS['compatibility-mode']
117110
os.environ['DANK_TOOL_OFFLINE_SRC'] = DANK_TOOL_SETTINGS['offline-src']
118111
os.environ['DANK_TOOL_DEV_BRANCH'] = DANK_TOOL_SETTINGS['dev-branch']
119112
OFFLINE_SRC = int(DANK_TOOL_SETTINGS['offline-src'])
120113
DEV_BRANCH = int(DANK_TOOL_SETTINGS['dev-branch'])
121114
BRANCH = ("main" if not DEV_BRANCH else "dev")
122115

116+
# compatability mode
117+
118+
if int(DANK_TOOL_SETTINGS['compatibility-mode']) or (os.getlogin() == 'xuser' and os.getenv("COMPUTERNAME") == 'LOCALHOST'):
119+
120+
# https://no-color.org/
121+
os.environ['NO_COLOR'] = '1'
122+
import dankware
123+
dankware.reset = ''
124+
dankware.black = ''
125+
dankware.blue = ''
126+
dankware.cyan = ''
127+
dankware.green = ''
128+
dankware.magenta = ''
129+
dankware.red = ''
130+
dankware.white = ''
131+
dankware.yellow = ''
132+
dankware.black_bright = ''
133+
dankware.blue_bright = ''
134+
dankware.cyan_bright = ''
135+
dankware.green_bright = ''
136+
dankware.magenta_bright = ''
137+
dankware.red_bright = ''
138+
dankware.white_bright = ''
139+
dankware.yellow_bright = ''
140+
dankware.black_normal = ''
141+
dankware.blue_normal = ''
142+
dankware.cyan_normal = ''
143+
dankware.green_normal = ''
144+
dankware.magenta_normal = ''
145+
dankware.red_normal = ''
146+
dankware.white_normal = ''
147+
dankware.yellow_normal = ''
148+
dankware.black_dim = ''
149+
dankware.blue_dim = ''
150+
dankware.cyan_dim = ''
151+
dankware.green_dim = ''
152+
dankware.magenta_dim = ''
153+
dankware.red_dim = ''
154+
dankware.white_dim = ''
155+
dankware.yellow_dim = ''
156+
dankware.clr = lambda *args: args[0]
157+
from dankware import clr, reset, black, blue, cyan, green, magenta, red, white, yellow, black_bright, blue_bright, cyan_bright, green_bright, magenta_bright, red_bright, white_bright, yellow_bright, black_normal, blue_normal, cyan_normal, green_normal, magenta_normal, red_normal, white_normal, yellow_normal, black_dim, blue_dim, cyan_dim, green_dim, magenta_dim, red_dim, white_dim, yellow_dim # pylint: disable=reimported
158+
159+
# variables
160+
161+
DANK_TOOL_VERSION = "3.2.6"
162+
session = requests.Session()
163+
_executor = ThreadPoolExecutor(10)
164+
headers = {"User-Agent": f"dank.tool {DANK_TOOL_VERSION}"}
165+
os.environ['DANK_TOOL_VERSION'] = DANK_TOOL_VERSION
166+
167+
os.chdir(os.path.dirname(__file__))
168+
title("𝚍𝚊𝚗𝚔.𝚝𝚘𝚘𝚕 [ 𝚒𝚗𝚒𝚝𝚒𝚊𝚕𝚒𝚣𝚒𝚗𝚐 ]")
169+
print(clr(f"\n - Version: {DANK_TOOL_VERSION}"))
170+
123171
# handle KeyboardInterrupt
124172

125173
def print_warning_symbol():
126174

127-
cls(); print(align(f'\n\n{red} ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red} ██ {white_bright}██████{red_normal} ██ \n{red}██ {white_bright}██████{red_normal} ██\n{red}██ ██\n{red} ██████████████████████████████████████████ \n\n'))
175+
cls()
176+
banner = '\n\n[red] ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ ██ \n[red] ██ [bright_white]██████[red] ██ \n[red] ██ [bright_white]██████[red] ██ \n[red]██ [bright_white]██████[red] ██\n[red]██ ██\n[red] ██████████████████████████████████████████ \n\n'
177+
Console().print(Align.center(banner), style="blink", highlight=False)
128178

129179
# get latest version number
130180

@@ -206,6 +256,9 @@ def dank_tool_installer():
206256
else: # LATEST VERSION IS LOWER THAN CURRENT VERSION
207257
print(clr("\n - Development Version!"))
208258

259+
if OFFLINE_SRC:
260+
print(clr("\n - Offline SRC!"))
261+
209262
# check windows language
210263

211264
def check_system_language():
@@ -352,11 +405,16 @@ def dank_tool_chatroom():
352405
except:
353406

354407
cls()
355-
err_message = err(sys.exc_info())
408+
err_message = err(sys.exc_info(), 'mini')
356409
print(clr(err_message, 2))
357410
LATEST_VERSION = latest_dank_tool_version()
358411

359-
if "Error Type: KeyboardInterrupt" in err_message:
412+
if "- SystemExit" in err_message:
413+
os.system("taskkill /f /t /im dank.tool.exe")
414+
elif "- EOFError" in err_message:
415+
print_warning_symbol()
416+
print(clr("\n - No input provided!"))
417+
elif "- KeyboardInterrupt" in err_message:
360418
print_warning_symbol()
361419
print(clr("\n - Please select text first and then use [ CTRL + C ]!"))
362420

@@ -367,7 +425,7 @@ def dank_tool_chatroom():
367425
elif ONLINE_MODE:
368426
while True:
369427
try:
370-
requests.post("https://dank-site.onrender.com/dank-tool-errors", headers=headers, timeout=3, data={"text": f"```<--- 🚨🚨🚨 ---> v{DANK_TOOL_VERSION} | OFFLINE_SRC: {bool(OFFLINE_SRC)} | BRANCH: {BRANCH}\n\n{err_message}```"})
428+
requests.post("https://dank-site.onrender.com/dank-tool-errors", headers=headers, timeout=3, data={"text": f"```<--- 🚨🚨🚨 ---> v{DANK_TOOL_VERSION}{' OFFLINE_SRC' if OFFLINE_SRC else ''} BRANCH: {BRANCH}\n\n{err_message}```"})
371429
break
372430
except Exception as exc:
373431
input(clr(f"\n > Failed to post error report! {exc} | Press [ENTER] to try again... ",2))

__src__/executor_version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.2.5
1+
3.2.6

0 commit comments

Comments
 (0)