feat(api-keys): return real last_used in list + render in settings (rant 2026-08-24T12:41:25) - #140
Merged
Merged
Conversation
…ant 2026-08-24T12:41:25)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Settings page API Key "最近使用" (last used) column now shows real data instead of a hardcoded "从未" placeholder (rant 2026-08-24T12:41:25).
Findings: the
api_keys.last_usedcolumn already existed and the gateway Bearer auth extractor already callstouch_api_keyon every authenticated request (src/routes/mod.rs), so the column was being maintained — the gaps were:list_api_keys(src/dao.rs) didn't SELECTlast_used, so the API never returned itrenderSettingshardcodedlast: T("settings.ak.last.never"), discarding any real valueChanges:
dao::list_api_keys: SELECTlast_usedand return it in the JSON (nullfor never-used keys, UTC ISO string otherwise, converted viautc_iso)renderSettings: usek.last_used— real keys show the actual time (relative display + precise absolute time in the hover tooltip viatimeCell); keys withnulllast_used show the "从未" placeholderapi_keys_create_and_list_with_bearer— asserts thelast_usedfield is present, isnullfor a freshly created unused key, and is a non-empty string when populatedCache-bust
20260824-7→20260824-8.Tests
cargo test146/146 (incl. new last_used assertions),cargo fmt --check,cargo clippygreennode --checkOK