Shorten the skill into reference files; fixes from the Miniflux rehearsal

SKILL.md keeps what every app needs; sign-in details and publishing move
to references/sign-in.md and references/publishing.md, read when it says.
A Miniflux rehearsal found coreapp signin calling a quiet callback failure
"Signed in": it now checks the app's page doesn't offer sign-in again.
Every app gets CORE_PROXY (traefik's address). The skill says groups is
null (don't map roles from it), claims come from userinfo, and to wait
for Authelia's discovery and the database at startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 20:14:06 -07:00
co-authored by Claude Opus 5.5
parent adcd2f9aec
commit a7cd4e325c
9 changed files with 319 additions and 176 deletions
+22 -3
View File
@@ -58,6 +58,8 @@ def errors(url):
class Browser:
def __init__(self, jar):
self.jar = jar
# Where sign-in started (the path, and a pressed form's action)
self.signin_urls = []
self.opener = urllib.request.build_opener(
urllib.request.HTTPCookieProcessor(jar), NoRedirect)
@@ -216,6 +218,7 @@ def follow(browser, url, username, password, stop_at=None, form=None):
if picked:
referer = url
url, data, label = picked
browser.signin_urls.append(url)
submitted = True
continue
return url, status, body, signed_in
@@ -290,12 +293,28 @@ def main(args):
if status >= 400:
raise SystemExit(f"Not signed in: Authelia accepted the test account, but the app answered "
f"HTTP {status} at {shown(last)} (coreapp logs says why).")
if cookies:
jar.save(ignore_discard=True, ignore_expires=True)
text = re.sub(rb"<[^>]+>", b" ", body).decode(errors="replace")
mentions = username.split("@")[0] in text
# Back at the app isn't signed in if the app's page offers sign-in again
# (its callback failed quietly and sent the browser to its sign-in page)
page = body.decode(errors="replace")
starts = {urllib.parse.urlsplit(u).path for u in [start] + browser.signin_urls}
targets = {urllib.parse.urlsplit(urllib.parse.urljoin(last, t)).path
for t in re.findall(r"""(?:href|action)\s*=\s*["']([^"'#]+)""", page)}
offers = (urllib.parse.urlsplit(last).path in starts or starts & targets
or re.search(r"""<input[^>]*type\s*=\s*["']?password""", page, re.I))
if offers and not mentions:
raise SystemExit(
f"Not signed in: Authelia accepted the test account, but the app ended at "
f"{shown(last)}, which offers sign-in again: its callback didn't sign the person in "
"(coreapp logs says why).")
if cookies:
jar.save(ignore_discard=True, ignore_expires=True)
print(f"Signed in: back at the app, {shown(last)} answered HTTP {status}.")
print("Its page " + ("shows" if mentions else "doesn't show") + f" {username.split('@')[0]}.")
who = username.split("@")[0]
print(f"Its page shows {who}." if mentions else
f"Its page doesn't show {who}, but doesn't offer sign-in again either; to be sure, "
"look at a page only signed-in people get, with --cookies.")
if cookies:
print(f"Cookies saved in {cookies} (curl -b {cookies} https://{app.netloc}/...).")
return 0