koishi-plugin-wordle-game 2.1.6 → 2.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +15 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1828,7 +1828,9 @@ ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
1828
1828
  });
1829
1829
  // ch*
1830
1830
  async function generateHandlePinyinsImage(pinyinsHtml) {
1831
- const page = await ctx.puppeteer.page();
1831
+ const browser = ctx.puppeteer.browser;
1832
+ const context = await browser.createBrowserContext();
1833
+ const page = await context.newPage();
1832
1834
  await page.setViewport({ width: 420, height: 570, deviceScaleFactor: 1 });
1833
1835
  const filePath = path.join(__dirname, 'emptyHtml.html').replace(/\\/g, '/');
1834
1836
  await page.goto('file://' + filePath);
@@ -1907,7 +1909,9 @@ ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
1907
1909
  return resultStrings.join('\n');
1908
1910
  }
1909
1911
  async function generateWordlesImage(htmlImgString) {
1910
- const page = await ctx.puppeteer.page();
1912
+ const browser = ctx.puppeteer.browser;
1913
+ const context = await browser.createBrowserContext();
1914
+ const page = await context.newPage();
1911
1915
  await page.setViewport({
1912
1916
  width: config.compositeImagePageWidth,
1913
1917
  height: config.compositeImagePageHeight,
@@ -2480,7 +2484,9 @@ ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
2480
2484
  }
2481
2485
  }
2482
2486
  async function generateImage(styledHtml, gridHtml) {
2483
- const page = await ctx.puppeteer.page();
2487
+ const browser = ctx.puppeteer.browser;
2488
+ const context = await browser.createBrowserContext();
2489
+ const page = await context.newPage();
2484
2490
  await page.setViewport({ width: 611, height: 731, deviceScaleFactor: 1 });
2485
2491
  const filePath = path.join(__dirname, 'emptyHtml.html').replace(/\\/g, '/');
2486
2492
  await page.goto('file://' + filePath);
@@ -2497,7 +2503,9 @@ ${rankType3.map((type, index) => `${index + 1}. ${type}`).join('\n')}
2497
2503
  return imageBuffer;
2498
2504
  }
2499
2505
  async function generateImageForCiying(gridHtml, rowNum) {
2500
- const page = await ctx.puppeteer.page();
2506
+ const browser = ctx.puppeteer.browser;
2507
+ const context = await browser.createBrowserContext();
2508
+ const page = await context.newPage();
2501
2509
  await page.setViewport({ width: 611, height: 140 * rowNum, deviceScaleFactor: 1 });
2502
2510
  const filePath = path.join(__dirname, 'emptyHtml.html').replace(/\\/g, '/');
2503
2511
  await page.goto('file://' + filePath);
@@ -2539,7 +2547,9 @@ ${gridHtml}
2539
2547
  return imageBuffer;
2540
2548
  }
2541
2549
  async function generateImageForHandle(gridHtml) {
2542
- const page = await ctx.puppeteer.page();
2550
+ const browser = ctx.puppeteer.browser;
2551
+ const context = await browser.createBrowserContext();
2552
+ const page = await context.newPage();
2543
2553
  await page.setViewport({ width: 611, height: 731, deviceScaleFactor: 1 });
2544
2554
  const filePath = path.join(__dirname, 'emptyHtml.html').replace(/\\/g, '/');
2545
2555
  await page.goto('file://' + filePath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-wordle-game",
3
3
  "description": "欢迎来到 [Wordle](https://www.nytimes.com/games/wordle/index.html) | [汉兜](https://handle.antfu.me/) | [词影](https://cy.surprising.studio/) |... 猜单词|猜成语|猜数字|猜数学方程式|... 的小游戏,包含多种词库、多种主题、多种游戏设置和排行榜系统。",
4
- "version": "2.1.6",
4
+ "version": "2.1.7",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [