Skip to content

Commit 000780e

Browse files
committed
feat: v0.3.6
1 parent b8f647a commit 000780e

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

scripts/version.en.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
-->
66
# Version Log:
77

8+
## 0.3.6
9+
10+
1. Fix The new version of Google Lighthouse is not released
11+
2. Fix The mobile debugging tool is allowed after 5s
12+
3. Set the interval default time to 500ms
13+
814
## 0.3.5
915

1016
1. Fix the problem that the debugging mode in the PC iOS mobile terminal does not work

scripts/version.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
-->
66
# Version Log:
77

8+
## 0.3.6
9+
10+
1. fix google lighthouse 新版本没有放行
11+
2. fix 移动端调试工具5s之后被放行
12+
3. 将interval默认时间设置为500ms
13+
814
## 0.3.5
915

1016
1. 修复pc端ios移动端中调试模式不起作用的问题

src/detector/sub-detector/debug-lib.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ export default class extends Detector {
2727
this.onDevToolOpen();
2828
}
2929
}
30+
static isUsing () {
31+
return !!(window as any).eruda || !!(window as any)._vcOrigConsole;
32+
}
3033
}

src/utils/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const config: IConfig = {
1313
url: '',
1414
timeOutUrl: '',
1515
tkName: 'ddtk',
16-
interval: 200,
16+
interval: 500,
1717
disableMenu: true, // 是否禁用右键菜单
1818
stopIntervalTime: 5000, // 在移动端时取消监视的等待时长
1919
clearIntervalWhenDevOpenTrigger: false, // 是否在触发之后停止监控

src/utils/interval.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {clearLog} from './log';
1010
import {clearDevToolOpenState, checkOnDevClose} from './open-state';
1111
import {hackAlert, IS, onPageShowHide} from './util';
1212
import {isIgnored} from 'src/plugins/ignore';
13+
import DebugLib from 'src/detector/sub-detector/debug-lib';
1314

1415
let interval: any = 0, timer: any = 0;
1516
const calls: Detector[] = [];
@@ -34,7 +35,7 @@ export function initInterval (dd: IDisableDevtool) {
3435
// stopIntervalTime 之后判断 如果不是pc去掉定时器interval,为了优化移动端的性能
3536
// 如果控制面板被打开了该定时器timer会被清除
3637
timer = setTimeout(() => {
37-
if (!IS.pc) {
38+
if (!IS.pc && !DebugLib.isUsing()) {
3839
clearDDInterval();
3940
}
4041
}, config.stopIntervalTime);

src/utils/util.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ export function initIS () {
116116
const iosChrome = has('crios');
117117
const iosEdge = has('edgios');
118118
const chrome = has('chrome') || iosChrome;
119-
const seoBot = !mobile && /(googlebot|baiduspider|bingbot|applebot|petalbot|yandexbot|bytespider|chrome\-lighthouse)/i.test(ua);
119+
// google lighthouse ua中有 moto g power
120+
const seoBot = !mobile && /(googlebot|baiduspider|bingbot|applebot|petalbot|yandexbot|bytespider|chrome\-lighthouse|moto g power)/i.test(ua);
120121

121122
Object.assign(IS, {
122123
iframe, pc, qqBrowser, firefox, macos, edge, oldEdge,
@@ -135,8 +136,8 @@ function isMobile () {
135136
}
136137
if (typeof platform === 'string') {
137138
const v = platform.toLowerCase();
138-
if (/(mac|win)/.test(v)) return false;
139-
else if (/(android|iphone|ipad|ipod|arch)/.test(v)) return true;
139+
if (/(mac|win)/i.test(v)) return false;
140+
else if (/(android|iphone|ipad|ipod|arch)/i.test(v)) return true;
140141
}
141142
return isMobileByUa();
142143
}

0 commit comments

Comments
 (0)