From 4aacf3bd205763eaf0c5a6786da4b7fd56719b23 Mon Sep 17 00:00:00 2001 From: petru Date: Wed, 29 Apr 2026 23:48:49 +0000 Subject: [PATCH] Modified - Added admin actor badge beside the Is Administrator option. --- .codex-history.md | 9 +++++ .codex_gpt_login.sh | 61 ++++++++++++++++++++++++++++++++++ .frontend.hash | 2 +- package.json | 7 ++-- templates/admin/user/edit.tmpl | 5 ++- 5 files changed, 79 insertions(+), 5 deletions(-) create mode 100755 .codex_gpt_login.sh diff --git a/.codex-history.md b/.codex-history.md index 98241ada0b..8ca48511bd 100644 --- a/.codex-history.md +++ b/.codex-history.md @@ -341,3 +341,12 @@ Project Change ID[date-time] - application-version - Type - Summary: - 1 - I disabled User Account Is Activated and Is Restricted when an administrator edits their own account, matching the existing self-edit protection for Disable Sign-In. - 2 - I hardened the admin user update handler so manually submitted self-edit forms cannot change the current admin's active, restricted, or prohibit-login state. - 3 - I regenerated local ignored template bindata and verified the admin package compilation with reduced build pressure. + +65 - [2026-04-29 22:37:56] - v1.27.0-dev-62-g3afb4e8afa - Type: Added - Added Codex ChatGPT login helper script. +- 1 - I added `.codex_gpt_login`, an interactive helper for completing the local Codex ChatGPT auth callback in code-server environments. +- 2 - The script accepts either a raw received code or a full URL/query containing `code=...`, calls the local callback endpoint, extracts `id_token`, and completes the `/success` request. +- 3 - I made the script executable and verified its shell syntax with `bash -n`. + +66 - [2026-04-29 22:55:08] - v1.27.0-dev-62-g3afb4e8afa - Type: Modified - Added admin actor badge beside the Is Administrator option. +- 1 - I updated the admin user edit panel so the Is Administrator checkbox label shows `by ` when administrator grant metadata exists. +- 2 - I reused the stored admin email as the badge hover tooltip and regenerated local ignored template bindata. diff --git a/.codex_gpt_login.sh b/.codex_gpt_login.sh new file mode 100755 index 0000000000..bade423bfe --- /dev/null +++ b/.codex_gpt_login.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +set -euo pipefail + +CALLBACK_URL="http://127.0.0.1:1455/auth/callback" +SUCCESS_URL="http://localhost:1455/success" + +die() { + printf 'ERROR: %s\n' "$*" >&2 + exit 1 +} + +extract_code() { + local input="$1" + + case "$input" in + *code=*) + input="${input#*code=}" + input="${input%%&*}" + input="${input%%#*}" + ;; + esac + + printf '%s' "$input" +} + +extract_id_token() { + local response_file="$1" + + sed -n 's/.*id_token=\([^&[:space:]"'"'"'<>]*\).*/\1/p' "$response_file" | + tr -d '\r' | + head -n 1 +} + +printf 'Codex ChatGPT login helper\n' +printf 'Paste the received code, full callback URL, or query string containing code=...\n' +printf 'Received key: ' +IFS= read -r received_key + +[ -n "$received_key" ] || die "empty received key" + +code="$(extract_code "$received_key")" +[ -n "$code" ] || die "could not extract code" + +response_file="$(mktemp)" +trap 'rm -f "$response_file"' EXIT + +printf '\nCalling Codex auth callback...\n' +curl -sv -H "Host: localhost" --get --data-urlencode "code=$code" "$CALLBACK_URL" >"$response_file" 2>&1 || { + cat "$response_file" >&2 + die "callback request failed" +} + +id_token="$(extract_id_token "$response_file")" +[ -n "$id_token" ] || { + cat "$response_file" >&2 + die "could not find id_token in callback response" +} + +printf 'id_token received. Completing login...\n' +curl -sv --get --data-urlencode "id_token=$id_token" "$SUCCESS_URL" +printf '\nDone.\n' diff --git a/.frontend.hash b/.frontend.hash index cc139b6c09..93dc207c25 100644 --- a/.frontend.hash +++ b/.frontend.hash @@ -1 +1 @@ -4ed0aeeac4f78bdb9801d09f5b79994c4cefbabd +8059ee228d61449c58de918e054b61dfed3a2708 diff --git a/package.json b/package.json index 9284840a61..ff9a08852b 100644 --- a/package.json +++ b/package.json @@ -156,8 +156,9 @@ } }, "scripts": { - "0-configure-buid": "./configure.sh", - "1-update-gitea": "./update-gitea.sh", - "2-smart-build": "./smart-build.sh" + "0-codex-gpt-login": "./.codex_gpt_login.sh", + "1-configure-buid": "./configure.sh", + "2-update-gitea": "./update-gitea.sh", + "3-smart-build": "./smart-build.sh" } } diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl index 8a2e1dcffe..4cbdeed50c 100644 --- a/templates/admin/user/edit.tmpl +++ b/templates/admin/user/edit.tmpl @@ -163,7 +163,10 @@ {{if ne .User.ID .SignedUserID}}
- +