Whiteboard integration on ARM64
Hello,
the README says that the Whiteboard integration only runs on 64-bit Linux systems. I assume that x86-64 is meant because the spacedeck.nexe.bin is a x86-64 executable. Would it be possible to provide an executable for ARM64? Otherwise, it should be clarified in the README that only x86-64 systems are supported.
Thanks!
Maybe this conversation could be relevant here, so linking the issue: https://github.com/nextcloud/integration_whiteboard/issues/33
I managed to get the Nextcloud Spaceboard Integration working manually on arm64.
For the brave:
This assumes you've already downloaded the app through Nextcloud.
Also:
current user: not root (got to use sudo)
web-user = www-data
- install node.js 16 + npm 0.1 (optional: make it work with PHP 8.0)
- fixes to compile Node.js sqlite3 native bindings for
arm64
# adjust path to your nextcloud apps directory
# this will be our working directory for the next commands
cd /var/www/nextcloud/apps/integration_whiteboard/data/spacedeck
1.1 once in that directory, edit package.json with your favorite terminal editor and paste:
expand package.json file
{
"name": "spacedeck-open",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node spacedeck.js",
"pkg": "pkg -t node10-linux -c package.json -o spacedeck.pkg.bin spacedeck.js",
"nexe": "nexe -t linux-x64-10.19.0 spacedeck.js -o spacedeck.nexe.bin"
},
"engines": {
"node": ">=10.0.0"
},
"pkg": {
"assets": [
"views/**/*",
"public/**/*",
"locales/*"
]
},
"dependencies": {
"archiver": "1.3.0",
"async": "2.3.0",
"bcryptjs": "2.4.3",
"body-parser": "^1.19.0",
"cheerio": "0.22.0",
"config": "1.25.1",
"cookie-parser": "~1.4.3",
"ejs": "3.1.5",
"execSync": "latest",
"express": "^4.16.4",
"file-type": "^7.6.0",
"glob": "7.1.1",
"gm": "^1.23.1",
"helmet": "^3.5.0",
"i18n-2": "0.6.3",
"log-timestamp": "latest",
"mock-aws-s3": "^2.6.0",
"moment": "^2.19.3",
"morgan": "^1.9.1",
"node-phantom-simple": "2.2.4",
"node-server-screenshot": "^0.2.1",
"nodemailer": "^4.6.7",
"puppeteer": "3.0.0",
"read-chunk": "^2.1.0",
"request": "^2.88.0",
"sanitize-html": "^1.11.1",
"sequelize": "^4.37.6",
"serve-favicon": "~2.4.2",
"serve-static": "^1.13.1",
"slug": "^1.1.0",
"sqlite3": "^4.0.0",
"umzug": "^2.1.0",
"underscore": "1.8.3",
"uuid": "^3.2.1",
"validator": "7.0.0",
"ws": "3.3.1"
},
"devDependencies": {
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-sass": "^4.0.2"
},
"main": "app.js",
"description": "",
"directories": {},
"repository": {
"type": "git",
"url": "https://github.com/spacedeck/spacedeck-open.git"
},
"keywords": [],
"author": "Lukas F. Hartmann, Martin Güther",
"license": "AGPLv3"
}
1.2
patch ./helpers/phantom.js with this patch (extracted from https://github.com/spacedeck/spacedeck-open/commit/26329b000bd1dac26e05c84a288cdd06c230cb67) :
expand patch file
diff --git a/helpers/phantom.js b/helpers/phantom.js
index 197b9a2..5e5e06a 100644
--- a/helpers/phantom.js
+++ b/helpers/phantom.js
@@ -2,7 +2,7 @@
const db = require('../models/db');
const config = require('config');
-const phantom = require('node-phantom-simple');
+const puppeteer = require('puppeteer');
const os = require('os');
module.exports = {
@@ -25,46 +25,44 @@ module.exports = {
var on_exit = function(exit_code) {
if (exit_code>0) {
- console.error("phantom abnormal exit for url "+space_url);
+ console.error(exit_code);
+ console.error("puppeteer abnormal exit for url "+space_url);
if (!on_success_called && on_error) {
on_error();
}
}
};
- phantom.create({ path: require('phantomjs-prebuilt').path }, function (err, browser) {
- if (err) {
- console.error(err);
- } else {
- return browser.createPage(function (err, page) {
- console.log("page created, opening ",space_url);
-
- if (type=="pdf") {
- var psz = {
- width: space.width+"px",
- height: space.height+"px"
- };
- page.set('paperSize', psz);
+ (async () => {
+ let browser;
+ let page;
+ try {
+ browser = await puppeteer.launch(
+ {
+ headless: true,
+ args: ['--disable-dev-shm-usage', '--no-sandbox']
}
+ );
+ page = await browser.newPage();
- page.set('settings.resourceTimeout',timeout);
- page.set('settings.javascriptEnabled',false);
+ page.setDefaultTimeout(timeout);
+ await page.setJavaScriptEnabled(false);
- return page.open(space_url, function (err,status) {
- page.render(export_path, function() {
- on_success_called = true;
- if (on_success) {
- on_success(export_path);
- }
- page.close();
- browser.exit();
- });
- });
- });
- }
+ console.log("page created, opening ",space_url);
+ await page.goto(space_url, {waitUntil: 'networkidle0'});
- }, {
- onExit: on_exit
- });
+ if (type=="pdf") {
+ await page.pdf({path: export_path, width: space.width+'px', height: space.height+'px' });
+ }else{
+ await page.screenshot({path: export_path});
+ }
+
+ await browser.close();
+ on_success(export_path);
+ } catch (error) {
+ on_error();
+ }
+
+ })();
}
};
save this as phantomjs.patch, then:
sudo patch ./helpers/phantom.js phantomjs.patch
sudo rm -r node_modules/sqlite3
sudo npm install --build-from-source=sqlite3 --production
- use vercel's
pkg, notnexeto put it all into one single binary
sudo npm install --global pkg
sudo pkg -c package.json -t linux-node16-arm64 spacedeck.js
sudo chown -R www-data:www-data .
sudo mv spacedeck.nexe.bin spacedeck.nexe.bin.x86_64
sudo mv spacedeck-open spacedeck.nexe.bin
# (re-) enable whiteboard_integration app in nextcloud
# this copies the current folder to `$NC_DATA_DIR/appdata_random-string/spacedeck/`
- be happy and use Spacedeck whiteboards

@teutat3s,
I try the version without the npm and node update. As far as I see, your patch has an error at line 14. my patch looks like this:
Thanks for the effort. I tried the workaround but I get the following error:
patching file ./helpers/phantom.js Hunk #2 FAILED at 25. 1 out of 2 hunks FAILED -- saving rejects to file ./helpers/phantom.js.rej
phantom.js.rej is --- phantom.js +++ phantom.js @@ -25,46 +25,44 @@ module.exports = {
var on_exit = function(exit_code) { if (exit_code>0) {
console.error("phantom abnormal exit for url "+space_url);
console.error(exit_code); };console.error("puppeteer abnormal exit for url "+space_url); if (!on_success_called && on_error) { on_error(); } }
- phantom.create({ path: require('phantomjs-prebuilt').path }, function (err, browser) {
if (err) {console.error(err);} else {return browser.createPage(function (err, page) {console.log("page created, opening ",space_url);if (type=="pdf") {var psz = {width: space.width+"px",height: space.height+"px"};page.set('paperSize', psz);
- (async () => {
let browser;let page;try {browser = await puppeteer.launch({headless: true,args: ['--disable-dev-shm-usage', '--no-sandbox'] });page = await browser.newPage();
page.set('settings.resourceTimeout',timeout);page.set('settings.javascriptEnabled',false);
page.setDefaultTimeout(timeout);await page.setJavaScriptEnabled(false);