feat: 0.1.0 check version.md for details

This commit is contained in:
theajack 2021-01-24 15:25:04 +08:00
parent 1e89ef0d6d
commit c578a64161
19 changed files with 82 additions and 84 deletions

View File

@ -61,9 +61,9 @@ disable-devtool 可以禁用所有一切可以进入开发者工具的方法,
2. 禁用 f12 和 ctrl+shift+i 快捷键
3. 支持识别从浏览器菜单栏打开开发者工具并关闭当前页面
4. 开发者可以绕过禁用 (url参数使用tk配合md5加密)
5. 支持几乎所有浏览器(包含IE
5. 支持几乎所有浏览器IE,360,qq浏览器,FireFox,Chrome,Edge...
6. 高度可配置
7. 使用极简、体积小巧 (仅6kb)
7. 使用极简、体积小巧 (仅7kb)
8. 支持npm引用和script标签引用(属性配置)
9. 识别真移动端与浏览器开发者工具设置插件伪造的移动端,为移动端节省性能
@ -91,15 +91,12 @@ declare interface optionStatic {
url?: string; // 关闭页面失败时的跳转页面默认值为localhost
tkName?: string; // 绕过禁用时的url参数名称默认为 ddtk
ondevtoolopen?(): void; // 开发者面板打开的回调启用时url参数无效
debugDelay?: number; // debug模式时的延迟 默认200ms
interval?: number; // 定时器的时间间隔 默认200ms
disableMenu?: boolean; // 是否禁用右键菜单 默认为true
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
}
```
备注disableMenu参数在ie下无效因为ie下右键会阻塞主进程且无法监听
### 3.2 md5 与 tk 绕过禁用
该库中使用 key 与 md5 配合的方式使得开发者可以在线上绕过禁用。
@ -123,7 +120,6 @@ disableDevtool.md5('xxx');
md5='xxx'
url='xxx'
tk-name='xxx'
debug-delay='xxx'
interval='xxx'
disable-menu='xxx'
></script>

View File

@ -60,9 +60,9 @@ The library has the following features:
2. Disable f12 and ctrl+shift+i shortcuts
3. Support recognition to open the developer tools from the browser menu bar and close the current page
4. Developers can bypass the disablement (use tk and md5 encryption for url parameters)
5. Support almost all browsers (Include IE)
5. Support almost all browsers (IE,360,qq browser,FireFox,Chrome,Edge...)
6. Highly configurable
7. Minimal use, small size (only 6kb)
7. Minimal use, small size (only 7kb)
8. Support npm reference and script tag reference (attribute configuration)
9. Identify the real mobile terminal and browser developer tool settings plug-in forged mobile terminal, saving performance for the mobile terminal
@ -90,15 +90,12 @@ declare interface optionStatic {
url?: string; // Jump to the page when closing the page fails, the default value is localhost
tkName?: string; // Bypass the url parameter name when disabled, the default is ddtk
ondevtoolopen?(): void; // Callback for opening the developer panel, the url parameter is invalid when enabled
debugDelay?: number; // The delay in debug mode is 200ms by default
interval?: number; // Timer interval is 200ms by default
disableMenu?: boolean; // Whether to disable the right-click menu The default is true
stopIntervalTime?: number; // Waiting time to cancel monitoring on mobile
}
```
Note: The disableMenu parameter is invalid under ie, because the right button under ie will block the main process and cannot monitor
### 3.2 md5 and tk bypass disable
The combination of key and md5 in the library allows developers to bypass the disabling online.
@ -122,7 +119,6 @@ disableDevtool.md5('xxx');
md5='xxx'
url='xxx'
tk-name='xxx'
debug-delay='xxx'
interval='xxx'
disable-menu='xxx'
></script>

View File

@ -13,7 +13,7 @@ function copyPkg () {
let npmPkg = util.pick({
target: pkg,
attrs: [
'name', 'version', 'description', 'main', 'scripts', 'unpkg', 'jsdelivr',
'name', 'version', 'description', 'main', 'unpkg', 'jsdelivr',
'typings', 'repository', 'keywords', 'author', 'license', 'bugs', 'homepage'
]
});

View File

@ -7,7 +7,7 @@
4. 开发者可以绕过禁用 (url参数使用tk配合md5加密)
5. 支持几乎所有浏览器
6. 高度可配置
7. 使用极简、体积小巧 (仅6kb)
7. 使用极简、体积小巧 (仅7kb)
8. 支持npm引用和script标签引用(属性配置)
## 0.0.2
@ -30,3 +30,8 @@
1. 对于标签属性配置移除id='disable-devtool' 条件,使用 disable-devtool-auto属性
2. 修改readme
## 0.1.0
1. 修复firefox和qq浏览器下无效的问题
2. 启用 disableMenu 配置
3. 去除内部debug逻辑
4. 增加默认跳转的404页面

View File

@ -97,9 +97,9 @@ disableDevtool();</code>
<li>Disable f12 and ctrl+shift+i shortcuts</li>
<li>Support recognition to open the developer tools from the browser menu bar and close the current page</li>
<li>Developers can bypass the disablement (use tk and md5 encryption for url parameters)</li>
<li>Support almost all browsers (Include IE)</li>
<li>Support almost all browsers (IE,360,qq browser,FireFox,Chrome,Edge...)</li>
<li>Highly configurable</li>
<li>Minimal use, small size (only 6kb)</li>
<li>Minimal use, small size (only 7kb)</li>
<li>Support npm reference and script tag reference (attribute configuration)</li>
<li>Identify the real mobile terminal and browser developer tool settings plug-in forged mobile terminal, saving performance for the mobile terminal</li>
</ol>
@ -122,9 +122,9 @@ disableDevtool(options);</code></p>
url?: string; // Jump to the page when closing the page fails, the default value is localhost
tkName?: string; // Bypass the url parameter name when disabled, the default is ddtk
ondevtoolopen?(): void; // Callback for opening the developer panel, the url parameter is invalid when enabled
debugDelay?: number; // The delay in debug mode is 200ms by default
interval?: number; // Timer interval is 200ms by default
disableMenu?: boolean; // Whether to disable the right-click menu The default is true
stopIntervalTime?: number; // Waiting time to cancel monitoring on mobile
}</code></p>
<h3>3.2 md5 and tk bypass disable</h3>
@ -156,7 +156,6 @@ disableDevtool(options);</code></p>
md5=&#39;xxx&#39;
url=&#39;xxx&#39;
tk-name=&#39;xxx&#39;
debug-delay=&#39;xxx&#39;
interval=&#39;xxx&#39;
disable-menu=&#39;xxx&#39;>
&lt;/script&gt;</code></p>

View File

@ -61,9 +61,9 @@ disable-devtool 可以禁用所有一切可以进入开发者工具的方法,
2. 禁用 f12 和 ctrl+shift+i 快捷键
3. 支持识别从浏览器菜单栏打开开发者工具并关闭当前页面
4. 开发者可以绕过禁用 (url参数使用tk配合md5加密)
5. 支持几乎所有浏览器(包含IE
5. 支持几乎所有浏览器IE,360,qq浏览器,FireFox,Chrome,Edge...
6. 高度可配置
7. 使用极简、体积小巧 (仅6kb)
7. 使用极简、体积小巧 (仅7kb)
8. 支持npm引用和script标签引用(属性配置)
9. 识别真移动端与浏览器开发者工具设置插件伪造的移动端,为移动端节省性能
@ -91,15 +91,12 @@ declare interface optionStatic {
url?: string; // 关闭页面失败时的跳转页面默认值为localhost
tkName?: string; // 绕过禁用时的url参数名称默认为 ddtk
ondevtoolopen?(): void; // 开发者面板打开的回调启用时url参数无效
debugDelay?: number; // debug模式时的延迟 默认200ms
interval?: number; // 定时器的时间间隔 默认200ms
disableMenu?: boolean; // 是否禁用右键菜单 默认为true
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
}
```
备注disableMenu参数在ie下无效因为ie下右键会阻塞主进程且无法监听
### 3.2 md5 与 tk 绕过禁用
该库中使用 key 与 md5 配合的方式使得开发者可以在线上绕过禁用。
@ -123,7 +120,6 @@ disableDevtool.md5('xxx');
md5='xxx'
url='xxx'
tk-name='xxx'
debug-delay='xxx'
interval='xxx'
disable-menu='xxx'
></script>

View File

@ -60,9 +60,9 @@ The library has the following features:
2. Disable f12 and ctrl+shift+i shortcuts
3. Support recognition to open the developer tools from the browser menu bar and close the current page
4. Developers can bypass the disablement (use tk and md5 encryption for url parameters)
5. Support almost all browsers (Include IE)
5. Support almost all browsers (IE,360,qq browser,FireFox,Chrome,Edge...)
6. Highly configurable
7. Minimal use, small size (only 6kb)
7. Minimal use, small size (only 7kb)
8. Support npm reference and script tag reference (attribute configuration)
9. Identify the real mobile terminal and browser developer tool settings plug-in forged mobile terminal, saving performance for the mobile terminal
@ -90,15 +90,12 @@ declare interface optionStatic {
url?: string; // Jump to the page when closing the page fails, the default value is localhost
tkName?: string; // Bypass the url parameter name when disabled, the default is ddtk
ondevtoolopen?(): void; // Callback for opening the developer panel, the url parameter is invalid when enabled
debugDelay?: number; // The delay in debug mode is 200ms by default
interval?: number; // Timer interval is 200ms by default
disableMenu?: boolean; // Whether to disable the right-click menu The default is true
stopIntervalTime?: number; // Waiting time to cancel monitoring on mobile
}
```
Note: The disableMenu parameter is invalid under ie, because the right button under ie will block the main process and cannot monitor
### 3.2 md5 and tk bypass disable
The combination of key and md5 in the library allows developers to bypass the disabling online.
@ -122,7 +119,6 @@ disableDevtool.md5('xxx');
md5='xxx'
url='xxx'
tk-name='xxx'
debug-delay='xxx'
interval='xxx'
disable-menu='xxx'
></script>

File diff suppressed because one or more lines are too long

3
npm/index.d.ts vendored
View File

@ -3,9 +3,8 @@ declare interface optionStatic {
url?: string; // 关闭页面失败时的跳转页面默认值为localhost
tkName?: string; // 绕过禁用时的url参数名称默认为 ddtk
ondevtoolopen?(): void; // 开发者面板打开的回调启用时url参数无效
debugDelay?: number; // debug模式时的延迟 默认200ms
interval?: number; // 定时器的时间间隔 默认200ms
disableMenu?: boolean; // 是否禁用右键菜单 默认为true ie下无效
disableMenu?: boolean; // 是否禁用右键菜单 默认为true
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
}
declare interface DDTStatic {

View File

@ -1,14 +1,9 @@
{
"name": "disable-devtool",
"version": "0.0.8",
"version": "0.1.0",
"description": "Disable web developer tools from the f12 button, right-click and browser ",
"main": "disable-devtool.min.js",
"scripts": {
"dev": "webpack-dev-server --open --config webpack-config/dev.js",
"start": "npm run dev",
"build": "webpack --config webpack-config/build.js",
"publish": "npm publish npm",
"lint": "eslint src --ext js"
},
"unpkg": "disable-devtool.min.js",
"jsdelivr": "disable-devtool.min.js",
@ -18,7 +13,9 @@
"url": "https://github.com/theajack/disable-devtool"
},
"keywords": [
"disable-devtool"
"disable-devtool",
"禁用F12",
"禁用开发者工具"
],
"author": "theajack",
"license": "MIT",

View File

@ -1,6 +1,6 @@
{
"name": "disable-devtool",
"version": "0.0.8",
"version": "0.1.0",
"description": "Disable web developer tools from the f12 button, right-click and browser ",
"main": "disable-devtool.min.js",
"unpkg": "disable-devtool.min.js",
@ -23,7 +23,9 @@
"url": "https://github.com/theajack/disable-devtool"
},
"keywords": [
"ebuild-cli"
"disable-devtool",
"禁用F12",
"禁用开发者工具"
],
"license": "MIT",
"devDependencies": {

View File

@ -1,5 +1,7 @@
// import disableDevtool from '../src';
import disableDevtool from '../npm';
import disableDevtool from '../src';
// import disableDevtool from '../npm';
// debugger;
disableDevtool({
md5: 'd4de605ccb923b7e876b3218a1474653',

View File

@ -5,7 +5,6 @@ export let config = {
ondevtoolopen: closeWindow, // ondevtoolopen 优先级高于 url
url: '',
tkName: 'ddtk',
debugDelay: 200,
interval: 200,
disableMenu: true, // 该参数ie下无效ie 右键菜单会阻塞线程影响debug延迟计算 禁用右键菜单
stopIntervalTime: 5000, // 在移动端时取消监视的等待时长

3
src/index.d.ts vendored
View File

@ -3,9 +3,8 @@ declare interface optionStatic {
url?: string; // 关闭页面失败时的跳转页面默认值为localhost
tkName?: string; // 绕过禁用时的url参数名称默认为 ddtk
ondevtoolopen?(): void; // 开发者面板打开的回调启用时url参数无效
debugDelay?: number; // debug模式时的延迟 默认200ms
interval?: number; // 定时器的时间间隔 默认200ms
disableMenu?: boolean; // 是否禁用右键菜单 默认为true ie下无效
disableMenu?: boolean; // 是否禁用右键菜单 默认为true
stopIntervalTime?: number; // 在移动端时取消监视的等待时长
}
declare interface DDTStatic {

View File

@ -12,7 +12,6 @@ export function initInterval () {
onPageShowHide(goon, pause); // 防止切后台触发了debug延迟计算
interval = window.setInterval(() => {
console.log(1);
if (_pause) return;
calls.forEach(fn => {fn();});
}, config.interval);

View File

@ -1,5 +1,4 @@
import {config} from './config';
import {isIE} from './util';
export function disableKeyAndMenu () {
window.addEventListener('keydown', (e) => {
@ -12,7 +11,7 @@ export function disableKeyAndMenu () {
return false;
}
}, false);
if (config.disableMenu || isIE()) { // ie 右键菜单会阻塞线程影响debug延迟计算 禁用右键菜单
if (config.disableMenu) {
window.addEventListener('contextmenu', (e) => {
e = e || window.event;
e.returnValue = false;

View File

@ -1,6 +1,6 @@
import {disableKeyAndMenu} from './key-menu';
import {initInterval, registInterval, clearTimeout} from './interval';
import {formatName, getUrlParam} from './util';
import {formatName, getUrlParam, isFirefox, isQQBrowser} from './util';
import {mergeConfig, config} from './config';
import md5 from './md5';
import version from './version';
@ -11,7 +11,6 @@ export function disableDevtool (opts) {
initInterval();
disableKeyAndMenu();
initDevTool();
// initDebugger();
}
disableDevtool.md5 = md5;
@ -19,10 +18,16 @@ disableDevtool.version = version;
let hasOpened = false;
export function onDevToolOpen () {
if (hasOpened) {return;}
hasOpened = true;
clearTimeout();
config.ondevtoolopen();
let time = new Date().getTime();
console.log('You ar not allow to use DEVTOOL!', time);
if (!isQQBrowser()) {
if (hasOpened) {return {time, next () {}};}
hasOpened = true;
}
return {time, next () {
clearTimeout();
config.ondevtoolopen();
}};
}
function checkTk () {
@ -35,42 +40,39 @@ function checkTk () {
return false;
}
// let disableDebug = false; // 当 initDevTool 方式生效时去除debug断点
// 去除debug的逻辑
// function initDebugger () {
// let debug = new Function('debugger');
// registInterval(() => {
// if (disableDebug) {
// return;
// }
// var last = getNowTime();
// // debug();
// // interval 时间是 config.interval设置config.debugDelay是为了给一个执行的时间
// if (getNowTime() - last > config.interval + config.debugDelay) {
// onDevToolOpen();
// }
// });
// }
function initDevTool () {
const isFF = ~navigator.userAgent.indexOf('Firefox');
const isQQ = isQQBrowser();
const isFF = isFirefox();
let toTest = '';
if (isFF) {
if (isQQ) {
let lastTime = 0;
toTest = /./;
console.log(toTest);
toTest.toString = function () {
// disableDebug = true;
onDevToolOpen();
let {time, next} = onDevToolOpen();
if (lastTime && time - lastTime < 100) {
next();
} else {
lastTime = time;
}
return '';
};
} else if (isFF) {
toTest = /./;
console.log(toTest);
toTest.toString = function () {
onDevToolOpen().next();
return '';
};
} else {
toTest = new Image();
toTest.__defineGetter__('id', function () {
// disableDebug = true;
onDevToolOpen();
onDevToolOpen().next();
});
}
registInterval(() => {
console.log(toTest);
console.clear && console.clear();
console.clear();
});
}
@ -80,10 +82,10 @@ function checkScriptUse () {
return;
}
let json = {};
['md5', 'url', 'tk-name', 'debug-delay', 'interval', 'disable-menu'].forEach(name => {
['md5', 'url', 'tk-name', 'interval', 'disable-menu'].forEach(name => {
let value = dom.getAttribute(name);
if (value !== null) {
if (name === 'debug-delay' || name === 'interval') {
if (name === 'interval') {
value = parseInt(value);
} else if (name === 'disable-menu') {
value = value === 'false' ? false : true;

View File

@ -14,7 +14,7 @@ export function closeWindow () {
window.close();
window.history.back();
setTimeout(() => {
window.location.href = 'http://localhost';
window.location.href = `https://tackchen.gitee.io/404.html?h=${encodeURIComponent(location.host)}`;
}, 100);
}
// 否则执行跳转到 url
@ -129,4 +129,16 @@ export function isIE () {
// } else {
// return -1;// 不是ie浏览器
// }
}
export function isQQBrowser () {
return hasUaName('qqbrowser');
}
export function isFirefox () {
return hasUaName('firefox');
}
function hasUaName (name) {
return navigator.userAgent.toLocaleLowerCase().indexOf(name) !== -1;
}

View File

@ -1 +1 @@
export default '0.0.7';
export default '0.1.0';