Skip to content

Commit 7c306cd

Browse files
committed
chore: add docs for login and access token issuance
1 parent 6763eaa commit 7c306cd

File tree

7 files changed

+50
-7
lines changed

7 files changed

+50
-7
lines changed

README.cn.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@
4747
- 帐号: `admin`
4848
- 密码: `123456`
4949

50+
## 登录并获取访问令牌
51+
52+
```sh
53+
code-push login https://<codepush-server-url>
54+
```
55+
56+
- 运行以上命令后将打开浏览器 → 登录账号 → 生成访问令牌
57+
- 令牌生成后,请将其输入回 CLI 终端以完成登录
58+
- WEB_UI_WHITELIST_IPS:允许访问 Web UI 的 IP 白名单(逗号分隔)
59+
例如:127.0.0.1,10.0.0.1
60+
- 访问令牌的有效期为 30 天。
61+
- WEB_UI_ALLOW:仅当该值设置为 true 时,才允许访问 Web UI
62+
5063
## 常见问题
5164

5265
- [修改密码](https://github.com/lisong/code-push-server/issues/43)
@@ -59,3 +72,7 @@
5972
- `>=1.2.3 <1.2.7`
6073
- `~1.2.3`
6174
- `^1.2.3`
75+
76+
```
77+
78+
```

README.ko.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ Microsoft 공식 CodePush 서비스는 아시아 지역에서 속도가 느린
8989
- 계정: `admin`
9090
- 비밀번호: `123456`
9191

92+
## 로그인 및 엑세스 토큰 발급하기
93+
94+
```sh
95+
code-push login https://<codepush-server-url>
96+
```
97+
98+
- 위 커맨드를 통해 웹브라우저 오픈하기
99+
- 토큰 발급 후 CLI 터미널에 입력
100+
- 토큰 유효기간은 약 30일
101+
- WEB_UI_WHITELIST_IPS: e.g., 127.0.0.1,10.0.0.1
102+
- WEB_UI_ALLOW: true인 경우에만 웹브라우저 UI 노출 허용
103+
92104
## FAQ
93105

94106
- [비밀번호 변경](https://github.com/lisong/code-push-server/issues/43)

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ check out the [code-push-cli](https://github.com/shm-open/code-push-cli) which w
4949
- account: `admin`
5050
- password: `123456`
5151

52+
## Login and Access Token Issuance
53+
54+
```sh
55+
code-push login https://<codepush-server-url>
56+
```
57+
58+
- Run the command above to open the web browser → authenticate → issue an access token
59+
- After the token is issued, enter it back into the CLI terminal when prompted
60+
- The access token is valid for 30 days.
61+
- WEB_UI_WHITELIST_IPS: Comma-separated list of allowed IP addresses
62+
e.g. 127.0.0.1,10.0.0.1
63+
- WEB_UI_ALLOW: Web UI access is enabled only when this value is set to true
64+
5265
## FAQ
5366

5467
- [modify password](https://github.com/lisong/code-push-server/issues/43)

src/core/services/account-manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class AccountManager {
6969
});
7070
}
7171

72-
isExsitAccessKeyName(uid: number, friendlyName: string) {
72+
isExistAccessKeyName(uid: number, friendlyName: string) {
7373
return UserTokens.findOne({
7474
where: { uid, name: friendlyName },
7575
});

src/routes/accessKeys.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export const accessKeysRouter = express.Router();
1212
accessKeysRouter.get('/', checkToken, (req: Req, res, next) => {
1313
const { logger } = req;
1414
const uid = req.users.id;
15-
logger.info('try get acceesKeys', { uid });
15+
logger.info('try get accessKeys', { uid });
1616
accountManager
1717
.getAllAccessKeyByUid(uid)
1818
.then((accessKeys) => {
19-
logger.info('get acceesKeys success', { uid });
19+
logger.info('get accessKeys success', { uid });
2020
res.send({ accessKeys });
2121
})
2222
.catch((e) => {
@@ -44,15 +44,16 @@ accessKeysRouter.post(
4444
const uid = req.users.id;
4545
const createdBy = _.trim(body.createdBy);
4646
const friendlyName = _.trim(body.friendlyName);
47-
const ttl = parseInt(body.ttl, 10);
47+
// TODO: 엑세스토큰 만료일을 수정하고 싶은 경우 tokens.pug 에서 전송되는 ttl을 수정
48+
const ttl = parseInt(body.ttl, 10); // 현재 호출부 기본값 30일 = 60*60*24*30*1000
4849
const description = _.trim(body.description);
4950
logger.info('try to generate access key', {
5051
uid,
5152
name: friendlyName,
5253
body: JSON.stringify(body),
5354
});
5455
return accountManager
55-
.isExsitAccessKeyName(uid, friendlyName)
56+
.isExistAccessKeyName(uid, friendlyName)
5657
.then((data) => {
5758
if (!_.isEmpty(data)) {
5859
throw new AppError(`The access key "${friendlyName}" already exists.`);

src/routes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const indexRouter = express.Router();
99
/**
1010
* 프로덕션 레벨 미들웨어 적용
1111
* - ipWhitelistOnly: IP주소 검사
12-
* - webUiGuard: NODE_ENV='production' OR ALLOW_REGISTRATION='true'
12+
* - webUiGuard: WEB_UI_ALLOW='true'
1313
*/
1414
indexRouter.get('/', [ipWhitelistOnly, webUiGuard], (req, res) => {
1515
res.render('index', { title: 'CodePushServer' });

views/tokens.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ block js
3333
createdBy = 'Login-' + time;
3434
}
3535

36-
// TODO: make ttl and friendlyNamee configurable
36+
// TODO: make ttl and friendlyName configurable
3737
var postParams = {
3838
createdBy: createdBy,
3939
friendlyName: "Login-" + time,

0 commit comments

Comments
 (0)