From 121725390da59ebe54f49972fe40c9ed1b3d3fec Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 6 Jul 2020 12:50:43 -0300 Subject: [PATCH 1/2] Fix _addons/ URL prefix not being removed on Windows systems Anki 2.1.28 Beta https://forums.ankiweb.net/t/anki-2-1-28-beta/629/26 > Did the requirements on how to expose resources on the internal server change? Because scripts, css files and the like, registered with setWebExports, do not work anymore with beta2. > A look at the console shows the following for all resources: > Failed to load resource: the server responded with a status of 500 (INTERNAL SERVER ERROR) **\Anki2\addons21\someaddon\__init__.py** ```py from aqt import mw import aqt # assuming add-on folder is named "test" # and assuming a 'test.js' is in the same folder addon_id = "someaddon" port = mw.mediaServer.getPort() mw.addonManager.setWebExports(addon_id, ".*\\.js$") print("Hello") aqt.editor._html += f""" """ ``` --- qt/aqt/mediasrv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/aqt/mediasrv.py b/qt/aqt/mediasrv.py index 680495408..df03e34d5 100644 --- a/qt/aqt/mediasrv.py +++ b/qt/aqt/mediasrv.py @@ -179,7 +179,7 @@ def _redirectWebExports(path): return _exportFolder, addonPath try: - addon, subPath = addonPath.split(os.path.sep, 1) + addon, subPath = addonPath.split("/", 1) except ValueError: return addMgr.addonsFolder(), path if not addon: From b44c971d2c122ab73ae7d5de1c9c6bdff31dfddd Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Mon, 6 Jul 2020 20:05:31 -0300 Subject: [PATCH 2/2] Attempt to fix Python interpreter Fix _addons/ URL prefix not being removed on Windows systems https://github.com/ankitects/anki/pull 679 --- .github/workflows/checks.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 41798472e..9f5dbb99f 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -181,7 +181,7 @@ jobs: uses: actions/cache@v1 with: path: ${{ github.workspace }}${{ matrix.SEP }}pyenv - key: ${{ runner.os }}-pyenv-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-17- + key: ${{ runner.os }}-pyenv-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-18- # # Disable it in attempt to reduce the overall cache size (https://github.com/ankitects/anki/pull/528) # - name: Cache pip wheels @@ -189,42 +189,42 @@ jobs: # uses: actions/cache@v1 # with: # path: ${{ matrix.PIP_WHEELS_DIR }} - # key: ${{ runner.os }}-pip-wheels-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.py') }}-16- + # key: ${{ runner.os }}-pip-wheels-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/setup.py') }}-18- - name: Cache cargo index if: matrix.python == '3.7' uses: actions/cache@v1 with: path: ${{ matrix.CARGO_INDEX_DIR }} - key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-16- + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-18- - name: Cache cargo registry if: matrix.python == '3.7' uses: actions/cache@v1 with: path: ${{ matrix.CARGO_REGISTRY_DIR }} - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-16- + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-18- - name: Cache cargo target if: matrix.python == '3.7' uses: actions/cache@v1 with: path: ${{ github.workspace }}${{ matrix.SEP }}target - key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-16- + key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-18- - name: Cache cargo rslib if: matrix.python == '3.7' uses: actions/cache@v1 with: path: ${{ github.workspace }}${{ matrix.SEP }}rslib${{ matrix.SEP }}target - key: ${{ runner.os }}-cargo-rslib-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-16- + key: ${{ runner.os }}-cargo-rslib-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-18- - name: Cache cargo rspy if: matrix.python == '3.7' uses: actions/cache@v1 with: path: ${{ github.workspace }}${{ matrix.SEP }}rspy${{ matrix.SEP }}target - key: ${{ runner.os }}-cargo-rspy-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-16- + key: ${{ runner.os }}-cargo-rspy-${{ hashFiles('**/requirements.*') }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/Makefile') }}-${{ hashFiles('**/Cargo.toml') }}-${{ matrix.BUILD_TYPE }}-18- - name: Set up curl pyaudio, rsync if: matrix.os == 'windows-latest'