外掛說明
lihi 短網址會將 lihi 短連結服務整合到 WordPress 管理後台。編輯者可以從文章與媒體列表畫面建立短網址、選擇重新導向網域、加入標籤,並為非媒體項目加入 UTM 參數,然後不離開 WordPress 即可複製結果。既有短網址會變成複製控制項,管理員也可以開啟對應的 lihi 控制台頁面編輯連結。這個外掛為開放原始碼,維護於 weedgood/lihi-wp-plugin。
這個外掛只會在 wp-admin 中執行;不會新增任何前台輸出,也不會在公開頁面載入指令碼。
功能
- 在所有公開內容類型列表畫面(文章、頁面、自訂內容類型)新增含有 建立 按鈕的 lihi 短網址 欄位。
- 在媒體庫列表檢視與媒體格狀檢視的附件詳細資料面板中,新增相同的建立 / 複製控制項。
- 一鍵複製:透過 AJAX 按需產生短網址並寫入剪貼簿;如果瀏覽器阻擋剪貼簿存取,會顯示手動複製提示。
- 建立視窗:建立新短網址前,可選擇重新導向網域、加入建議或自訂標籤,並為非媒體項目加入 UTM 參數。
- UTM source 與 medium 會從 lihi 帳號選項載入,而 campaign、term 與 content 則保留為自由文字欄位;媒體項目會隱藏 UTM 控制項並送出空白 UTM 值。
- 當項目已有短網址時會重複使用既有短網址,因此重複點擊的結果相同。
- 複製按鈕在複製前仍會確認上游短網址存在;如果短網址已被移除,按鈕會回到 建立 並再次開啟建立視窗。
- 成功查詢或建立短網址後,會在項目上標記
lihi_already = 1文章中繼資料;前端會將這些按鈕呈現為「複製」。 - 管理員可以透過瀏覽器驗證的穿透流程,在 lihi 控制台開啟既有短網址、個人網域管理與 UTM 選項管理。
- Settings page under Settings lihi Short URL with Login and Register tabs, connected-account details, work-group switching, Logout, and a lihi dashboard shortcut. Login is selected by default, and the service heading breaks cleanly between its two sentences. Directly sanitized query-backed tab links and native WordPress AJAX POST forms keep tab switching and submission usable without JavaScript; JavaScript adds instant keyboard tabs, an accessible work-group modal layered above the dashboard workspace, inline errors, and delayed success feedback. Successful work-group changes reload the settings page after the confirmation so all group-scoped state is fresh. Logout makes one short best-effort server-session revocation and always continues with local credential cleanup.
- Registration checks the request country before sending a verification email. Allowed registrations retain the registration request’s IP and device metadata for account creation; clicking the verification link does not replace them. After verifying, the administrator returns to the separate Login form; registration never logs the account in.
- Login uses server-side PKCE and stores the email, opaque server-issued session identifier, access token, and rotating refresh token together in one non-autoloaded WordPress option. A renewable 20-second database lease serializes Login and Refresh; only the current byte-exact lease owner can write credentials under the captured activation generation.
- Every refreshable protected lihi API request can refresh a rejected access token and retry once. Login and Refresh recheck activation after each remote response before renewing the lease; concurrent requests wait up to 18 seconds for a 15-second HTTP operation to finish. Any attempted refresh failure removes credentials still belonging to that Login session and asks the administrator to sign in again, while a newer Login remains untouched.
- 已本地化;內含繁體中文(
zh_TW)。
外部服務
這個外掛會連線至 lihi 短網址服務,以識別 WordPress 網站、驗證網站管理員,並建立或查詢短網址。沒有網際網路連線時,外掛無法運作。
Service: lihi WordPress API auth endpoints (https://app.lihi.com/api/wordpress/v1/auth)
- When data is sent: when an administrator submits Register, Login, or Logout on Settings lihi Short URL; when Login exchanges its short-lived authorization code; when any protected API rejects the access token and the plugin attempts one token refresh; and once during plugin uninstall when a local session is available.
- What is sent for Register: the entered email and password plus the WordPress site’s hostname. The request also carries normal network metadata such as source IP and User-Agent, which lihi uses to check registration availability and record the registration country and device. Account-creation consent is checked locally before the request. A successful registration only sends a verification email; it returns no login credentials and does not connect the plugin.
- What is sent for Login: the entered email and password, the WordPress site’s hostname, and a PKCE challenge generated by WordPress PHP. The server returns a short-lived authorization code; WordPress sends that code with the matching verifier retained only in PHP memory to exchange it for a server-issued UUID, access token, and refresh token.
- What is sent for refresh: the stored server-issued UUID and current refresh token. A successful refresh returns a new access token and a rotated refresh token.
- What is sent for Logout or uninstall: the stored access token in the Authorization header. No request body is sent. This one-shot request is not refreshed or retried; network or API failure is ignored so local Logout/uninstall cleanup still finishes.
- What WordPress stores: one non-autoloaded credential option containing the email, UUID, access token, and raw refresh token. The password, PKCE verifier, challenge, and authorization code are not stored after the request.
Service: lihi WordPress API protected endpoints (https://app.lihi.com/api/wordpress/v1)
- When data is sent: when a connected administrator opens the settings page to display account information, opens the work-group switcher, or confirms a work-group change; when the Create modal loads redirect-domain and UTM options; when an administrator opens the lihi dashboard through passthrough; and when a user clicks “Create”, “Copy”, or “Edit” to generate, look up, copy, or edit a short URL. Media Create modals hide UTM controls and submit blank UTM values.
- What is sent: the stored access token; when switching work groups, the selected numeric group ID or
nullfor the personal work group; the post or attachment URL (permalinkor attachment file URL, with entered UTM parameters appended); the post type namespace including the WordPress hostname; the post ID; the selected redirect domain; selected tags as a comma-separated string; and, when requesting browser passthrough, a browser-generated PKCE challenge plus an optional target such as a short URL or lihi dashboard path.
Service: browser-facing lihi pages (https://lihi.io, https://app.lihi.com, and https://lihidomain.com)
- When data is sent: only after a user clicks the lihi dashboard, password-reset, personal-domain, or verification-email link.
- What is sent: the browser’s normal request metadata. Connected dashboard links additionally carry the short-lived passthrough nonce and browser verifier described above; verification links carry the one-time registration token from the email. Public home, password-reset, and public domain-information links receive no account credentials from the plugin.
使用此外掛即表示你同意上述資料會傳送至 lihi 服務。請檢閱 lihi 服務的法律文件:
- 使用條款:https://knowledge.lihi.io/terms/
- 隱私權政策:https://knowledge.lihi.io/privacy-policy/
安裝方式
- 將
lihi-short-url資料夾上傳到/wp-content/plugins/目錄,或透過 WordPress 外掛 畫面安裝外掛。 - 透過 外掛 畫面啟用外掛。
- 前往 設定 lihi 短網址。
- If you already have a verified lihi account, enter its email and password in Login. If you need an account, use the separate Register form, confirm account creation, open the verification email, then return and log in.
- Once Login has stored a complete credential bundle, the Create button appears in a lihi Short URL column on every public post-type list screen and in the Media Library.
- To use another available lihi work group, click Switch beside the current work group, choose it in the modal, and click Switch work group.
這個外掛需要 manage_options 權限才能檢視或變更設定。任何已登入使用者都可以在其原本有權存取的畫面使用 建立 按鈕。
Serve wp-admin over HTTPS before using Login or Register. Passwords first travel from the browser to same-origin WordPress AJAX, then WordPress calls lihi over HTTPS. The plugin does not hard-block non-HTTPS requests because TLS may terminate at a correctly configured reverse proxy.
常見問題集
-
The UI hooks register only after Login has stored a complete email, UUID, access-token, and refresh-token bundle. Open Settings lihi Short URL and log in with a verified account. Registering or clicking the verification link alone does not log in.
-
How do I connect a different account?
-
Click Log out to remove the local credential bundle, then use Login with the other account. There is no separately editable saved-email field.
-
可以從 WordPress 管理重新導向網域或 UTM 選項嗎?
-
可以。管理員可以從建立視窗開啟 lihi 個人網域與 UTM 選項管理。外掛會先要求確認,建立短效穿透 nonce,然後在新分頁開啟 lihi 控制台。
-
如何在不停用外掛的情況下停用它?
-
Click Log out on Settings lihi Short URL. This removes the local credential bundle and stops registering the Short URL UI. Deactivation performs one complete transition: disable the generation before waiting, acquire the shared lock, repeat disable and credential purge under that lock, then release. If transition cleanup fails, isolated best-effort cleanup keeps authentication fail-closed and never directly deletes another request’s lock.
-
外掛會在網站前台執行嗎?
-
不會。這個外掛會在非管理後台請求提早返回;它只會新增管理後台 UI 和
admin-ajax.php處理常式。 -
支援哪些內容類型?
-
所有註冊為
public => true的內容類型,以及媒體庫(包含列表模式與格狀檢視的附件詳細資料面板)。 -
外掛會在我的資料庫中儲存資料嗎?
-
Yes — one non-autoloaded
lihi_auth_tokensoption containing{ email, uuid, access_token, refresh_token }, a non-autoloaded renewable 20-secondlihi_auth_tokens_lock, one non-autoloaded randomlihi_auth_epoch, and per-itemlihi_alreadypost meta. Credential writes atomically require the exact epoch and lease owner; cleanup uses a byte-exact raw stored value. Normal credential probes are memoized for the PHP request, while Login/Refresh concurrency checks always read fresh database state. Store failures during bootstrap probes degrade to disconnected instead of breaking wp-admin. The lihi password is never stored. Logging out removes the credential bundle. Deactivating or deleting the plugin removes its authentication options; if another request still owns the lease, cleanup disables authentication without force-deleting that foreign lock. Per-itemlihi_alreadypost meta remains attached to its item.
使用者評論
這個外掛目前沒有任何使用者評論。
參與者及開發者
變更記錄
1.0.6
- Adds separate Login and Register forms; Register sends verification only and never logs in.
- Adds server-side PKCE authorization-code exchange, one atomic email/UUID/access/refresh credential bundle, rotating refresh tokens, and one access fallback retry for every refreshable protected API.
- Adds one renewable 20-second database-backed auth lease around complete Login and Refresh flows plus local Logout, with owner-only renewal between remote steps and 18-second waiter budgets.
- Revokes the server-issued WordPress client on Logout and uninstall with a one-shot five-second request. Uninstall fences and drains Login/Refresh first, then performs revocation and local purge under the same lifecycle lease; every remote failure remains best-effort so cleanup always continues.
- Adds activation-generation fencing, response-time epoch rechecks, and lock-aware lifecycle cleanup so stale requests cannot restore credentials after deactivation or rapid reactivation.
- Keeps Login and Register usable as native WordPress AJAX POST forms without JavaScript, with Unicode-consistent password validation and accessible inline errors when JavaScript is available.
- Presents Login and Register as mutually exclusive tabs with Login selected by default, and adds an accessible modal for loading and switching lihi work groups.
- Replaces profile end dates with nullable work-group names, validates profile field types before rendering, and updates the protected API contract to use
/user/domain-options,/user/group-options, and/user/switch-group. - Sends the WordPress hostname with Login, reports unavailable registration countries with translated plugin copy before mail is sent, and keeps registration-time country, IP, and device metadata through email verification.
- Gives
site/storeneed_upgradefailures a dedicated translated upgrade-or-renew message while keepingsite_create_failon the normal validation-error path, and classifies every HTTP 5xx response as a service failure before inspecting identity markers. - Hardens concurrent authentication storage with request-memoized helper reads, fresh concurrency reads, guarded atomic credential upserts,
CAST(... AS BINARY)raw-value cleanup, consistent database error handling, malformed-row repair, scoped non-autoloaded option-cache invalidation without evictingalloptions, and fail-closed bootstrap/lifecycle behavior. - Sanitizes the read-only authentication-tab query directly, improves the service-heading sentence break, keeps the work-group modal above later dashboard content, and reloads the settings page after successful work-group switches.
1.0.5
- 修正 Plugin Check 對管理後台 AJAX 請求解析與輸出逸出處理提出的安全性檢查問題。
1.0.4
- 為 lihi 短網址欄位加入由 JavaScript 呈現的建立、複製,以及僅限管理員使用的編輯控制項。
- 加入建立視窗,支援重新導向網域選擇、點擊加入建議標籤、自訂標籤、UTM source / medium 選項,以及非媒體項目的自由文字 UTM 欄位。
- 在複製與編輯前驗證既有短網址;上游已移除的連結會將項目重設回建立狀態,並重新開啟建立流程。
- 加入剪貼簿被阻擋時的備援提示,讓產生的短網址仍可手動複製。
- 加入 lihi 控制台穿透流程,用於編輯短網址、管理個人網域及管理 UTM 選項。
- 更新設定頁面,加入密碼式 email 驗證、帳號建立同意、已連線帳號詳細資料,以及 lihi 控制台服務概覽。
- 使 lihi WordPress API client 與目前的
site/find單一結果回應,以及user/options網域 / UTM 選項回應一致。
1.0.3
- 將驗證與短網址呼叫統一到 lihi WordPress API client。
- 更新 client、service 與 store singleton 的內部相依性組合。
- 外掛停用時清除已儲存設定、網站 UUID 與快取權杖。
1.0.2
- 透過在驗證 JSON payload 中傳送網站主機名稱與持久網站 UUID 強化驗證身分檢查,而不是依賴 HTTP Host header。
- 在驗證登入請求中傳送 WordPress 的行動裝置請求旗標(
is_mobile)。
1.0.1
- 使外掛封裝目錄、主檔案與 text domain 與 WordPress.org slug 一致。
- 移除整個控制台範圍的設定提示,同時保留設定頁面可用。
- 更新
lihi-short-url目錄的發行封裝驗證。
1.0.0
- 初始版本。
- 在所有公開內容類型列表表格與媒體庫中新增「lihi」短網址按鈕。
- 具備 email 驗證流程與個別帳號重新導向網域選擇的設定頁面。
- 內含繁體中文(
zh_TW)翻譯。