diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2199b52b..087c76cc 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,6 +3,9 @@ name: docker-build on: workflow_dispatch: push: + paths-ignore: + - 'docs/**' + - 'README.md' branches: - 'master' - 'staging' diff --git a/docs/config.md b/docs/config.md index b4cdd8e6..26e6b4fd 100644 --- a/docs/config.md +++ b/docs/config.md @@ -219,7 +219,6 @@ Exercise caution with this recipe - the app is designed not to allow unsafe paths by default. If you are happy to disable this check, then go ahead. ```javascript -const dayjs = require('dayjs'); module.exports = { afterConfig(config) { // Set your path here @@ -230,3 +229,17 @@ module.exports = { } } ``` + +### Only show ISO paper sizes + +You can use a filter to include only the paper sizes you want. To only show ISO +sizes do something like the following. You can obviously extend or reverse the +filter as required. + +```javascript +module.exports = { + afterConfig(config) { + config.paperSizes = config.paperSizes.filter(p => /[AB]\d/.test(p.name)); + } +} +``` \ No newline at end of file diff --git a/docs/development.md b/docs/development.md index 6dbcb631..b9622882 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,33 +1,60 @@ # Development -## Steps +## Install and setup -* Install Node -* Clone the repo -* Navigate to the repo directory - ``` - sudo npm install -g @vue/cli @vue/cli-service-global gulp-cli - npm run install - ``` +```shell +# Install dependencies +sudo apt-get install curl nodejs npm imagemagick sane-utils tesseract-ocr -## Run for development +# Ideally set the npm version +sudo npm install npm@7.11.2 -g -``` +# Enable PDF (required for execution and unit tests) +sudo sed -i 's/policy domain="coder" rights="none" pattern="PDF"/policy domain="coder" rights="read | write" pattern="PDF"'/ /etc/ImageMagick-6/policy.xml + +# Clone the repo +git clone https://github.com/sbs20/scanservjs.git + +# Install all packages +cd scanservjs && npm run install + +# Run (from the scanservjs directory) npm run serve ``` -This will hook the server component into webpack (see vue.config.js) and -references below. +`npm run serve` will hook the development server into webpack (see +vue.config.js). + +If you run into the following error, then you may need to increase your inotify +limit: + +``` +[nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch '/.../scanservjs/packages/server/src' +``` + +To incease it temporarily: + +``` +sudo sysctl fs.inotify.max_user_watches=131072 +``` + +To update it permanently will depend on your distribution - but this will work +with Debian: + +``` +echo fs.inotify.max_user_watches=131072 | sudo tee -a /etc/sysctl.d/50-default.conf; sudo sysctl -p +``` ## Build Before committing please verify and build + ``` -npm run verify -npm run build +npm run verify && npm run build ``` -Create a local release package +Alternatively, create a local release package + ``` npm run release ``` diff --git a/docs/install.md b/docs/install.md index dc3f766a..6da197cd 100644 --- a/docs/install.md +++ b/docs/install.md @@ -50,6 +50,12 @@ debug where the problem is: [here](./sane.md)) to allow certain groups access to the hardware - but it's also worth verifying that the `scanservjs` user is a member of the `scanner` group (or the group specified in your udev rule): `groups scanservjs`. +* If everything so far has worked, then also try running a scan as the + scanservjs user with + `sudo su - scanservjs -c 'scanimage --format tiff > test.tif'` - this should + output a tif file in the scanservjs home directory (probably + `/home/scanservjs/`). If you can get this to work then scanservjs should be + working fine. * Getting logs: use `journalctl`. See the journalctl manpage for details but `sudo journalctl -e -u scanservjs` should be enough to get you started. diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index a2e91037..52b1cab0 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -1,5 +1,19 @@ # Troubleshooting +## scanimage: sane_read: Invalid argument + +This is a problem with SANE rather than scanservjs. It usually signifies a +[problem with the driver](https://askubuntu.com/a/447283). Your best bet is +going back to first principles with SANE itself. Follow the steps +[here](./install.md#troubleshooting) + +## Cropping results in incorrect positioning + +Some scanners mis-report their size - don't know why, but they do. This means +that when the app attempts to crop things the maths is all wrong. The best way +around this is to override the reported scanner dimensions. See +[this recipe](./config.md#override-scanner-dimensions) for more. + ## JSON.parse error This happens when the browser received a string from the server which is not a diff --git a/package-lock.json b/package-lock.json index d8f15d7b..be7ed200 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "scanservjs", - "version": "2.17.0", + "version": "2.17.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scanservjs", - "version": "2.17.0", + "version": "2.17.1", "hasInstallScript": true, "license": "GPL-2.0" } diff --git a/package.json b/package.json index ab2e550d..8bc045e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs", - "version": "2.17.0", + "version": "2.17.1", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation.", "scripts": { "clean": "rm -rf ./dist", diff --git a/packages/client/package-lock.json b/packages/client/package-lock.json index 425aab2b..d889a6db 100644 --- a/packages/client/package-lock.json +++ b/packages/client/package-lock.json @@ -1,12 +1,12 @@ { "name": "scanservjs", - "version": "2.17.0", + "version": "2.17.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "scanservjs", - "version": "2.17.0", + "version": "2.17.1", "license": "GPL-2.0", "dependencies": { "@mdi/font": "^5.9.55", diff --git a/packages/client/package.json b/packages/client/package.json index 2f9fa654..6ec9a97d 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "scanservjs", - "version": "2.17.0", + "version": "2.17.1", "description": "scanservjs is a simple web-based UI for SANE which allows you to share a scanner on a network without the need for drivers or complicated installation.", "author": "Sam Strachan", "scripts": { diff --git a/packages/client/src/components/BatchDialog.vue b/packages/client/src/components/BatchDialog.vue index deeb2941..8001e637 100644 --- a/packages/client/src/components/BatchDialog.vue +++ b/packages/client/src/components/BatchDialog.vue @@ -1,15 +1,16 @@ @@ -117,7 +124,7 @@ export default { Common.fetch(`files/${file.name}`, { method: 'DELETE' }).then(data => { - this.$emit('notify', {type: 'i', message: `${this.$t('files.message:deleted')} ${data.name}`}); + this.$emit('notify', {type: 'i', message: `${this.$t('files.message:deleted', [data.name])}`}); this.fileList(); this.$emit('mask', -1); }).catch(error => { @@ -169,7 +176,7 @@ export default { const name = this.selectedFiles[0].name; try { await Common.fetch(`files/${name}`, {method: 'DELETE'}); - this.$emit('notify', {type: 'i', message: `${this.$t('files.message:deleted')} ${name}`}); + this.$emit('notify', {type: 'i', message: `${this.$t('files.message:deleted', [name])}`}); } catch (error) { this.$emit('notify', {type: 'e', message: error}); } diff --git a/packages/client/src/components/Scan.vue b/packages/client/src/components/Scan.vue index 03092791..987878b2 100644 --- a/packages/client/src/components/Scan.vue +++ b/packages/client/src/components/Scan.vue @@ -9,7 +9,7 @@ v-if="context.devices.length > 0" :label="$t('scan.device')" v-model="device" :items="context.devices" return-object item-text="name" @change="clear"> - mdi-refresh + mdi-refresh
+ {{ $t('scan.btn-scan') }} mdi-camera {{ $t('scan.btn-preview') }} mdi-magnify {{ $t('scan.btn-clear') }} mdi-delete - {{ $t('scan.btn-scan') }} mdi-camera
@@ -64,10 +64,10 @@ - - - - + + + +