Files
li 1b24994e74 feat: 后端全量更新 - 含所有本次需求
- Contract.php: 返回合约账户余额(balance_contract)
- My.php: 地址管理增加BTC/ETH
- AppContract.php: 一键平仓(closeall)
- AppProxy.php: 代理专属注册链接 + 分级权限(L1/L2)
- site.php: 手续费减半(0.018→0.009)
- agent_permission_setup.sql: 代理权限SQL
- crypto_news_crawler.py: 新闻自动采集脚本
2026-03-30 20:16:32 +08:00

41 lines
1.3 KiB
JavaScript
Executable File

/*
* Copyright (C) 1998-2020 by Northwoods Software Corporation. All Rights Reserved.
*/
// This example loads a web page with a GoJS diagram,
// then creates a screenshot of the Diagram with makeImageData, plus a screenshot of the page.
const puppeteer = require('puppeteer');
const fs = require('fs');
const parseDataUrl = (dataUrl) => {
const matches = dataUrl.match(/^data:(.+);base64,(.+)$/);
if (matches.length !== 3) {
throw new Error('Could not parse data URL.');
}
return { mime: matches[1], buffer: Buffer.from(matches[2], 'base64') };
};
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
// This does not have to be a page on the web, it can be a localhost page, or file://
await page.goto('https://gojs.net/samples/orgChartEditor.html', {
waitUntil: 'networkidle2' // ensures images are loaded
});
const imageData = await page.evaluate(() => {
window.myDiagram.animationManager.stopAnimation();
return window.myDiagram.makeImageData();
});
// Output the GoJS makeImageData as a .png:
const { buffer } = parseDataUrl(imageData);
fs.writeFileSync('gojs-screenshot.png', buffer, 'base64');
// Output a page screenshot
await page.screenshot({ path: 'page-screenshot.png' });
await browser.close();
})();