Skip to content

Commit f539ab4

Browse files
committed
feat(api): add new endpoint for retrieving desktop-local auth session and update reward sharing tasks
- Introduced the `/api/auth/get-session` endpoint to fetch the current desktop-local authentication session, including user and session details. - Updated reward sharing tasks to replace specific platforms with a generalized "mobile_share" task, enhancing flexibility in sharing options. - Revised English and Chinese translations for mobile sharing prompts and reward descriptions to reflect the new task structure.
1 parent 1fb7006 commit f539ab4

9 files changed

Lines changed: 216 additions & 191 deletions

File tree

apps/controller/openapi.json

Lines changed: 67 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,70 @@
12961296
}
12971297
}
12981298
},
1299+
"/api/auth/get-session": {
1300+
"get": {
1301+
"tags": [
1302+
"Desktop"
1303+
],
1304+
"responses": {
1305+
"200": {
1306+
"description": "Desktop-local auth session",
1307+
"content": {
1308+
"application/json": {
1309+
"schema": {
1310+
"type": "object",
1311+
"properties": {
1312+
"session": {
1313+
"type": "object",
1314+
"properties": {
1315+
"id": {
1316+
"type": "string"
1317+
},
1318+
"expiresAt": {
1319+
"type": "string"
1320+
}
1321+
},
1322+
"required": [
1323+
"id",
1324+
"expiresAt"
1325+
]
1326+
},
1327+
"user": {
1328+
"type": "object",
1329+
"properties": {
1330+
"id": {
1331+
"type": "string"
1332+
},
1333+
"email": {
1334+
"type": "string"
1335+
},
1336+
"name": {
1337+
"type": "string"
1338+
},
1339+
"image": {
1340+
"type": "string",
1341+
"nullable": true
1342+
}
1343+
},
1344+
"required": [
1345+
"id",
1346+
"email",
1347+
"name",
1348+
"image"
1349+
]
1350+
}
1351+
},
1352+
"required": [
1353+
"session",
1354+
"user"
1355+
]
1356+
}
1357+
}
1358+
}
1359+
}
1360+
}
1361+
}
1362+
},
12991363
"/api/internal/desktop/cloud-status": {
13001364
"get": {
13011365
"tags": [
@@ -2971,11 +3035,8 @@
29713035
"github_star",
29723036
"x_share",
29733037
"reddit",
2974-
"xiaohongshu",
3038+
"mobile_share",
29753039
"lingying",
2976-
"jike",
2977-
"wechat",
2978-
"feishu",
29793040
"facebook",
29803041
"whatsapp"
29813042
]
@@ -3170,11 +3231,8 @@
31703231
"github_star",
31713232
"x_share",
31723233
"reddit",
3173-
"xiaohongshu",
3234+
"mobile_share",
31743235
"lingying",
3175-
"jike",
3176-
"wechat",
3177-
"feishu",
31783236
"facebook",
31793237
"whatsapp"
31803238
]
@@ -3283,11 +3341,8 @@
32833341
"github_star",
32843342
"x_share",
32853343
"reddit",
3286-
"xiaohongshu",
3344+
"mobile_share",
32873345
"lingying",
3288-
"jike",
3289-
"wechat",
3290-
"feishu",
32913346
"facebook",
32923347
"whatsapp"
32933348
]

apps/web/lib/api/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// This file is auto-generated by @hey-api/openapi-ts
2-
export * from "./types.gen";
3-
export * from "./sdk.gen";
2+
export * from './types.gen';
3+
export * from './sdk.gen';

apps/web/lib/api/sdk.gen.ts

Lines changed: 8 additions & 1 deletion
Large diffs are not rendered by default.

apps/web/lib/api/types.gen.ts

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,33 @@ export type PatchApiInternalDesktopPreferencesResponses = {
513513

514514
export type PatchApiInternalDesktopPreferencesResponse = PatchApiInternalDesktopPreferencesResponses[keyof PatchApiInternalDesktopPreferencesResponses];
515515

516+
export type GetApiAuthGetSessionData = {
517+
body?: never;
518+
path?: never;
519+
query?: never;
520+
url: '/api/auth/get-session';
521+
};
522+
523+
export type GetApiAuthGetSessionResponses = {
524+
/**
525+
* Desktop-local auth session
526+
*/
527+
200: {
528+
session: {
529+
id: string;
530+
expiresAt: string;
531+
};
532+
user: {
533+
id: string;
534+
email: string;
535+
name: string;
536+
image: string;
537+
};
538+
};
539+
};
540+
541+
export type GetApiAuthGetSessionResponse = GetApiAuthGetSessionResponses[keyof GetApiAuthGetSessionResponses];
542+
516543
export type GetApiInternalDesktopCloudStatusData = {
517544
body?: never;
518545
path?: never;
@@ -1054,7 +1081,7 @@ export type GetApiInternalDesktopRewardsResponses = {
10541081
availableCredits?: number;
10551082
};
10561083
tasks: Array<{
1057-
id: 'daily_checkin' | 'github_star' | 'x_share' | 'reddit' | 'xiaohongshu' | 'lingying' | 'jike' | 'wechat' | 'feishu' | 'facebook' | 'whatsapp';
1084+
id: 'daily_checkin' | 'github_star' | 'x_share' | 'reddit' | 'mobile_share' | 'lingying' | 'facebook' | 'whatsapp';
10581085
group: 'daily' | 'opensource' | 'social';
10591086
icon: string;
10601087
reward: number;
@@ -1112,7 +1139,7 @@ export type PostApiInternalDesktopRewardsGithubStarSessionResponse = PostApiInte
11121139

11131140
export type PostApiInternalDesktopRewardsClaimData = {
11141141
body?: {
1115-
taskId: 'daily_checkin' | 'github_star' | 'x_share' | 'reddit' | 'xiaohongshu' | 'lingying' | 'jike' | 'wechat' | 'feishu' | 'facebook' | 'whatsapp';
1142+
taskId: 'daily_checkin' | 'github_star' | 'x_share' | 'reddit' | 'mobile_share' | 'lingying' | 'facebook' | 'whatsapp';
11161143
proof?: {
11171144
url?: string;
11181145
githubSessionId?: string;
@@ -1155,7 +1182,7 @@ export type PostApiInternalDesktopRewardsClaimResponses = {
11551182
availableCredits?: number;
11561183
};
11571184
tasks: Array<{
1158-
id: 'daily_checkin' | 'github_star' | 'x_share' | 'reddit' | 'xiaohongshu' | 'lingying' | 'jike' | 'wechat' | 'feishu' | 'facebook' | 'whatsapp';
1185+
id: 'daily_checkin' | 'github_star' | 'x_share' | 'reddit' | 'mobile_share' | 'lingying' | 'facebook' | 'whatsapp';
11591186
group: 'daily' | 'opensource' | 'social';
11601187
icon: string;
11611188
reward: number;

apps/web/src/i18n/locales/en.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ const en = {
304304
"rewards.group.social": "Social & messaging",
305305
"rewards.tab.web": "Web",
306306
"rewards.tab.mobile": "Mobile",
307-
"rewards.mobileQrHint": "Scan to complete tasks and earn credits",
307+
"rewards.mobileQrHint": "Scan with WeChat, Xiaohongshu, Jike, or Feishu",
308308
"rewards.mobileQrDesc":
309-
"Open nexu on mobile, complete sharing tasks to earn credits",
309+
"Open WeChat, Xiaohongshu, Jike, Feishu or similar clients to scan and complete sharing tasks",
310310
"rewards.cloudBalance": "Cloud Balance",
311311
"rewards.totalEarned": "Total earned",
312312
"rewards.totalUsed": "Total used",
@@ -334,6 +334,9 @@ const en = {
334334
"Only public URLs that match the platform format can be claimed.",
335335
"rewards.proofUrlInvalid":
336336
"The URL does not match the current platform format.",
337+
"rewards.proofUrlReopen": "Reopen share page",
338+
"rewards.proofUrlLoginGuidance":
339+
'If the browser landed on the platform\'s homepage, log in first, then click "Reopen share page" to jump to the pre-filled post page.',
337340
"rewards.progress": "{{earned}} / {{total}} completed",
338341
"rewards.card.cycle":
339342
"Available per weekly cycle, excluding daily repeat claims",
@@ -359,7 +362,7 @@ const en = {
359362
"budget.confirm.screenshotDesc":
360363
"Share first on the target platform, then come back and confirm to receive +${n} credits.",
361364
"budget.confirm.imageDesc":
362-
"Download the share card, post it on the platform, then come back and confirm to receive +${n} credits.",
365+
"After you complete the share, come back and confirm to receive +${n} credits.",
363366
"budget.confirm.downloadImage": "Download share card",
364367
"budget.confirm.done": "I've done it",
365368
"budget.confirm.cancel": "Not yet",
@@ -411,16 +414,11 @@ const en = {
411414
"reward.x_share.desc": "Once per week",
412415
"reward.reddit.name": "Post on Reddit",
413416
"reward.reddit.desc": "Once per week",
414-
"reward.xiaohongshu.name": "Post on 小红书",
415-
"reward.xiaohongshu.desc": "Once per week",
417+
"reward.mobile_share.name": "Share via mobile clients",
418+
"reward.mobile_share.desc":
419+
"Scan with WeChat, Xiaohongshu, Jike, or Feishu to share and earn credits",
416420
"reward.lingying.name": "Post on 瓴英",
417421
"reward.lingying.desc": "Once per week",
418-
"reward.jike.name": "Post on 即刻",
419-
"reward.jike.desc": "Once per week",
420-
"reward.wechat.name": "Share to WeChat",
421-
"reward.wechat.desc": "Once per week",
422-
"reward.feishu.name": "Share to 飞书",
423-
"reward.feishu.desc": "Once per week",
424422
"reward.facebook.name": "Share on Facebook",
425423
"reward.facebook.desc": "Once per week",
426424
"reward.whatsapp.name": "Share on WhatsApp",

apps/web/src/i18n/locales/zh-CN.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,9 @@ const zhCN = {
298298
"rewards.group.social": "社交与即时通讯",
299299
"rewards.tab.web": "Web 版",
300300
"rewards.tab.mobile": "移动端",
301-
"rewards.mobileQrHint": "扫码在移动端完成任务领取积分",
302-
"rewards.mobileQrDesc": "打开 nexu 移动端,完成分享任务即可领取积分",
301+
"rewards.mobileQrHint": "用微信、小红书、即刻、飞书等客户端扫码",
302+
"rewards.mobileQrDesc":
303+
"打开微信、小红书、即刻、飞书等客户端扫描二维码,完成分享任务即可领取积分",
303304
"rewards.cloudBalance": "云端余额",
304305
"rewards.totalEarned": "累计获得",
305306
"rewards.totalUsed": "累计消耗",
@@ -322,6 +323,9 @@ const zhCN = {
322323
"rewards.proofUrlPlaceholder": "粘贴你在对应平台发布后的公开链接",
323324
"rewards.proofUrlHint": "只有符合对应平台格式的公开链接才能领取积分。",
324325
"rewards.proofUrlInvalid": "链接格式不符合当前平台要求,请检查后重试。",
326+
"rewards.proofUrlReopen": "重新打开分享页",
327+
"rewards.proofUrlLoginGuidance":
328+
"如果浏览器停留在平台首页,请先登录,然后点击上方「重新打开分享页」跳转到预填好内容的发帖页。",
325329
"rewards.progress": "已完成 {{earned}} / {{total}}",
326330
"rewards.card.cycle": "每周周期内可领取,不含每日重复打卡",
327331
"rewards.card.weekly": "一次性任务与每周分享",
@@ -343,8 +347,7 @@ const zhCN = {
343347
"budget.confirm.desc": "完成操作后,回来确认即可领取 +${n} 积分。",
344348
"budget.confirm.screenshotDesc":
345349
"请先在目标平台完成分享,然后回来确认即可领取 +${n} 积分。",
346-
"budget.confirm.imageDesc":
347-
"请先下载分享卡并发布到对应平台,然后回来确认即可领取 +${n} 积分。",
350+
"budget.confirm.imageDesc": "完成扫码分享后,回来确认即可领取 +${n} 积分。",
348351
"budget.confirm.downloadImage": "下载分享卡",
349352
"budget.confirm.done": "我已完成",
350353
"budget.confirm.cancel": "稍后再说",
@@ -392,16 +395,11 @@ const zhCN = {
392395
"reward.x_share.desc": "每周可领一次",
393396
"reward.reddit.name": "发帖到 Reddit",
394397
"reward.reddit.desc": "每周可领一次",
395-
"reward.xiaohongshu.name": "发帖到小红书",
396-
"reward.xiaohongshu.desc": "每周可领一次",
398+
"reward.mobile_share.name": "移动端扫码分享",
399+
"reward.mobile_share.desc":
400+
"打开微信、小红书、即刻、飞书等客户端扫码完成分享,即可领取积分",
397401
"reward.lingying.name": "发帖到瓴英",
398402
"reward.lingying.desc": "每周可领一次",
399-
"reward.jike.name": "发帖到即刻",
400-
"reward.jike.desc": "每周可领一次",
401-
"reward.wechat.name": "分享到微信",
402-
"reward.wechat.desc": "每周可领一次",
403-
"reward.feishu.name": "分享到飞书",
404-
"reward.feishu.desc": "每周可领一次",
405403
"reward.facebook.name": "分享到 Facebook",
406404
"reward.facebook.desc": "每周可领一次",
407405
"reward.whatsapp.name": "分享到 WhatsApp",

apps/web/src/layouts/workspace-layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,9 +1032,7 @@ function WorkspaceLayoutInner() {
10321032
role="tooltip"
10331033
className="pointer-events-none absolute bottom-full left-0 z-40 mb-1.5 w-52 rounded-md bg-neutral-800 px-2.5 py-1.5 text-left text-[11px] font-normal leading-snug text-white opacity-0 shadow-lg transition-opacity duration-150 group-hover:opacity-100"
10341034
>
1035-
{t(
1036-
"layout.sidebar.balancePopup.earnedTooltip",
1037-
)}
1035+
{t("layout.sidebar.balancePopup.earnedTooltip")}
10381036
</span>
10391037
</span>
10401038
</span>

0 commit comments

Comments
 (0)