publishport-opencli 1.0.52 → 1.0.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/clis/medium/whoami.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cli as
|
|
1
|
+
import{cli as r,Strategy as u}from"@jackwener/opencli/registry";import{checkLogin as m,cookieQuickCheck as t}from"../_shared/article/auth.js";import{mediumAuthProfile as o}from"./article.js";r({site:"medium",name:"whoami",access:"read",description:"查询当前登录的 Medium 账户信息。",domain:"medium.com",strategy:u.COOKIE,browser:!0,columns:["logged_in","user_id","username"],authStatus:{quickCheckRequiresNavigation:!0,quickCheck:t("https://medium.com",["sid","uid"])},func:async(i)=>{const e=await m(i,o);return[{logged_in:e.isAuthenticated,user_id:e.userId||"",username:e.username||""}]}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cli as
|
|
1
|
+
import{cli as i,Strategy as u}from"@jackwener/opencli/registry";import{checkLogin as o,cookieQuickCheck as m}from"../_shared/article/auth.js";import{segmentfaultProfile as h}from"./article.js";const authProfile={home:h.home,checkAuth:async(e)=>{const a=await(await fetch("https://segmentfault.com/user/settings",{credentials:"include"})).text(),s=a.match(/href="\/u\/([^"]+)"/);if(!s)return{isAuthenticated:!1,error:"未登录或无法解析用户信息"};const r=s[1],c=a.match(/src="(https:\/\/avatar-static\.segmentfault\.com\/[^"]+)"/),n=c?c[1]:"";return{isAuthenticated:!0,userId:r,username:r,avatar:n}}};export{authProfile};i({site:"segmentfault",name:"whoami",access:"read",description:"检查思否(SegmentFault)的登录状态并获取当前账号信息",domain:"segmentfault.com",strategy:u.COOKIE,browser:!0,columns:["logged_in","user_id","username"],authStatus:{quickCheckRequiresNavigation:!0,quickCheck:m("https://segmentfault.com",["PHPSESSID"])},func:async(e)=>{const t=await o(e,authProfile);return[{logged_in:t.isAuthenticated,user_id:t.userId,username:t.username}]}});
|