Skip to content

Commit

Permalink
Merge pull request #95 from sbs20/staging
Browse files Browse the repository at this point in the history
Fix Pixma defect
  • Loading branch information
sbs20 authored Nov 3, 2020
2 parents 6378858 + 6954752 commit 1c33eb6
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ name: "CodeQL"
on:
push:
branches: [master, staging]
pull_request:
# The branches below must be a subset of the branches above
branches: [master, staging]
# pull_request:
# # The branches below must be a subset of the branches above
# branches: [master, staging]
workflow_dispatch:
#schedule:
# - cron: '0 7 * * 2'
Expand Down
0 install.sh → bin/install.sh
100755 → 100644
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ gulp.task('server-lint', () => {
gulp.task('server-build', () => {
const shellFilter = filter('**/*.sh', {restore: true});
return gulp.src([
'./install.sh',
'./uninstall.sh',
'./bin/install.sh',
'./bin/uninstall.sh',
'./bin/scanservjs.service',
'./package.json',
'./package-lock.json',
'./scanservjs.service',
'./*config/**/*.js',
'./*server/**/*',
'./*data/**/*.md',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scanservjs",
"version": "2.1.0",
"version": "2.1.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. scanserv does not do image conversion or manipulation (beyond the bare minimum necessary for the purposes of browser preview) or OCR.",
"scripts": {
"serve": "nodemon --exec 'vue-cli-service serve'",
Expand Down
2 changes: 2 additions & 0 deletions server/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Feature {
static splitNumbers(string, delimiter) {
return string.replace(/[a-z%]/ig, '')
.split(delimiter)
.filter(s => s.length > 0)
.map(s => Number(s));
}

Expand Down Expand Up @@ -47,6 +48,7 @@ class Adapter {
static decorate(device) {
for (const key in device.features) {
const feature = device.features[key];
feature.parameters = feature.parameters.replace(/^auto\|/, '');
switch (key) {
case '--mode':
case '--source':
Expand Down
23 changes: 23 additions & 0 deletions test/device.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,27 @@ describe('Device', () => {
assert.strictEqual(device.features['--brightness'], undefined);
assert.strictEqual(device.features['--contrast'], undefined);
});

it('scanimage-a5.txt', () =>{
const file = new FileInfo('test/resource/scanimage-a5.txt');
const device = Device.from(file.toText());

assert.strictEqual(device.id, 'pixma:04A91766_004AE4');
assert.deepStrictEqual(device.features['--mode'].options, ['Color', 'Gray', 'Lineart']);
assert.strictEqual(device.features['--mode'].default, 'Color');
assert.deepStrictEqual(device.features['--source'].options, ['Flatbed', 'Automatic Document Feeder']);
assert.strictEqual(device.features['--source'].default, 'Flatbed');
assert.deepStrictEqual(device.features['--resolution'].options, [75, 150, 300, 600, 1200]);
assert.strictEqual(device.features['--resolution'].default, 75);
assert.strictEqual(device.features['-l'].limits[0], 0);
assert.strictEqual(device.features['-l'].limits[1], 216);
assert.strictEqual(device.features['-t'].limits[0], 0);
assert.strictEqual(device.features['-t'].limits[1], 355);
assert.strictEqual(device.features['-x'].limits[0], 0);
assert.strictEqual(device.features['-x'].limits[1], 216);
assert.strictEqual(device.features['-y'].limits[0], 0);
assert.strictEqual(device.features['-y'].limits[1], 355);
assert.strictEqual(device.features['--brightness'], undefined);
assert.strictEqual(device.features['--contrast'], undefined);
});
});
53 changes: 53 additions & 0 deletions test/resource/scanimage-a5.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

All options specific to device `pixma:04A91766_004AE4':
Scan mode:
--resolution auto||75|150|300|600|1200dpi [75]
Sets the resolution of the scanned image.
--mode auto|Color|Gray|Lineart [Color]
Selects the scan mode (e.g., lineart, monochrome, or color).
--source Flatbed|Automatic Document Feeder [Flatbed]
Selects the scan source (such as a document-feeder). Set source before
mode and resolution. Resets mode and resolution to auto values.
--button-controlled[=(yes|no)] [no]
When enabled, scan process will not start immediately. To proceed,
press "SCAN" button (for MP150) or "COLOR" button (for other models).
To cancel, press "GRAY" button.
Gamma:
--custom-gamma[=(auto|yes|no)] [yes]
Determines whether a builtin or a custom gamma-table should be used.
--gamma-table auto|0..255,...
Gamma-correction table. In color mode this option equally affects the
red, green, and blue channels simultaneously (i.e., it is an intensity
gamma table).
--gamma auto|0.299988..5 [2.2]
Changes intensity of midtones
Geometry:
-l auto|0..216.069mm [0]
Top-left x position of scan area.
-t auto|0..355.6mm [0]
Top-left y position of scan area.
-x auto|0..216.069mm [216.069]
Width of scan-area.
-y auto|0..355.6mm [355.6]
Height of scan-area.
Buttons:
--button-update
Update button state
--button-1 <int> [0] [read-only]
Button 1
--button-2 <int> [0] [read-only]
Button 2
--original <int> [0] [read-only]
Type of original to scan
--target <int> [0] [read-only]
Target operation type
--scan-resolution <int> [0] [read-only]
Scan resolution
Extras:
--threshold auto|0..100% (in steps of 1) [inactive]
Select minimum-brightness to get a white point
--threshold-curve auto|0..127 (in steps of 1) [inactive]
Dynamic threshold curve, from light to dark, normally 50-65
--adf-wait auto|0..3600 (in steps of 1) [inactive]
When set, the scanner searches the waiting time in seconds for a new
document inserted into the automatic document feeder.

0 comments on commit 1c33eb6

Please sign in to comment.