@dreamor/atlas-cli 0.7.6 → 0.7.7

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.
@@ -98,11 +98,20 @@ export async function loginStatus() {
98
98
  try {
99
99
  const daemonCookies = await fetchCookiesFromDaemon();
100
100
  if (daemonCookies && daemonCookies.length > 0) {
101
- const { getBanmaIdentity } = await import('./session.js');
102
- const identity = getBanmaIdentity(daemonCookies);
101
+ const userinfoCookie = daemonCookies.find((c) => c.name === 'buc_userinfo');
102
+ let displayName = 'via-daemon';
103
+ if (userinfoCookie) {
104
+ try {
105
+ const decoded = JSON.parse(Buffer.from(userinfoCookie.value, 'base64').toString('utf-8'));
106
+ displayName = decoded.name || decoded.account || `工号 ${decoded.emp_id}`;
107
+ }
108
+ catch {
109
+ // fallback
110
+ }
111
+ }
103
112
  return {
104
113
  loggedIn: true,
105
- account: identity?.staffId || identity?.user || 'via-daemon',
114
+ account: displayName,
106
115
  mode: 'daemon',
107
116
  };
108
117
  }
@@ -113,11 +122,25 @@ export async function loginStatus() {
113
122
  // Check local cookies
114
123
  const cookies = await readCookies();
115
124
  if (cookies && cookies.length > 0) {
116
- const { getBanmaIdentity } = await import('./session.js');
117
- const identity = getBanmaIdentity(cookies);
125
+ const userinfoCookie = cookies.find((c) => c.name === 'buc_userinfo');
126
+ let displayName = '已登录';
127
+ if (userinfoCookie) {
128
+ try {
129
+ const decoded = JSON.parse(Buffer.from(userinfoCookie.value, 'base64').toString('utf-8'));
130
+ displayName = decoded.name || decoded.account || `工号 ${decoded.emp_id}`;
131
+ }
132
+ catch {
133
+ // fallback below
134
+ }
135
+ }
136
+ if (displayName === '已登录') {
137
+ const bucUser = cookies.find((c) => c.name === 'buc_username');
138
+ if (bucUser)
139
+ displayName = bucUser.value;
140
+ }
118
141
  return {
119
142
  loggedIn: true,
120
- account: identity?.staffId || identity?.user || '已登录',
143
+ account: displayName,
121
144
  mode: 'local',
122
145
  };
123
146
  }
@@ -1 +1 @@
1
- export const ATLAS_VERSION = '0.7.6';
1
+ export const ATLAS_VERSION = '0.7.7';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamor/atlas-cli",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "Atlas CLI - 斑马云图人力基线管理工具",
5
5
  "type": "module",
6
6
  "bin": {