From 61c5ae0556721ca6c4afa04a0b4cd10dd9a4d11f Mon Sep 17 00:00:00 2001 From: Dag0d Date: Tue, 16 Mar 2021 13:38:45 +0100 Subject: [PATCH 1/6] Updated German translation --- Translations/translation_DE.json | 34 ++++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Translations/translation_DE.json b/Translations/translation_DE.json index 13383ac3..e09bb542 100644 --- a/Translations/translation_DE.json +++ b/Translations/translation_DE.json @@ -38,7 +38,7 @@ "SettingFastChar": "S", "SettingSlowChar": "L", "SettingMediumChar": "M", - "SettingOffChar":"A", + "SettingOffChar": "A", "SettingStartSolderingChar": "L", "SettingStartSleepChar": "R", "SettingStartSleepOffChar": "K", @@ -55,10 +55,10 @@ "menuGroups": { "PowerMenu": { "text2": [ - "Power", - "settings" + "Energie-", + "einstellungen" ], - "desc": "Power settings" + "desc": "Energieeinstellungen" }, "SolderingMenu": { "text2": [ @@ -289,37 +289,37 @@ "MinVolCell": { "text2": [ "Minimum", - "voltage" + "Spannung" ], - "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + "desc": "Minimal zulässige Spannung pro Zelle <3S - 3,0V - 3,7V, 4/5/6S - 2,4V - 3,7V>" }, "AnimLoop": { "text2": [ "Anim.", - "loop" + "Schleife" ], - "desc": "Loop icon animations in root menu" + "desc": "Icon-Animationen im Stammmenü wiederholen" }, "AnimSpeed": { "text2": [ "Anim.", - "speed" + "Geschw." ], - "desc": "Speed of icon animations in menu " + "desc": "Geschwindigkeit der Icon-Animationen im Menü " }, "PowerPulseWait": { "text2": [ - "Power pulse", - "wait time" + "Leistungsimpulse", + "Wartezeit" ], - "desc": "Time to wait before triggering every keep-awake pulse (x 2.5s)" + "desc": "Wartezeit vor dem Auslösen jedes Wachhalteimpulses (x 2,5s)" }, "PowerPulseDuration": { "text2": [ - "Power pulse", - "duration" + "Leistungsimpulse", + "Dauer" ], - "desc": "Keep-awake-pulse duration (x 250ms)" + "desc": "Dauer des Wachhalteimpulses (x 250ms)" } } -} +} \ No newline at end of file From 69980e6879a5ad4198a64fbee50ee5eed8770c97 Mon Sep 17 00:00:00 2001 From: federicodilo <68966053+federicodilo@users.noreply.github.com> Date: Tue, 16 Mar 2021 17:03:03 +0100 Subject: [PATCH 2/6] Updates in italian translation --- Translations/translation_IT.json | 76 ++++++++++++++++---------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/Translations/translation_IT.json b/Translations/translation_IT.json index 79a19ec3..bcf62601 100644 --- a/Translations/translation_IT.json +++ b/Translations/translation_IT.json @@ -49,15 +49,15 @@ "SettingLockDisableChar": "D", "SettingLockBoostChar": "T", "SettingLockFullChar": "C", - "SettingNAChar": "N/A" + "SettingNAChar": "NA" }, "menuGroups": { "PowerMenu": { "text2": [ - "Power", - "settings" + "Opzioni", + "alimentaz" ], - "desc": "Power settings" + "desc": "Menù d'impostazioni per l'alimentazione" }, "SolderingMenu": { "text2": [ @@ -94,42 +94,42 @@ "Sorgente", "alimentaz" ], - "desc": "Scegli la sorgente di alimentazione; se a batteria, limita lo scaricamento al valore di soglia " + "desc": "Imposta una tensione minima di alimentazione attraverso la selezione di una sorgente [DC: 10 V; 3S/4S/5S/6S: 3,3 V per cella]" }, "SleepTemperature": { "text2": [ "Temp", "riposo" ], - "desc": "Imposta la temperatura da mantenere in modalità Riposo <°C/°F>" + "desc": "Imposta la temperatura da mantenere in modalità Riposo [°C/°F]" }, "SleepTimeout": { "text2": [ "Timer", "riposo" ], - "desc": "Imposta il timer per entrare in modalità Riposo " + "desc": "Imposta il timer per entrare in modalità Riposo [minuti/secondi]" }, "ShutdownTimeout": { "text2": [ "Timer", "spegnimento" ], - "desc": "Imposta il timer per lo spegnimento " + "desc": "Imposta il timer per lo spegnimento [minuti]" }, "MotionSensitivity": { "text2": [ "Sensibilità", "al movimento" ], - "desc": "Imposta la sensibilità al movimento per uscire dalla modalità Riposo <0: nessuna; 1: minima; 9: massima>" + "desc": "Imposta la sensibilità al movimento per uscire dalla modalità Riposo [0: nessuna; 1: minima; 9: massima]" }, "TemperatureUnit": { "text2": [ "Unità di", "temperatura" ], - "desc": "Scegli l'unità di misura per la temperatura " + "desc": "Scegli l'unità di misura per la temperatura [C: grado Celsius; F: grado Farenheit]" }, "AdvancedIdle": { "text2": [ @@ -143,21 +143,21 @@ "Orientamento", "display" ], - "desc": "Imposta l'orientamento del display " + "desc": "Imposta l'orientamento del display [A: automatico; S: mano sinistra; D: mano destra]" }, "BoostTemperature": { "text2": [ "Temp", - "«Turbo»" + "Turbo" ], - "desc": "Imposta la temperatura della funzione «Turbo» <°C/°F>" + "desc": "Imposta la temperatura della funzione Turbo [°C/°F]" }, "AutoStart": { "text2": [ "Avvio", "automatico" ], - "desc": "Attiva automaticamente il saldatore quando viene alimentato " + "desc": "Attiva automaticamente il saldatore quando viene alimentato [D: disattiva; S: saldatura; R: riposo; A: temperatura ambiente]" }, "CooldownBlink": { "text2": [ @@ -199,7 +199,7 @@ "Velocità", "testo" ], - "desc": "Imposta la velocità di scorrimento del testo " + "desc": "Imposta la velocità di scorrimento del testo [L: lenta; V: veloce]" }, "TipModel": { "text2": [ @@ -213,7 +213,7 @@ "Calibrazione", "semplice" ], - "desc": "Calibra le rilevazioni di temperatura tramite l'utilizzo di acqua calda" + "desc": "Calibra le rilevazioni di temperatura tramite l'utilizzo di acqua in ebollizione" }, "AdvancedCalibrationMode": { "text2": [ @@ -227,14 +227,14 @@ "Voltaggio", "Quick Charge" ], - "desc": "Imposta il massimo voltaggio necessario alla negoziazione con un alimentatore Quick Charge" + "desc": "Imposta il massimo voltaggio negoziabile con un alimentatore Quick Charge" }, "PowerLimit": { "text2": [ "Limite", "potenza" ], - "desc": "Imposta il valore di potenza massima erogabile al saldatore " + "desc": "Imposta il valore di potenza massima erogabile al saldatore [watt]" }, "ReverseButtonTempChange": { "text2": [ @@ -248,21 +248,21 @@ "Temp passo", "breve" ], - "desc": "Imposta il «passo» dei valori di temperatura ad una breve pressione dei tasti" + "desc": "Imposta il \"passo\" dei valori di temperatura per una breve pressione dei tasti" }, "TempChangeLongStep": { "text2": [ "Temp passo", "lungo" ], - "desc": "Imposta il «passo» dei valori di temperatura ad una lunga pressione dei tasti" + "desc": "Imposta il \"passo\" dei valori di temperatura per una lunga pressione dei tasti" }, "PowerPulsePower": { "text2": [ "Potenza", "impulso" ], - "desc": "Regola la potenza d'impulso per prevenire lo standby eventuale dell'alimentatore " + "desc": "Regola la potenza di un \"impulso sveglia\" atto a prevenire lo standby eventuale dell'alimentatore [watt]" }, "TipGain": { "text2": [ @@ -276,49 +276,49 @@ "Effetto", "Hall" ], - "desc": "Regola la sensibilità alla rilevazione di supporti metallici per entrare in modalità Riposo " + "desc": "Regola la sensibilità alla rilevazione di supporti metallici per entrare in modalità Riposo [O: OFF; B: bassa; M: media; A: alta]" }, "LockingMode": { "text2": [ "Blocco", "tasti" ], - "desc": "Blocca i tasti durante la modalità Saldatura; tieni premuto entrambi per bloccare/sbloccare " + "desc": "Blocca i tasti durante la modalità Saldatura; tieni premuto entrambi per bloccare o sbloccare [D: disattiva; T: blocca Turbo; C: blocco completo]" }, "MinVolCell": { "text2": [ - "Minimum", - "voltage" + "Tensione", + "min celle" ], - "desc": "Minimum allowed voltage per cell <3S — 3.0V - 3.7V, 4/5/6S — 2.4V - 3.7V>" + "desc": "Modifica il valore di tensione minima \"di scaricamento\" per le celle di una batteria Li-Po [3S: 3,0-3,7 V; 4S/5S/6S: 2,4-3,7 V]" }, "AnimLoop": { "text2": [ - "Anim.", - "loop" + "Ciclo", + "animazioni" ], - "desc": "Loop icon animations in root menu" + "desc": "Abilita la riproduzione ciclica delle animazioni del menù principale" }, "AnimSpeed": { "text2": [ - "Anim.", - "speed" + "Velocità", + "animazioni" ], - "desc": "Speed of icon animations in menu " + "desc": "Imposta la velocità di riproduzione delle animazioni del menù principale [O: OFF; L: lenta; M: media; V: veloce]" }, "PowerPulseWait": { "text2": [ - "Power pulse", - "wait time" + "Distanza", + "impulsi" ], - "desc": "Time to wait before triggering every keep-awake pulse (x 2.5s)" + "desc": "Imposta il tempo che deve intercorrere tra due \"impulsi sveglia\" [multipli di 2,5 s]" }, "PowerPulseDuration": { "text2": [ - "Power pulse", - "duration" + "Durata", + "impulso" ], - "desc": "Keep-awake-pulse duration (x 250ms)" + "desc": "Regola la durata dell'«impulso sveglia» [multipli di 250 ms]" } } } From ca5463565c161b0c4526bf048b23be26ba2daee8 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Wed, 17 Mar 2021 20:46:28 +1100 Subject: [PATCH 3/6] Create dependabot.yml --- .github/dependabot.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..d35f504b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 + # Fetch and update latest `github-actions` pkgs + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + time: '00:00' + open-pull-requests-limit: 10 + commit-message: + prefix: chore + include: scope \ No newline at end of file From 664d2647d50e9b3225f66a39d929d975e23a4610 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Wed, 17 Mar 2021 20:49:02 +1100 Subject: [PATCH 4/6] Create SECURITY.md --- SECURITY.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..1f369b12 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,18 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| Latest Release | :white_check_mark: | +| master | :white_check_mark: | + +## Reporting a Vulnerability + +1. Report in an issue please and tag @ralim +2. All issues are read within 1 working week in general; often within 24 hours +3. Issue shall recieve a comment within 14 days; but goal is < 2. +4. Issue will be open until the vulnerability is closed in all supported versions From 9a61f654aa64015219a8bc41389e5ae5f22d16ce Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" <5425387+Ralim@users.noreply.github.com> Date: Wed, 17 Mar 2021 20:51:38 +1100 Subject: [PATCH 5/6] Create codeql-analysis.yml --- .github/workflows/codeql-analysis.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/codeql-analysis.yml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..a931540e --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,58 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ master ] + schedule: + - cron: '38 23 * * 6' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'cpp', 'javascript', 'python' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] + # Learn more: + # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + + - run: | + chmod +x setup.sh && chmod +x source/build.sh && sudo mkdir -p /build/cache && sudo chmod -R 777 /build + ./setup.sh + cd source && ./build.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 From f831b74e57fc99fc905eebdcb273d1d1a8f98872 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Wed, 17 Mar 2021 21:12:45 +1100 Subject: [PATCH 6/6] Cleanup security warnings --- Translations/make_translation.py | 34 +++++++++++-------- build.sh | 2 -- source/Core/BSP/Miniware/flash.c | 2 +- source/Core/BSP/Pine64/flash.c | 2 +- source/Core/Drivers/FUSB302/policy_engine.cpp | 2 +- source/build.sh | 2 +- 6 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 build.sh diff --git a/Translations/make_translation.py b/Translations/make_translation.py index 38171344..81290746 100755 --- a/Translations/make_translation.py +++ b/Translations/make_translation.py @@ -23,6 +23,7 @@ except NameError: @functools.lru_cache(maxsize=None) def cjkFont(): from bdflib import reader as bdfreader + with open(os.path.join(HERE, "wqy-bitmapsong/wenquanyi_9pt.bdf"), "rb") as f: return bdfreader.read_bdf(f) @@ -43,7 +44,7 @@ def loadJson(fileName, skipFirstLine): def readTranslation(jsonDir, langCode): - fileName = 'translation_{}.json'.format(langCode) + fileName = "translation_{}.json".format(langCode) fileWithPath = os.path.join(jsonDir, fileName) @@ -184,8 +185,10 @@ def getLetterCounts(defs, lang): symbolCounts.reverse() return symbolCounts + def getCJKGlyph(sym): from bdflib.model import Glyph + try: glyph: Glyph = cjkFont()[ord(sym)] except: @@ -213,6 +216,7 @@ def getCJKGlyph(sym): return True else: return False + # A glyph in the font table is divided into upper and lower parts, each by # 8px high. Each byte represents half if a column, with the LSB being the # top-most pixel. The data goes from the left-most to the right-most column @@ -228,6 +232,7 @@ def getCJKGlyph(sym): s += f"0x{b:02X}," return s + def getFontMapAndTable(textList): # the text list is sorted # allocate out these in their order as number codes @@ -244,7 +249,7 @@ def getFontMapAndTable(textList): # number of symbols allowed with 8 bits is `256 - 2`. if totalSymbolCount > (256 - 2): log(f"Error, too many used symbols for this version (total {totalSymbolCount})") - exit(1) + sys.exit(1) log("Generating fonts for {} symbols".format(totalSymbolCount)) for sym in textList: @@ -259,12 +264,12 @@ def getFontMapAndTable(textList): for sym in forcedFirstSymbols: if sym not in fontTable: log("Missing Large font element for {}".format(sym)) - exit(1) + sys.exit(1) fontLine = fontTable[sym] fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym], sym)) if sym not in fontSmallTable: log("Missing Small font element for {}".format(sym)) - exit(1) + sys.exit(1) fontLine = fontSmallTable[sym] fontSmallTableStrings.append( fontLine + "//{} -> {}".format(symbolMap[sym], sym) @@ -276,7 +281,7 @@ def getFontMapAndTable(textList): fromFont = getCJKGlyph(sym) if fromFont is None: log("Missing Large font element for {}".format(sym)) - exit(1) + sys.exit(1) # We store the glyph back to the fontTable. fontTable[sym] = fromFont # We also put a "replacement character" in the small font table @@ -287,7 +292,7 @@ def getFontMapAndTable(textList): fontTableStrings.append(fontLine + "//{} -> {}".format(symbolMap[sym], sym)) if sym not in fontSmallTable: log("Missing Small font element for {}".format(sym)) - exit(1) + sys.exit(1) fontLine = fontSmallTable[sym] fontSmallTableStrings.append( fontLine + "//{} -> {}".format(symbolMap[sym], sym) @@ -317,7 +322,7 @@ def convStr(symbolConversionTable, text): def writeLanguage(lang, defs, f): - languageCode = lang['languageCode'] + languageCode = lang["languageCode"] log("Generating block for " + languageCode) # Iterate over all of the text to build up the symbols & counts textList = getLetterCounts(defs, lang) @@ -516,10 +521,11 @@ def writeLanguage(lang, defs, f): ) f.write(to_unicode("};\n\n")) - f.write("const bool HasFahrenheit = " + ( - "true" if lang.get('tempUnitFahrenheit', True) else "false") + - ";\n") - + f.write( + "const bool HasFahrenheit = " + + ("true" if lang.get("tempUnitFahrenheit", True) else "false") + + ";\n" + ) def readVersion(jsonDir): @@ -567,9 +573,9 @@ def orderOutput(langDict): def parseArgs(): parser = argparse.ArgumentParser() parser.add_argument( - '--output', '-o', - help='Target file', type=argparse.FileType('w'), required=True) - parser.add_argument('languageCode', help='Language to generate') + "--output", "-o", help="Target file", type=argparse.FileType("w"), required=True + ) + parser.add_argument("languageCode", help="Language to generate") return parser.parse_args() diff --git a/build.sh b/build.sh deleted file mode 100644 index 10f26c0d..00000000 --- a/build.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -docker-compose run --rm builder /bin/bash /build/ci/buildAll.sh \ No newline at end of file diff --git a/source/Core/BSP/Miniware/flash.c b/source/Core/BSP/Miniware/flash.c index d764df93..1d5469ee 100644 --- a/source/Core/BSP/Miniware/flash.c +++ b/source/Core/BSP/Miniware/flash.c @@ -30,7 +30,7 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) { // now we program it uint16_t *data = (uint16_t *)buffer; HAL_FLASH_Unlock(); - for (uint8_t i = 0; i < (length / 2); i++) { + for (uint16_t i = 0; i < (length / 2); i++) { resetWatchdog(); HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, (uint32_t)&settings_page[i], data[i]); } diff --git a/source/Core/BSP/Pine64/flash.c b/source/Core/BSP/Pine64/flash.c index 95aa4fe5..8c0ce3f5 100644 --- a/source/Core/BSP/Pine64/flash.c +++ b/source/Core/BSP/Pine64/flash.c @@ -26,7 +26,7 @@ uint8_t flash_save_buffer(const uint8_t *buffer, const uint16_t length) { fmc_page_erase((uint32_t)SETTINGS_START_PAGE); resetWatchdog(); uint16_t *data = (uint16_t *)buffer; - for (uint8_t i = 0; i < (length / 2); i++) { + for (uint16_t i = 0; i < (length / 2); i++) { fmc_halfword_program((uint32_t)SETTINGS_START_PAGE + (i * 2), data[i]); fmc_flag_clear(FMC_FLAG_END); fmc_flag_clear(FMC_FLAG_WPERR); diff --git a/source/Core/Drivers/FUSB302/policy_engine.cpp b/source/Core/Drivers/FUSB302/policy_engine.cpp index e8358f5b..2ab7f99a 100644 --- a/source/Core/Drivers/FUSB302/policy_engine.cpp +++ b/source/Core/Drivers/FUSB302/policy_engine.cpp @@ -213,7 +213,7 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_eval_cap() { * than the maximum possible) */ _pps_index = 8; /* Search for the first PPS APDO */ - for (int8_t i = 0; i < PD_NUMOBJ_GET(&tempMessage); i++) { + for (int i = 0; i < PD_NUMOBJ_GET(&tempMessage); i++) { if ((tempMessage.obj[i] & PD_PDO_TYPE) == PD_PDO_TYPE_AUGMENTED && (tempMessage.obj[i] & PD_APDO_TYPE) == PD_APDO_TYPE_PPS) { _pps_index = i + 1; break; diff --git a/source/build.sh b/source/build.sh index e07e102f..f8d30751 100644 --- a/source/build.sh +++ b/source/build.sh @@ -1,5 +1,5 @@ #!/bin/bash - +set -e TRANSLATION_DIR="../Translations" TRANSLATION_SCRIPT="make_translation.py"