Skip to content

Commit

Permalink
feat: 监控增加 referer 字段,记录来源地址
Browse files Browse the repository at this point in the history
  • Loading branch information
strick committed May 8, 2023
1 parent b05ff75 commit 9e483b0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/lib/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: strick
* @LastEditors: strick
* @Date: 2023-01-12 18:18:45
* @LastEditTime: 2023-01-25 13:53:16
* @LastEditTime: 2023-05-08 16:10:55
* @Description: 通信
* @FilePath: /web/shin-monitor/src/lib/http.ts
*/
Expand Down Expand Up @@ -42,6 +42,7 @@ class Http {
obj.token = this.params.token;
obj.subdir = this.params.subdir;
obj.identity = this.getIdentity();
obj.referer = location.href; // 来源地址,即当前页面地址
// return encodeURIComponent(JSON.stringify(obj));
return JSON.stringify(obj);
}
Expand Down
4 changes: 3 additions & 1 deletion src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: strick
* @LastEditors: strick
* @Date: 2023-01-12 18:03:08
* @LastEditTime: 2023-01-16 10:53:35
* @LastEditTime: 2023-05-08 16:10:06
* @Description: 自定义的声明文件
* @FilePath: /web/shin-monitor/src/typings.d.ts
*/
Expand Down Expand Up @@ -113,6 +113,7 @@ interface TypeResourceDesc {
export interface TypeErrorData {
type: string;
desc: string | TypeCrashDesc | TypeRuntimeDesc | TypeResourceDesc | TypeAjaxDesc;
referer?: string; // 来源地址,即当前页面地址
version?: string;
lineno?: number;
colno?: number;
Expand Down Expand Up @@ -150,6 +151,7 @@ export interface TypeSendParams {
token?: string;
subdir?: string;
identity?: string;
referer?: string;
data: TypeErrorData | TypeAjaxData;
}
/*************************************************************************
Expand Down

0 comments on commit 9e483b0

Please sign in to comment.