Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jan 19, 2025
1 parent f1f8745 commit fb0b2d7
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 10 deletions.
1 change: 0 additions & 1 deletion index-old.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
// } from 'egg-core';
// import EggCookies = require('egg-cookies');
// import 'egg-onerror';
// import 'egg-session';
// import 'egg-multipart';
// import 'egg-logrotator';
// import 'egg-view';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@eggjs/jsonp": "^3.0.0",
"@eggjs/schedule": "^5.0.2",
"@eggjs/security": "^4.0.0",
"@eggjs/session": "^4.0.0",
"@eggjs/static": "^3.0.0",
"@eggjs/utils": "^4.2.4",
"@eggjs/watcher": "^4.0.3",
Expand All @@ -37,7 +38,6 @@
"egg-logrotator": "^3.1.0",
"egg-multipart": "^3.1.0",
"egg-onerror": "^2.1.1",
"egg-session": "^3.3.0",
"egg-view": "^2.1.3",
"extend2": "^4.0.0",
"graceful": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion site/docs/basics/controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ module.exports = {

By using Cookie, we can create an individual Session specific to every user to store user identity information, which will be encrypted then stored in Cookie to perform session persistence across requests.

The framework builds in [Session](https://github.com/eggjs/egg-session) plugin, which provides `ctx.session` for us to get or set current user's Session.
The framework builds in [Session](https://github.com/eggjs/session) plugin, which provides `ctx.session` for us to get or set current user's Session.

```js
class PostController extends Controller {
Expand Down
4 changes: 2 additions & 2 deletions site/docs/basics/controller.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ module.exports = {

Cookie 可以存储每个用户的 Session 来保持跨请求的用户身份。这些信息加密后存储在 Cookie 中。

框架内置了 [Session](https://github.com/eggjs/egg-session) 插件,通过 `ctx.session` 访问或修改用户 Session:
框架内置了 [Session](https://github.com/eggjs/session) 插件,通过 `ctx.session` 访问或修改用户 Session:

```js
class PostController extends Controller {
Expand Down Expand Up @@ -1077,4 +1077,4 @@ exports.security = {
};
```

如果没有配置 `domainWhiteList``domainWhiteList` 数组为空,则默认允许所有跳转请求,等同于使用 `ctx.unsafeRedirect(url)`
如果没有配置 `domainWhiteList``domainWhiteList` 数组为空,则默认允许所有跳转请求,等同于使用 `ctx.unsafeRedirect(url)`
2 changes: 1 addition & 1 deletion site/docs/basics/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Specific consolidation rules can be found in [Configuration](./config.md).

- Framework has default built-in plugins for enterprise applications [Common plugins](https://eggjs.org/zh-cn/plugins/):
  - [onerror](https://github.com/eggjs/egg-onerror) Uniform Exception Handling
  - [Session](https://github.com/eggjs/egg-session) Session implementation
  - [session](https://github.com/eggjs/session) Session implementation
  - [i18n](https://github.com/eggjs/i18n) Multilingual
  - [watcher](https://github.com/eggjs/watcher) File and folder monitoring
  - [multipart](https://github.com/eggjs/egg-multipart) File Streaming Upload
Expand Down
2 changes: 1 addition & 1 deletion site/docs/basics/plugin.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ exports.mysql = {

- 框架默认内置了企业级应用[常用的插件](https://eggjs.org/zh-cn/plugins/)
- [onerror](https://github.com/eggjs/egg-onerror) 统一异常处理
- [Session](https://github.com/eggjs/egg-session) Session 实现
- [session](https://github.com/eggjs/session) Session 实现
- [i18n](https://github.com/eggjs/i18n) 多语言
- [watcher](https://github.com/eggjs/watcher) 文件和文件夹监控
- [multipart](https://github.com/eggjs/egg-multipart) 文件流式上传
Expand Down
2 changes: 1 addition & 1 deletion site/docs/core/cookie-and-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ In web applications, Cookie is usually used to identify users.
So the concept of Session, which is built on top of Cookie,
was created to specifically handle user identification.

Egg.js built-in supports Session through [egg-session](https://github.com/eggjs/egg-session) plugin.
Egg.js built-in supports Session through [@eggjs/session](https://github.com/eggjs/session) plugin.
We can use `ctx.session` to read or modify current user session.

```js
Expand Down
2 changes: 1 addition & 1 deletion site/docs/core/cookie-and-session.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ keys 配置成一个字符串,可以按照逗号分隔配置多个 key。Cooki

Cookie 通常用作 Web 应用中标识请求方身份的功能,基于此,Web 应用封装了 Session 概念,专用于用户身份识别。

框架内置了 [Session](https://github.com/eggjs/egg-session) 插件,提供了 `ctx.session` 用于访问或修改当前用户的 Session。
框架内置了 [Session](https://github.com/eggjs/session) 插件,提供了 `ctx.session` 用于访问或修改当前用户的 Session。

```js
class HomeController extends Controller {
Expand Down
2 changes: 1 addition & 1 deletion src/config/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
*/
session: {
enable: true,
package: 'egg-session',
package: '@eggjs/session',
},

/**
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import '@eggjs/i18n';
import '@eggjs/static';
import '@eggjs/security';
import '@eggjs/schedule';
import '@eggjs/session';

export type {
EggAppInfo,
Expand Down
3 changes: 3 additions & 0 deletions test/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ expectType<string>(ctx.locale = 'en-us');
// security plugin types
expectType<string>(app.config.security.csrf.headerName);

// session plugin types
expectType<boolean>(app.config.session.httpOnly);

class AppBoot implements ILifecycleBoot {
private readonly app: Application;

Expand Down

0 comments on commit fb0b2d7

Please sign in to comment.