Skip to content

Commit

Permalink
feat: v0.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
theajack committed Jun 21, 2023
1 parent b8f647a commit 000780e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
6 changes: 6 additions & 0 deletions scripts/version.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
-->
# Version Log:

## 0.3.6

1. Fix The new version of Google Lighthouse is not released
2. Fix The mobile debugging tool is allowed after 5s
3. Set the interval default time to 500ms

## 0.3.5

1. Fix the problem that the debugging mode in the PC iOS mobile terminal does not work
Expand Down
6 changes: 6 additions & 0 deletions scripts/version.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
-->
# Version Log:

## 0.3.6

1. fix google lighthouse 新版本没有放行
2. fix 移动端调试工具5s之后被放行
3. 将interval默认时间设置为500ms

## 0.3.5

1. 修复pc端ios移动端中调试模式不起作用的问题
Expand Down
3 changes: 3 additions & 0 deletions src/detector/sub-detector/debug-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ export default class extends Detector {
this.onDevToolOpen();
}
}
static isUsing () {
return !!(window as any).eruda || !!(window as any)._vcOrigConsole;
}
}
2 changes: 1 addition & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const config: IConfig = {
url: '',
timeOutUrl: '',
tkName: 'ddtk',
interval: 200,
interval: 500,
disableMenu: true, // 是否禁用右键菜单
stopIntervalTime: 5000, // 在移动端时取消监视的等待时长
clearIntervalWhenDevOpenTrigger: false, // 是否在触发之后停止监控
Expand Down
3 changes: 2 additions & 1 deletion src/utils/interval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {clearLog} from './log';
import {clearDevToolOpenState, checkOnDevClose} from './open-state';
import {hackAlert, IS, onPageShowHide} from './util';
import {isIgnored} from 'src/plugins/ignore';
import DebugLib from 'src/detector/sub-detector/debug-lib';

let interval: any = 0, timer: any = 0;
const calls: Detector[] = [];
Expand All @@ -34,7 +35,7 @@ export function initInterval (dd: IDisableDevtool) {
// stopIntervalTime 之后判断 如果不是pc去掉定时器interval,为了优化移动端的性能
// 如果控制面板被打开了该定时器timer会被清除
timer = setTimeout(() => {
if (!IS.pc) {
if (!IS.pc && !DebugLib.isUsing()) {
clearDDInterval();
}
}, config.stopIntervalTime);
Expand Down
7 changes: 4 additions & 3 deletions src/utils/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ export function initIS () {
const iosChrome = has('crios');
const iosEdge = has('edgios');
const chrome = has('chrome') || iosChrome;
const seoBot = !mobile && /(googlebot|baiduspider|bingbot|applebot|petalbot|yandexbot|bytespider|chrome\-lighthouse)/i.test(ua);
// google lighthouse ua中有 moto g power
const seoBot = !mobile && /(googlebot|baiduspider|bingbot|applebot|petalbot|yandexbot|bytespider|chrome\-lighthouse|moto g power)/i.test(ua);

Object.assign(IS, {
iframe, pc, qqBrowser, firefox, macos, edge, oldEdge,
Expand All @@ -135,8 +136,8 @@ function isMobile () {
}
if (typeof platform === 'string') {
const v = platform.toLowerCase();
if (/(mac|win)/.test(v)) return false;
else if (/(android|iphone|ipad|ipod|arch)/.test(v)) return true;
if (/(mac|win)/i.test(v)) return false;
else if (/(android|iphone|ipad|ipod|arch)/i.test(v)) return true;
}
return isMobileByUa();
}
Expand Down

0 comments on commit 000780e

Please sign in to comment.