Bladeren bron

:bug: bugfix

LI JIAHAO 5 jaren geleden
bovenliggende
commit
2425f0d19a
3 gewijzigde bestanden met toevoegingen van 5 en 5 verwijderingen
  1. 2 2
      dist/webshot.js
  2. 1 1
      package.json
  3. 2 2
      src/webshot.ts

+ 2 - 2
dist/webshot.js

@@ -18,7 +18,7 @@ class Webshot extends CallableInstance {
         super('webshot');
         this.renderWebshot = (url, height, webshotDelay) => {
             const promise = new Promise(resolve => {
-                const width = 1080;
+                const width = 600;
                 logger.info(`shooting ${width}*${height} webshot for ${url}`);
                 this.browser.newPage()
                     .then(page => {
@@ -32,7 +32,7 @@ class Webshot extends CallableInstance {
                         .then(() => page.goto(url))
                         // hide header, "more options" button, like and retweet count
                         .then(() => page.addStyleTag({
-                        content: 'html{zoom:2}header{display:none!important}path[d=\'M20.207 7.043a1 1 0 0 0-1.414 0L12 13.836 5.207 7.043a1 1 0 0 0-1.414 1.414l7.5 7.5a.996.996 0 0 0 1.414 0l7.5-7.5a1 1 0 0 0 0-1.414z\'],div[role=\'button\']{display: none;}',
+                        content: 'header{display:none!important}path[d=\'M20.207 7.043a1 1 0 0 0-1.414 0L12 13.836 5.207 7.043a1 1 0 0 0-1.414 1.414l7.5 7.5a.996.996 0 0 0 1.414 0l7.5-7.5a1 1 0 0 0 0-1.414z\'],div[role=\'button\']{display: none;}',
                     }))
                         .then(() => page.waitFor(webshotDelay))
                         .then(() => page.addScriptTag({

+ 1 - 1
package.json

@@ -30,7 +30,7 @@
   "dependencies": {
     "callable-instance": "^1.0.0",
     "command-line-usage": "^5.0.5",
-    "cq-websocket": "^1.2.6",
+    "cq-websocket": "1.2.6",
     "log4js": "^2.10.0",
     "pngjs": "^3.3.3",
     "puppeteer": "^1.5.0",

+ 2 - 2
src/webshot.ts

@@ -31,7 +31,7 @@ class Webshot extends CallableInstance {
 
   private renderWebshot = (url: string, height: number, webshotDelay: number): Promise<string> => {
     const promise = new Promise<{ data: string, boundary: null | number }>(resolve => {
-      const width = 1080;
+      const width = 600;
       logger.info(`shooting ${width}*${height} webshot for ${url}`);
       this.browser.newPage()
         .then(page => {
@@ -45,7 +45,7 @@ class Webshot extends CallableInstance {
             .then(() => page.goto(url))
             // hide header, "more options" button, like and retweet count
             .then(() => page.addStyleTag({
-              content: 'html{zoom:2}header{display:none!important}path[d=\'M20.207 7.043a1 1 0 0 0-1.414 0L12 13.836 5.207 7.043a1 1 0 0 0-1.414 1.414l7.5 7.5a.996.996 0 0 0 1.414 0l7.5-7.5a1 1 0 0 0 0-1.414z\'],div[role=\'button\']{display: none;}',
+              content: 'header{display:none!important}path[d=\'M20.207 7.043a1 1 0 0 0-1.414 0L12 13.836 5.207 7.043a1 1 0 0 0-1.414 1.414l7.5 7.5a.996.996 0 0 0 1.414 0l7.5-7.5a1 1 0 0 0 0-1.414z\'],div[role=\'button\']{display: none;}',
             }))
             .then(() => page.waitFor(webshotDelay))
             .then(() => page.addScriptTag({