Rename to hkt.sh

This commit is contained in:
mango
2026-03-21 01:10:53 +08:00
parent 76a263d0f9
commit 8f1171fe99
6676 changed files with 1724268 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 berstend <github@berstend.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,81 @@
'use strict'
const merge = require('deepmerge')
const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin')
/**
* Launch puppeteer with arbitrary user preferences.
*
* The user defined preferences will be merged with preferences set by other plugins.
* Plugins can add user preferences by exposing a data entry with the name `userPreferences`.
*
* Overview:
* https://chromium.googlesource.com/chromium/src/+/master/chrome/common/pref_names.cc
*
* @param {Object} opts - Options
* @param {Object} [opts.userPrefs={}] - An object containing the preferences.
*
* @example
* const puppeteer = require('puppeteer-extra')
* puppeteer.use(require('puppeteer-extra-plugin-user-preferences')({userPrefs: {
* webkit: {
* webprefs: {
* default_font_size: 22
* }
* }
* }}))
* const browser = await puppeteer.launch()
*/
class Plugin extends PuppeteerExtraPlugin {
constructor(opts = {}) {
super(opts)
this._userPrefsFromPlugins = {}
const defaults = {
userPrefs: {}
}
this._opts = Object.assign(defaults, opts)
}
get name() {
return 'user-preferences'
}
get requirements() {
return new Set(['runLast', 'dataFromPlugins'])
}
get dependencies() {
return new Set(['user-data-dir'])
}
get data() {
return [
{
name: 'userDataDirFile',
value: {
target: 'Profile',
file: 'Preferences',
contents: JSON.stringify(this.combinedPrefs, null, 2)
}
}
]
}
get combinedPrefs() {
return merge(this._opts.userPrefs, this._userPrefsFromPlugins)
}
async beforeLaunch(options) {
this._userPrefsFromPlugins = merge.all(
this.getDataFromPlugins('userPreferences').map(d => d.value)
)
this.debug('_userPrefsFromPlugins', this._userPrefsFromPlugins)
}
}
module.exports = function(pluginConfig) {
return new Plugin(pluginConfig)
}

View File

@@ -0,0 +1,52 @@
{
"name": "puppeteer-extra-plugin-user-preferences",
"version": "2.4.1",
"description": "Launch puppeteer with arbitrary user preferences.",
"main": "index.js",
"repository": "berstend/puppeteer-extra",
"author": "berstend",
"license": "MIT",
"scripts": {
"docs": "node -e 0",
"lint": "eslint --ext .js .",
"test": "run-p lint",
"test-ci": "run-s test"
},
"engines": {
"node": ">=8"
},
"keywords": [
"puppeteer",
"puppeteer-extra",
"puppeteer-extra-plugin",
"user-prefs",
"user-preferences",
"chrome",
"headless",
"pupeteer"
],
"devDependencies": {
"ava": "2.4.0",
"npm-run-all": "^4.1.5",
"puppeteer": "^2.0.0"
},
"dependencies": {
"debug": "^4.1.1",
"deepmerge": "^4.2.2",
"puppeteer-extra-plugin": "^3.2.3",
"puppeteer-extra-plugin-user-data-dir": "^2.4.1"
},
"peerDependencies": {
"playwright-extra": "*",
"puppeteer-extra": "*"
},
"peerDependenciesMeta": {
"puppeteer-extra": {
"optional": true
},
"playwright-extra": {
"optional": true
}
},
"gitHead": "2f4a357f233b35a7a20f16ce007f5ef3f62765b9"
}

View File

@@ -0,0 +1,50 @@
# puppeteer-extra-plugin-user-preferences
> A plugin for [puppeteer-extra](https://github.com/berstend/puppeteer-extra).
### Install
```bash
yarn add puppeteer-extra-plugin-user-preferences
```
## API
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
#### Table of Contents
- [Plugin](#plugin)
### [Plugin](https://github.com/berstend/puppeteer-extra/blob/db57ea66cf10d407cf63af387892492e495a84f2/packages/puppeteer-extra-plugin-user-preferences/index.js#L30-L73)
**Extends: PuppeteerExtraPlugin**
Launch puppeteer with arbitrary user preferences.
The user defined preferences will be merged with preferences set by other plugins.
Plugins can add user preferences by exposing a data entry with the name `userPreferences`.
Overview:
<https://chromium.googlesource.com/chromium/src/+/master/chrome/common/pref_names.cc>
Type: `function (opts)`
- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`)
- `opts.userPrefs` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object containing the preferences. (optional, default `{}`)
Example:
```javascript
const puppeteer = require('puppeteer-extra')
puppeteer.use(require('puppeteer-extra-plugin-user-preferences')({userPrefs: {
webkit: {
webprefs: {
default_font_size: 22
}
}
}}))
const browser = await puppeteer.launch()
```
* * *