diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..999ed12 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,44 @@ +name: CodeQL + +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: '14 8 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: + - javascript + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/vercel.yml b/.github/workflows/vercel.yml new file mode 100644 index 0000000..3c68574 --- /dev/null +++ b/.github/workflows/vercel.yml @@ -0,0 +1,30 @@ +name: Vercel Deploy + +on: + push: + branches: + - master + pull_request_target: null + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check Branch + id: branch + if: ${{ github.ref == 'refs/heads/master' }} + run: | + echo "args=--prod" >> $GITHUB_OUTPUT + echo "comment=false" >> $GITHUB_OUTPUT + + - name: Deploy + uses: amondnet/vercel-action@v25 + with: + vercel-args: ${{ steps.branch.outputs.args }} + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} + github-comment: ${{ steps.branch.outputs.comment != 'false' }} + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/api/_deeplx.js b/api/_deeplx.js index 4864995..1ce8c79 100644 --- a/api/_deeplx.js +++ b/api/_deeplx.js @@ -67,7 +67,8 @@ const SUPPORTED_LANGUAGES = [ { code: "SK", language: "Slovak" }, { code: "SL", language: "Slovenian" }, { code: "ES", language: "Spanish" }, - { code: "SV", language: "Swedish" } + { code: "SV", language: "Swedish" }, + { code: "TR", language: "Turkish" } ]; const SUPPORTED_FORMALITY_TONES = ["formal", "informal"]; @@ -204,6 +205,10 @@ function requestTranslation(text, targetLanguage, sourceLanguage, identifier, al function translate(_0, _1) { return __async(this, arguments, function* (text, targetLanguage, sourceLanguage = AUTO, identifier, alternatives, formalityTone) { var _a; + text = text == null ? void 0 : text.trim(); + if (!text) { + return text; + } return extractTranslatedSentences(yield requestTranslation(text, abbreviateLanguage(targetLanguage), (_a = abbreviateLanguage(sourceLanguage)) != null ? _a : "auto", identifier, alternatives, formalityTone)).join(" "); }); }