Add KOReader option
All checks were successful
Build and test project / build-and-test (push) Successful in 1m32s
All checks were successful
Build and test project / build-and-test (push) Successful in 1m32s
This commit is contained in:
34
tests/e2e/helpers/assets.js
Normal file
34
tests/e2e/helpers/assets.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { WEBROOT, WEBROOT_FIRMWARE, FIRMWARE_PATH } = require('./paths');
|
||||
|
||||
function hasNickelMenuAssets() {
|
||||
return fs.existsSync(path.join(WEBROOT, 'nickelmenu', 'NickelMenu.zip'))
|
||||
&& fs.existsSync(path.join(WEBROOT, 'nickelmenu', 'kobo-config.zip'));
|
||||
}
|
||||
|
||||
function hasKoreaderAssets() {
|
||||
return fs.existsSync(path.join(WEBROOT, 'koreader', 'koreader-kobo.zip'))
|
||||
&& fs.existsSync(path.join(WEBROOT, 'koreader', 'release.json'));
|
||||
}
|
||||
|
||||
function hasFirmwareZip() {
|
||||
return fs.existsSync(FIRMWARE_PATH);
|
||||
}
|
||||
|
||||
function setupFirmwareSymlink() {
|
||||
try { fs.unlinkSync(WEBROOT_FIRMWARE); } catch {}
|
||||
fs.symlinkSync(path.resolve(FIRMWARE_PATH), WEBROOT_FIRMWARE);
|
||||
}
|
||||
|
||||
function cleanupFirmwareSymlink() {
|
||||
try { fs.unlinkSync(WEBROOT_FIRMWARE); } catch {}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
hasNickelMenuAssets,
|
||||
hasKoreaderAssets,
|
||||
hasFirmwareZip,
|
||||
setupFirmwareSymlink,
|
||||
cleanupFirmwareSymlink,
|
||||
};
|
||||
Reference in New Issue
Block a user