Add custom QZ Tray fork with pairing key authentication
- Custom fork of QZ Tray 2.2.x with certificate validation bypassed - Implemented pairing key (HMAC) authentication as replacement - Modified files: PrintSocketClient.java (certificate check disabled) - New files: PairingAuth.java, PairingConfigDialog.java - Excluded build artifacts (out/, lib/javafx*) from repository - Library JARs included for dependency management
This commit is contained in:
19
tray/test/qz/ws/substitutions/SubstitutionsTests.java
Normal file
19
tray/test/qz/ws/substitutions/SubstitutionsTests.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package qz.ws.substitutions;
|
||||
|
||||
import org.codehaus.jettison.json.JSONException;
|
||||
import org.codehaus.jettison.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SubstitutionsTests {
|
||||
public static void main(String ... args) throws JSONException, IOException {
|
||||
Substitutions substitutions = new Substitutions(
|
||||
SubstitutionsTests.class.getResourceAsStream("resources/substitutions.json")
|
||||
);
|
||||
JSONObject base = substitutions.replace(
|
||||
SubstitutionsTests.class.getResourceAsStream("resources/printRequest.json")
|
||||
);
|
||||
|
||||
System.out.println(base);
|
||||
}
|
||||
}
|
||||
67
tray/test/qz/ws/substitutions/resources/printRequest.json
Normal file
67
tray/test/qz/ws/substitutions/resources/printRequest.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"call": "print",
|
||||
"params": {
|
||||
"printer": {
|
||||
"name": "PDFwriter"
|
||||
},
|
||||
"options": {
|
||||
"bounds": null,
|
||||
"colorType": "color",
|
||||
"copies": 1,
|
||||
"density": 0,
|
||||
"duplex": false,
|
||||
"fallbackDensity": null,
|
||||
"interpolation": "bicubic",
|
||||
"jobName": null,
|
||||
"legacy": false,
|
||||
"margins": 0,
|
||||
"orientation": null,
|
||||
"paperThickness": null,
|
||||
"printerTray": null,
|
||||
"rasterize": false,
|
||||
"rotation": 0,
|
||||
"scaleContent": true,
|
||||
"size": {
|
||||
"width": "4",
|
||||
"height": "6"
|
||||
},
|
||||
"units": "in",
|
||||
"forceRaw": false,
|
||||
"encoding": null,
|
||||
"spool": {}
|
||||
},
|
||||
"data": [
|
||||
{
|
||||
"type": "pixel",
|
||||
"format": "pdf",
|
||||
"flavor": "file",
|
||||
"data": "https://demo.qz.io/assets/pdf_sample.pdf",
|
||||
"options": {
|
||||
"pageWidth": "8.5",
|
||||
"pageHeight": "11",
|
||||
"pageRanges": "",
|
||||
"ignoreTransparency": false,
|
||||
"altFontRendering": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "pixel",
|
||||
"format": "image",
|
||||
"flavor": "file",
|
||||
"data": "https://demo.qz.io/assets/img/image_sample.png",
|
||||
},
|
||||
"^XA\n",
|
||||
"^FO50,50^ADN,36,20^FDPRINTED WITH QZ 2.2.4-SNAPSHOT\n",
|
||||
"^FS\n",
|
||||
"^XZ\n"
|
||||
]
|
||||
},
|
||||
"signature": "",
|
||||
"timestamp": 1713895560783,
|
||||
"uid": "64t63d",
|
||||
"position": {
|
||||
"x": 720,
|
||||
"y": 462.5
|
||||
},
|
||||
"signAlgorithm": "SHA512"
|
||||
}
|
||||
109
tray/test/qz/ws/substitutions/resources/substitutions.json
Normal file
109
tray/test/qz/ws/substitutions/resources/substitutions.json
Normal file
@@ -0,0 +1,109 @@
|
||||
[
|
||||
{
|
||||
"use":{
|
||||
"config": {
|
||||
"size": {
|
||||
"width": 100,
|
||||
"height": 150
|
||||
},
|
||||
"units": "mm"
|
||||
}
|
||||
},
|
||||
"for": {
|
||||
"config": {
|
||||
"size": {
|
||||
"width": 4,
|
||||
"height": 6
|
||||
},
|
||||
"units": "in"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"printer": "PDF"
|
||||
},
|
||||
"for": {
|
||||
"printer": "PDFwriter"
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"data": {
|
||||
"options": {
|
||||
"pageWidth": 8.5,
|
||||
"pageHeight": 14
|
||||
}
|
||||
}
|
||||
},
|
||||
"for": {
|
||||
"data": {
|
||||
"options": {
|
||||
"pageWidth": "8.5",
|
||||
"pageHeight": "11"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"query": "pdf"
|
||||
},
|
||||
"for": {
|
||||
"query": "zzz"
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"config": {
|
||||
"copies": 3
|
||||
}
|
||||
},
|
||||
"for": {
|
||||
"config": {
|
||||
"copies": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"printer": "PDFwriter"
|
||||
},
|
||||
"for": {
|
||||
"caseSensitive": true,
|
||||
"printer": "xps document writer"
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"data": {
|
||||
"data": "https://yahoo.com"
|
||||
}
|
||||
},
|
||||
"for": {
|
||||
"data": {
|
||||
"data": "https://demo.qz.io/assets/pdf_sample.pdf"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"printer": "ZDesigner"
|
||||
},
|
||||
"for": {
|
||||
"data": [ "^XA\n" ]
|
||||
}
|
||||
},
|
||||
{
|
||||
"use": {
|
||||
"data": {
|
||||
"type": "PIXEL"
|
||||
}
|
||||
},
|
||||
"for": {
|
||||
"data": {
|
||||
"type": "pixel"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user