diff --git a/.github/workflows/lua-validate.yml b/.github/workflows/lua-validate.yml index b52dc1f..84946c3 100644 --- a/.github/workflows/lua-validate.yml +++ b/.github/workflows/lua-validate.yml @@ -11,11 +11,15 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all history so git diff works - name: Get changed Lua files id: changed run: | - CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '^src/.*\.lua$' || true) + git fetch origin dev:refs/remotes/origin/dev + CHANGED=$(git diff --name-only origin/dev...${{ github.sha }} | grep '^src/.*\.lua$' || true) + echo "Changed Lua files: $CHANGED" echo "changed=$CHANGED" >> $GITHUB_OUTPUT - name: Restore extension tester from cache @@ -30,19 +34,14 @@ jobs: wget -O extension-tester.jar "https://cdn.shosetsu.app/extension-tester/v2.0.0/extension-tester.jar" fi - - name: Validate Lua metadata - if: steps.changed.outputs.changed != '' - run: | - java -jar extension-tester.jar --ci --validate-metadata ${{ steps.changed.outputs.changed }} - - name: Check version bump in changed Lua files if: steps.changed.outputs.changed != '' run: | set -e for file in ${{ steps.changed.outputs.changed }}; do if [ ! -f "$file" ]; then continue; fi - # Get header lines from current and previous commit - old_header=$(git show ${{ github.event.before }}:"$file" 2>/dev/null | head -n 1) + # Get header lines from current and dev branch + old_header=$(git show origin/dev:"$file" 2>/dev/null | head -n 1) new_header=$(head -n 1 "$file") # Extract version numbers old_ver=$(echo "$old_header" | grep -o '"ver": *"[^"]*"' | sed 's/.*"ver": *"\([^"]*\)".*/\1/') @@ -54,3 +53,18 @@ jobs: fi fi done + + - name: Run extension tester on changed Lua files + if: steps.changed.outputs.changed != '' + run: | + set -e + for file in ${{ steps.changed.outputs.changed }}; do + # Only test files matching src//.lua + if [[ "$file" =~ ^src/[^/]+/[^/]+\.lua$ ]]; then + lang=$(echo "$file" | cut -d'/' -f2) + echo "Testing $file" + java -jar extension-tester.jar "$file" + else + echo "Skipping $file (not lua extension)" + fi + done diff --git a/src/pl/WebKomiksy.lua b/src/pl/WebKomiksy.lua index 22ae571..de28c49 100644 --- a/src/pl/WebKomiksy.lua +++ b/src/pl/WebKomiksy.lua @@ -1,4 +1,4 @@ --- {"id":23119215,"ver":"1.0.0","libVer":"1.0.0","author":"wasu-code","repo":"","dep":["url>=1.0.0"]} +-- {"id":23119215,"ver":"1.0.1","libVer":"1.0.0","author":"wasu-code","repo":"","dep":["url>=1.0.0"]} local qs = Require("url").querystring @@ -10,6 +10,11 @@ local FID_STATUS = 3 local FID_CATEGORY = 4 local FID_SORT = 5 +local SID_UPCOMING = 1 +local settings = { + [SID_UPCOMING] = false, +} + local STATUSES = { { value = nil, label = "Wszystkie" }, { value = "completed", label = "Ukończone" }, @@ -71,19 +76,26 @@ local function parseNovel(url, loadChapters) if loadChapters then local chapters = AsList(map( - doc:select("a.group.h-auto"), + doc:select(settings[SID_UPCOMING] + and "h3:contains(Opublikowane)+div>a, h3:contains(Planowane)+div>div" + or "h3:contains(Opublikowane)+div>a"), function (card) + local title = card:selectFirst("div:has(>h3)"):text() + local chapterNum = title:match("#(%d+)") + local href = card:attr("href") return NovelChapter { - title = card:selectFirst("h3"):text(), - link = card:attr("href"), + title = title, + link = href ~= "" and href or ("/ksiazka/wola-sztuki/czytnik/" .. chapterNum), release = card:selectFirst("span:has(.iconify)"):text() } end )) + local reversed = {} for i = #chapters, 1, -1 do table.insert(reversed, chapters[i]) end + info:setChapters(reversed) end @@ -92,7 +104,7 @@ end local function getPassage(url) local doc = GETDocument(expandURL(url)) - local story = doc:selectFirst("article") + local story = doc:selectFirst("article") or error("\n\nTen rozdział nie jest jeszcze dostępny") return pageOfElem(story, false) end @@ -138,4 +150,11 @@ return { hasSearch = false, isSearchIncrementing = false, search = function() end, + + settings = { + SwitchFilter(SID_UPCOMING, "Pokaż nadchodzące rozdziały") + }, + updateSetting = function(id, value) + settings[id] = value + end, } \ No newline at end of file