James Read 5 ore în urmă
părinte
comite
2e699fc08d

+ 1 - 1
.goreleaser.yml

@@ -276,7 +276,7 @@ release:
 
     ## Upgrade warnings, or breaking changes
 
-    - No such issues between the last release and this version.
+    {{ envOrDefault "OLIVETIN_UPGRADE_WARNINGS" "- No such issues between the last release and this version." }}
 
     ## Useful links
 

+ 1 - 1
AGENTS.md

@@ -88,7 +88,7 @@ When a change means operators may need to do something when they upgrade (a brea
   What changed, and who is affected. What operators need to change.
   ```
 - Link to the note from related docs pages with `xref:upgrade/upgrade_notes.adoc#short-kebab-case-anchor[Upgrade Notes]`. The anchor stays the same when the note moves under a version heading, so links keep working.
-- Do **not** write a version number and do **not** rename the unreleased heading by hand. When a 3k release is tagged, `.github/workflows/release-upgrade-notes.yml` runs `scripts/release_upgrade_notes.py`, which moves every note that was in the unreleased section at the tagged commit under a new `== <version>` heading on `next`. Notes merged after the release was cut stay unreleased. If the workflow fails, rerun it with `workflow_dispatch` and the release tag.
+- Do **not** write a version number and do **not** rename the unreleased heading by hand. When a 3k release is tagged, `.github/workflows/release-upgrade-notes.yml` runs `scripts/release_upgrade_notes.py`, which moves every note that was in the unreleased section at the tagged commit under a new `== <version>` heading on `next`. Notes merged after the release was cut stay unreleased. The version section gets a `release-<version-with-dashes>` anchor and a link to the GitHub release notes, and the GitHub release's "Upgrade warnings, or breaking changes" section links back to those upgrade notes (generated by `scripts/release_upgrade_notes.py --release-summary` in the GoReleaser footer). If the workflow fails, rerun it with `workflow_dispatch` and the release tag.
 - Do **not** mark the change with a `BREAKING CHANGE:` footer or a `!` in the commit type. semantic-release treats either as a major version bump.
 - docs.olivetin.app is built from `next`, so a note is public as soon as it merges. For security fixes the note goes in the private advisory fork PR, and should describe the behaviour change without exploit details.
 

+ 10 - 1
docs/modules/ROOT/pages/upgrade/upgrade_notes.adoc

@@ -1,10 +1,13 @@
 [#upgrade-notes]
 = Upgrade Notes
 
-OliveTin releases are published to GitHub, and the release notes are contained there. This page includes a summary of "Upgrade Notes" for breaking changes between releases.
+OliveTin releases are published to GitHub, and the release notes are contained there. The release notes list everything in a release, by category: security fixes, features, bug fixes and so on. This page has the "Upgrade Notes": the breaking changes and changes in default behaviour that you need to be aware of when you upgrade. Each release below links back to its release notes on GitHub.
 
+[#release-3000-23-0]
 == 3000.23.0
 
+See the https://github.com/OliveTin/OliveTin/releases/tag/3000.23.0[3000.23.0 release notes on GitHub] for everything in this release.
+
 [#require-guests-to-login-all-api-calls]
 === `authRequireGuestsToLogin` now applies to every API call and ACL
 
@@ -84,16 +87,22 @@ Users logged in with trusted header authentication (`authHttpHeaderUsername`) no
 
 This affects you if something reads the provider from the `WhoAmI` or `Init` API for these users. Change it to expect `trusted-header`. It also affects you if a client sends a `provider: system` header to call `StartAction` or `StartActionAndWait` for an action that requires a justification, without sending one. Those calls now fail with "justification is required for this action", unless the action's justification template fills one in. Send a `justification` with these calls. `RestartAction` is not affected, because it always reuses the justification stored with the original run.
 
+[#release-2024-08-14]
 == 2024.08.14
 
+See the https://github.com/OliveTin/OliveTin/releases/tag/2024.08.14[2024.08.14 release notes on GitHub] for everything in this release.
+
 === Navigation change - Subpaths no longer supported
 
 In the past, OliveTin supported subpaths in the URL, for example, `http://yourServer:1337/olivetin/` would load the OliveTin web interface. This was convenient for people who wanted to run OliveTin on a subpath of their domain for some reason, but it actually creates a lot of complexity in the code, and makes it harder to maintain. One particular change that was wanted was to be able to link to specific pages in OliveTin, for example, `http://yourServer:1337/logs` or `http://yourServer:1337/myDashboard/myFolder` - this became incredibly difficult to implement with the subpath support.
 
 Therefore, OliveTin no longer supports subpaths in the URL. If you have been using OliveTin with a subpath, you will need to change your configuration to use a subdomain or a different port.
 
+[#release-2024-04-09]
 == 2024.04.09
 
+See the https://github.com/OliveTin/OliveTin/releases/tag/2024.04.09[2024.04.09 release notes on GitHub] for everything in this release.
+
 === Themes Directory (for theme users)
 
 ==== Background

+ 4 - 4
frontend/package-lock.json

@@ -17,7 +17,7 @@
 				"@xterm/addon-web-links": "^0.12.0",
 				"@xterm/xterm": "^6.0.0",
 				"iconify-icon": "^3.0.5",
-				"picocrank": "^1.42.1",
+				"picocrank": "^1.42.2",
 				"vue": "^3.5.46",
 				"vue-i18n": "^11.4.23",
 				"vue-router": "^5.5.1"
@@ -3119,9 +3119,9 @@
 			"license": "ISC"
 		},
 		"node_modules/picocrank": {
-			"version": "1.42.1",
-			"resolved": "https://registry.npmjs.org/picocrank/-/picocrank-1.42.1.tgz",
-			"integrity": "sha512-u2NQa4UaEZ35bADmlzPa7AkQfUE4wHZAjN37oJk0dABWnLjLza616ki1PU12LQgNVvZ2uPaNykkxfUV5CGHHpw==",
+			"version": "1.42.2",
+			"resolved": "https://registry.npmjs.org/picocrank/-/picocrank-1.42.2.tgz",
+			"integrity": "sha512-2kjdtFYQ89pLW4WiNcxvbnh4JWvTWgvOdlIvqqH8aw6RYZk6CCrE/rmdB5nO6kLpRnX+8KB54hVXDKRmZXAnfA==",
 			"license": "ISC",
 			"dependencies": {
 				"@hugeicons/core-free-icons": "^4.4.0",

+ 1 - 1
frontend/package.json

@@ -31,7 +31,7 @@
 		"@xterm/addon-web-links": "^0.12.0",
 		"@xterm/xterm": "^6.0.0",
 		"iconify-icon": "^3.0.5",
-		"picocrank": "^1.42.1",
+		"picocrank": "^1.42.2",
 		"vue": "^3.5.46",
 		"vue-i18n": "^11.4.23",
 		"vue-router": "^5.5.1"

+ 28 - 1
integration-tests/tests/localAuth/localAuth.mjs

@@ -8,12 +8,19 @@ import {
 describe('config: localAuth', function () {
   this.timeout(30000) // Increase timeout to 30 seconds
 
+  let originalWindowRect
+
   before(async function () {
+    originalWindowRect = await webdriver.manage().window().getRect()
     await runner.start('localAuth')
   })
 
   after(async () => {
-    await runner.stop()
+    try {
+      await webdriver.manage().window().setRect(originalWindowRect)
+    } finally {
+      await runner.stop()
+    }
   })
 
   afterEach(function () {
@@ -99,4 +106,24 @@ describe('config: localAuth', function () {
       console.log('Login form not found - skipping login test')
     }
   })
+
+  it('Header login link stays usable on narrow screens', async function () {
+    await webdriver.manage().window().setRect({ width: 400, height: 800 })
+    await webdriver.manage().deleteAllCookies()
+    await webdriver.get(runner.baseUrl())
+
+    const loginLink = await webdriver.wait(until.elementLocated(By.css('header .login-link')), 10000)
+    await webdriver.wait(until.elementIsVisible(loginLink), 5000)
+
+    expect(await loginLink.getAttribute('aria-label')).to.equal('Login')
+
+    const loginIcon = await loginLink.findElement(By.css('svg'))
+    expect(await loginIcon.isDisplayed()).to.equal(true)
+
+    const linkSize = await loginLink.getRect()
+    expect(linkSize.width).to.be.greaterThan(20)
+
+    await loginLink.click()
+    await webdriver.wait(until.urlContains('/login'), 5000)
+  })
 })

+ 5 - 2
integration-tests/tests/topbarNavigation/topbarNavigation.mjs

@@ -14,8 +14,11 @@ describe('config: sectionNavigationStyle topbar', function () {
   })
 
   after(async () => {
-    await webdriver.manage().window().setRect(originalWindowRect)
-    await runner.stop()
+    try {
+      await webdriver.manage().window().setRect(originalWindowRect)
+    } finally {
+      await runner.stop()
+    }
   })
 
   afterEach(function () {

+ 74 - 1
scripts/release_upgrade_notes.py

@@ -7,11 +7,18 @@ tagged, every note that was in the unreleased section *at the tagged commit*
 moves into a new "== <version>" section. Notes added to the unreleased section
 after the release was cut stay where they are.
 
+Each version section links back to the release on GitHub, which has the full
+release notes, and has an anchor that the GitHub release links to.
+
 Usage:
     release_upgrade_notes.py <version> <released-file> <target-file>
+    release_upgrade_notes.py --release-summary <version> <notes-file>
 
 <released-file> is upgrade_notes.adoc as it was at the release tag, and
 <target-file> is the copy to update in place (normally on the next branch).
+
+--release-summary prints the "Upgrade warnings, or breaking changes" list for
+the GitHub release of <version>, from the unreleased notes in <notes-file>.
 """
 
 from __future__ import annotations
@@ -20,6 +27,9 @@ import sys
 from pathlib import Path
 
 UNRELEASED_HEADING = "== Next release (unreleased)"
+GITHUB_RELEASE_URL = "https://github.com/OliveTin/OliveTin/releases/tag/{version}"
+UPGRADE_NOTES_URL = "https://docs.olivetin.app/upgrade/upgrade_notes.html"
+NO_UPGRADE_NOTES = "- No such issues between the last release and this version.\n"
 
 
 def split_sections(lines: list[str], prefix: str) -> tuple[list[str], list[list[str]]]:
@@ -79,8 +89,19 @@ def released_keys(released_lines: list[str]) -> set[str]:
     return {note_key(note) for note in found[1]}
 
 
+def version_anchor(version: str) -> str:
+    return "release-" + version.replace(".", "-")
+
+
 def build_version_section(version: str, notes: list[list[str]]) -> list[str]:
-    section = [f"== {version}\n", "\n"]
+    release_url = GITHUB_RELEASE_URL.format(version=version)
+    section = [
+        f"[#{version_anchor(version)}]\n",
+        f"== {version}\n",
+        "\n",
+        f"See the {release_url}[{version} release notes on GitHub] for everything in this release.\n",
+        "\n",
+    ]
     for note in notes:
         section.extend(note)
     return section
@@ -126,7 +147,59 @@ def move_released_notes(version: str, released_lines: list[str], target_lines: l
     return result if moved else None
 
 
+def note_title(note: list[str]) -> str:
+    for line in note:
+        if line.startswith("=== "):
+            return line[4:].strip()
+    return ""
+
+
+def note_anchor(note: list[str]) -> str:
+    for line in note:
+        if line.startswith("[#"):
+            return line.strip()[2:-1]
+    return ""
+
+
+def markdown_link(text: str, url: str) -> str:
+    escaped = text.replace("[", "\\[").replace("]", "\\]")
+    return f"[{escaped}]({url})"
+
+
+def release_summary(version: str, lines: list[str]) -> str:
+    """Markdown for the GitHub release, linking to the notes that ship in it.
+
+    Links point at the version section that the release workflow creates after
+    the tag is pushed, and at each note's own anchor, which exists already.
+    """
+    found = unreleased_notes(lines)
+    notes = found[1] if found else []
+    if not notes:
+        return NO_UPGRADE_NOTES
+
+    version_url = f"{UPGRADE_NOTES_URL}#{version_anchor(version)}"
+    summary = [f"- This release has {markdown_link('upgrade notes', version_url)}. Read them before you upgrade:\n"]
+    for note in notes:
+        anchor = note_anchor(note)
+        url = f"{UPGRADE_NOTES_URL}#{anchor}" if anchor else version_url
+        summary.append(f"  - {markdown_link(note_title(note), url)}\n")
+    return "".join(summary)
+
+
+def print_release_summary(argv: list[str]) -> int:
+    if len(argv) != 4:
+        print(__doc__, file=sys.stderr)
+        return 2
+
+    version, notes_path = argv[2], Path(argv[3])
+    print(release_summary(version, notes_path.read_text().splitlines(keepends=True)), end="")
+    return 0
+
+
 def main(argv: list[str]) -> int:
+    if len(argv) > 1 and argv[1] == "--release-summary":
+        return print_release_summary(argv)
+
     if len(argv) != 4:
         print(__doc__, file=sys.stderr)
         return 2

+ 4 - 0
var/windows/goreleaser-release-with-msi.sh

@@ -36,6 +36,10 @@ wait_for_stable_file() {
   done
 }
 
+# Read by the release footer in .goreleaser.yml.
+OLIVETIN_UPGRADE_WARNINGS="$(python3 -I "${REPO_ROOT}/scripts/release_upgrade_notes.py" --release-summary "${VERSION}" "${REPO_ROOT}/docs/modules/ROOT/pages/upgrade/upgrade_notes.adoc")"
+export OLIVETIN_UPGRADE_WARNINGS
+
 goreleaser release --clean --timeout "${TIMEOUT}" "$@" &
 goreleaser_pid=$!