Skip to content

Instantly share code, notes, and snippets.

DROP TABLE badfile;
CREATE TABLE badfile (uri varchar(255) NOT NULL, lastModified bigint, reason varchar(255), PRIMARY KEY (uri)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE document;
CREATE TABLE document (id bigint NOT NULL AUTO_INCREMENT, cacheId varchar(255), uri varchar(255) NOT NULL, siteId varchar(255), fileName varchar(255), pages int, size int, lastModified bigint NOT NULL, posExtracted bigint NOT NULL, lastUsed bigint NOT NULL, PRIMARY KEY (id), INDEX document_cacheId_idx (cacheId), INDEX document_siteId_idx (siteId), INDEX document_uri_idx (uri)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE results;
CREATE TABLE results (id varchar(255) NOT NULL, data blob, resultFile blob, created datetime, expires datetime, PRIMARY KEY (id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DROP TABLE textpos;
CREATE TABLE textpos (id varchar(255) NOT NULL, docId bigint, segment int, data mediumblob, PRIMARY KEY (id), INDEX textpos_docId_idx (docId), INDEX textpos_segment_idx (segment)) ENGINE=InnoDB DEFAULT CHARSET
@jobjects
jobjects / highlighter-snoop-script.groovy
Created July 21, 2018 14:43
Intercept highlighting request and update parameters
/*
To use, add to Highlighter's application.conf:
highlighter.service.scripting {
files = ["/path/to/highlighter-snoop-script.groovy"]
filterRequestParamsFn = "myRequestParamsFilter"
uriFilterFn = "myUriFilterFn"
}
@jobjects
jobjects / 00 PDF Highlighter script to read documents from AWS S3.md
Last active July 21, 2018 14:02
PDF Highlighter script to read documents from AWS S3

Config and script for PDF Highlighter to get PDF documents from AWS S3.

We attach the script to Highlighter's "getDocumentProviderFn" hook and, when there's parameter 's3File' (our custom param name, can be anything) in highlighting request, we return implementation of Highlighter's IDependency interface.

@jobjects
jobjects / 00 Getting document path from database and obfuscating access URL.md
Last active July 21, 2018 14:03
Example script for PDF Highlighter that gets document path from database and obfuscates document access URL

Getting document path from database and obfuscating access URL

Requirements for this exercise are:

  • Access PDF documents using GUID identifiers.
  • GUIDs are stored in MuSQL database and point to PDF files on accessible via server file system.
  • Users should not be able to get direct URL to PDF file.

The approach used to address the requirements: