@alizadefaig/pos-server 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -14
- package/routes/desktop/api/printers.js +8 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alizadefaig/pos-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Server in express js with Proxy to Main server if need and will work with Electron JS",
|
|
5
5
|
"homepage": "https://gitlab.com/faigalizade/pos-server#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "git+ssh://git@gitlab.com/faigalizade/pos-server.git"
|
|
12
12
|
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"axios": "^1.8.4",
|
|
15
|
+
"cors": "^2.8.5",
|
|
16
|
+
"express": "^5.1.0",
|
|
17
|
+
"form-data": "^4.0.2",
|
|
18
|
+
"multer": "^1.4.5-lts.2",
|
|
19
|
+
"sequelize": "^6.37.7",
|
|
20
|
+
"socket.io": "^4.8.1",
|
|
21
|
+
"socket.io-client": "^4.8.1"
|
|
22
|
+
},
|
|
13
23
|
"license": "ISC",
|
|
14
24
|
"author": "faigalizade@newave.az",
|
|
15
25
|
"type": "commonjs",
|
|
@@ -20,18 +30,5 @@
|
|
|
20
30
|
"scripts": {
|
|
21
31
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
22
32
|
"start": "node server.js"
|
|
23
|
-
},
|
|
24
|
-
"dependencies": {
|
|
25
|
-
"axios": "^1.8.4",
|
|
26
|
-
"cors": "^2.8.5",
|
|
27
|
-
"express": "^5.1.0",
|
|
28
|
-
"form-data": "^4.0.2",
|
|
29
|
-
"multer": "^1.4.5-lts.2",
|
|
30
|
-
"sequelize": "^6.37.7",
|
|
31
|
-
"socket.io": "^4.8.1",
|
|
32
|
-
"socket.io-client": "^4.8.1",
|
|
33
|
-
"cafetap-escpos-usb": "gitlab:faigalizade/escpos-usb",
|
|
34
|
-
"escpos": "^3.0.0-alpha.6",
|
|
35
|
-
"escpos-network": "^3.0.0-alpha.5"
|
|
36
33
|
}
|
|
37
34
|
}
|
|
@@ -24,12 +24,6 @@ const getUsbPrinters = async () => {
|
|
|
24
24
|
});
|
|
25
25
|
usbDevice.close();
|
|
26
26
|
}
|
|
27
|
-
result.push({
|
|
28
|
-
type: 'USB',
|
|
29
|
-
name: 'Text',
|
|
30
|
-
vendor_id: 123,
|
|
31
|
-
product_id: 345
|
|
32
|
-
});
|
|
33
27
|
|
|
34
28
|
return result;
|
|
35
29
|
}
|
|
@@ -99,14 +93,16 @@ const getNetworkDevices = async () => {
|
|
|
99
93
|
router.get('/printers.get', async (req, res) => {
|
|
100
94
|
let usbPrinters = await getUsbPrinters();
|
|
101
95
|
let networkPrinters = await getNetworkDevices();
|
|
102
|
-
|
|
96
|
+
const printers = [...usbPrinters, ...networkPrinters]
|
|
97
|
+
axios.post(PROXY_TARGET + '/api/printers.get', {
|
|
98
|
+
printers
|
|
99
|
+
},{
|
|
103
100
|
headers: {...req.headers, host: new URL(PROXY_TARGET).host},
|
|
104
|
-
}).then(data => {
|
|
105
|
-
|
|
101
|
+
}).then(({data}) => {
|
|
102
|
+
res.json(data);
|
|
103
|
+
}).catch(e => {
|
|
104
|
+
res.json([...usbPrinters, ...networkPrinters])
|
|
106
105
|
})
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
res.json([...usbPrinters, ...networkPrinters]);
|
|
110
106
|
});
|
|
111
107
|
|
|
112
108
|
router.post('/printers.print', (req, res) => {
|