Skip to content

Commit

Permalink
Merge pull request #3 from unidoc-build/prep-rc-v0.3.0
Browse files Browse the repository at this point in the history
Prepare release of UniHTML v0.3.0
  • Loading branch information
gunnsth authored Mar 24, 2021
2 parents eafca2e + de38674 commit ca9bdb6
Show file tree
Hide file tree
Showing 10 changed files with 382 additions and 362 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,30 @@ This plugin works in a pair with the UniHTML server. It is distributed using Doc

1. Get UniHTML-Server Docker image:
`docker pull unidoccloud/unihtml:latest`
2. Start UniHTML server with some output port defined: `docker run -p 8080:8080 -e UNIHTML_LICENSE=path/to/license unidoccloud/unihtml`
2. Start UniHTML server with some output port defined:
```shell
docker run -p 8080:8080 -e UNIHTML_LICENSE_PATH=path/to/license -e UNIHTML_CUSTOMER_NAME=customer_name unidoccloud/unihtml
```
3. Define environment variable: `UNIPDF_LICENSE_PATH` with the path to the UniDoc license.
4. Define environment variable: `UNIPDF_CUSTOMER_NAME` with your customer name matching your license.
5. Get latest version of the `github.com/unidoc/unipdf/v3` module: `go get github.com/unidoc/unipdf/v3`
5. Get the latest version of the `github.com/unidoc/unipdf/v3` module: `go get github.com/unidoc/unipdf/v3`

## UniHTML Server Licenses

UniHTML Server accepts both the offline and metered UniDoc licenses. A license with a UniHTML module is required to run both the server and client.

### UniHTML Offline License

A regular license could be set on the server by setting one of two possible environment variables:
- `UNIHTML_LICENSE_PATH` - the value should be the path to the UniDoc license file with the UniHTML module.
- `UNIHTML_LICENSE` - full content of valid UniDoc license with the UniHTML module.

This license kind requires also an environment variable `UNIHTML_CUSTOMER_NAME` which defines the customer name provided with the UniDoc license.

### UniDoc Metered License

UniHTML Server accepts also a UniDoc metered license. This could be set by providing you **API Key** in the environment variable:
- `UNIDOC_METERED_API_KEY` - the value of this variable should be an **API Key** matched to your license.

## Usage

Expand Down
65 changes: 32 additions & 33 deletions cli/cmd/cmd.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package main ;import _g "github.com/unidoc/unihtml/cli/cmd";func main (){_g .Execute ()};
package main ;import _cc "github.com/unidoc/unihtml/cli/cmd";func main (){_cc .Execute ()};
223 changes: 112 additions & 111 deletions client/client.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
// terms that can be accessed at https://unidoc.io/eula/

// Package common contains common properties used by the subpackages.
package common ;import _a "time";const _c ="\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034";const _bd =22;const Version ="\u0030\u002e\u0032.\u0030";const _ce =12;const _bdc =20;
var ReleasedAt =_a .Date (_b ,_cd ,_bd ,_ce ,_bdc ,0,0,_a .UTC );
package common ;import _e "time";const _f ="\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034";var ReleasedAt =_e .Date (_ac ,_b ,_bg ,_ba ,_ad ,0,0,_e .UTC );const _ba =12;


// UtcTimeFormat returns a formatted string describing a UTC timestamp.
func UtcTimeFormat (t _a .Time )string {return t .Format (_c )+"\u0020\u0055\u0054\u0043"};const _b =2021;const _cd =2;
func UtcTimeFormat (t _e .Time )string {return t .Format (_f )+"\u0020\u0055\u0054\u0043"};const _ac =2021;const Version ="\u0030\u002e\u0033.\u0030";const _bg =23;const _ad =20;const _b =3;
48 changes: 24 additions & 24 deletions content/content.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,41 @@
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/

package content ;import (_e "archive/zip";_ba "bytes";_de "encoding/json";_db "golang.org/x/xerrors";_a "io/ioutil";_b "net/url";_eb "os";_eg "strings";);type zipDirectory struct{_bdd _ba .Buffer ;_dc *_e .Writer ;};
package content ;import (_f "archive/zip";_ca "bytes";_fc "encoding/json";_a "golang.org/x/xerrors";_g "io/ioutil";_bd "net/url";_d "os";_b "strings";);

// NewHTMLFile creates new Content htmFile for provided input path.
func NewHTMLFile (path string )(Content ,error ){_f ,_bf :=_eb .Open (path );if _bf !=nil {return nil ,_bf ;};_bc :=&htmFile {_g :_ba .Buffer {}};if _ ,_bf =_bc ._g .ReadFrom (_f );_bf !=nil {return nil ,_bf ;};return _bc ,nil ;};

// Data implements Content interface.
func (_ga *webURL )Data ()[]byte {return _ga ._bd };type htmFile struct{_g _ba .Buffer };

// ContentType implements Content interface.
func (_ae *htmFile )ContentType ()string {return "\u0074e\u0078\u0074\u002f\u0068\u0074\u006dl"};
func NewHTMLFile (path string )(Content ,error ){_cad ,_ag :=_d .Open (path );if _ag !=nil {return nil ,_ag ;};_df :=&htmFile {_cf :_ca .Buffer {}};if _ ,_ag =_df ._cf .ReadFrom (_cad );_ag !=nil {return nil ,_ag ;};return _df ,nil ;};

// ContentType implements Content interface.
func (_bab *zipDirectory )ContentType ()string {return "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u007a\u0069\u0070";};type webURL struct{_bg string ;_bd []byte ;};
func (_ce *webURL )ContentType ()string {return "\u0061\u0070p\u006c\u0069\u0063a\u0074\u0069\u006f\u006e\u002f\u006a\u0073\u006f\u006e";};

// NewWebURL creates new Content webURL for provided input URL path.
func NewWebURL (path string )(Content ,error ){if _ ,_dec :=_b .Parse (path );_dec !=nil {return nil ,_dec ;};type urlOutput struct{URL string `json:"url"`;};_ac :=urlOutput {URL :path };_bad ,_ab :=_de .Marshal (_ac );if _ab !=nil {return nil ,_ab ;};
return &webURL {_bg :path ,_bd :_bad },nil ;};
func NewWebURL (path string )(Content ,error ){if _ ,_aa :=_bd .Parse (path );_aa !=nil {return nil ,_aa ;};type urlOutput struct{URL string `json:"url"`;};_cb :=urlOutput {URL :path };_e ,_ae :=_fc .Marshal (_cb );if _ae !=nil {return nil ,_ae ;};return &webURL {_bb :path ,_fg :_e },nil ;
};type webURL struct{_bb string ;_fg []byte ;};

// Data implements Content interface.
func (_ef *zipDirectory )Data ()[]byte {return _ef ._bdd .Bytes ()};func (_eaf *zipDirectory )zipBasePaths (_gb _eb .FileInfo ,_bdg ,_dae string ,_ad bool ,_dcd *_eg .Builder )(string ,string ){_dcd .WriteString (_bdg );if !_eg .HasSuffix (_bdg ,"\u002f"){_dcd .WriteRune ('/');
};_dcd .WriteString (_gb .Name ());if _ad {_dcd .WriteRune ('/');};_gacc :=_dcd .String ();_dcd .Reset ();_dcd .WriteString (_dae );_dcd .WriteString (_gb .Name ());if _ad {_dcd .WriteRune ('/');};_fe :=_dcd .String ();_dcd .Reset ();return _gacc ,_fe ;
};
func (_ggd *webURL )Data ()[]byte {return _ggd ._fg };

// ContentType implements Content interface.
func (_ab *zipDirectory )ContentType ()string {return "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u007a\u0069\u0070";};

// Data implements Content interface.
func (_da *htmFile )Data ()[]byte {return _da ._g .Bytes ()};
func (_gf *htmFile )Data ()[]byte {return _gf ._cf .Bytes ()};type htmFile struct{_cf _ca .Buffer };

// Content is an interface used for putting the content into Client Query.
type Content interface{ContentType ()string ;Data ()[]byte ;};
// NewZipDirectory creates new zip compressed file that recursively reads the directory at the 'dirPath'
// and stores in it's in-memory buffer.
func NewZipDirectory (dirPath string )(Content ,error ){_bc :=&zipDirectory {_bf :_ca .Buffer {}};_bc ._cba =_f .NewWriter (&_bc ._bf );if _gff :=_bc .zipPath (dirPath ,"");_gff !=nil {return nil ,_gff ;};if _ad :=_bc ._cba .Close ();_ad !=nil {return nil ,_ad ;
};return _bc ,nil ;};

// ContentType implements Content interface.
func (_fdb *webURL )ContentType ()string {return "\u0061\u0070p\u006c\u0069\u0063a\u0074\u0069\u006f\u006e\u002f\u006a\u0073\u006f\u006e";};
func (_gg *htmFile )ContentType ()string {return "\u0074e\u0078\u0074\u002f\u0068\u0074\u006dl"};

// NewZipDirectory creates new zip compressed file that recursively reads the directory at the 'dirPath'
// and stores in it's in-memory buffer.
func NewZipDirectory (dirPath string )(Content ,error ){_ea :=&zipDirectory {_bdd :_ba .Buffer {}};_ea ._dc =_e .NewWriter (&_ea ._bdd );if _fb :=_ea .zipPath (dirPath ,"");_fb !=nil {return nil ,_fb ;};if _aa :=_ea ._dc .Close ();_aa !=nil {return nil ,_aa ;
};return _ea ,nil ;};func (_bb *zipDirectory )zipPath (_ebf ,_c string )error {_cg ,_gaa :=_a .ReadDir (_ebf );if _gaa !=nil {return _db .Errorf ("\u0072\u0065\u0061di\u006e\u0067\u0020\u0064\u0069\u0072\u0065\u0063\u0074o\u0072y\u003a \u0027%\u0073\u0027\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0077",_ebf ,_gaa );
};_gf :=&_eg .Builder {};for _ ,_gc :=range _cg {_ebb ,_gac :=_bb .zipBasePaths (_gc ,_ebf ,_c ,_gc .IsDir (),_gf );if _gc .IsDir (){if _fg :=_bb .zipPath (_ebb ,_gac );_fg !=nil {return _fg ;};continue ;};_eag ,_fa :=_a .ReadFile (_ebb );if _fa !=nil {return _fa ;
};_cd ,_fa :=_bb ._dc .Create (_gac );if _fa !=nil {return _fa ;};if _ ,_fa =_cd .Write (_eag );_fa !=nil {return _fa ;};};return nil ;};
// Content is an interface used for putting the content into Client Query.
type Content interface{ContentType ()string ;Data ()[]byte ;};func (_cc *zipDirectory )zipBasePaths (_fbc _d .FileInfo ,_aeb ,_dgg string ,_ec bool ,_abe *_b .Builder )(string ,string ){_abe .WriteString (_aeb );if !_b .HasSuffix (_aeb ,"\u002f"){_abe .WriteRune ('/');
};_abe .WriteString (_fbc .Name ());if _ec {_abe .WriteRune ('/');};_bfg :=_abe .String ();_abe .Reset ();_abe .WriteString (_dgg );_abe .WriteString (_fbc .Name ());if _ec {_abe .WriteRune ('/');};_gc :=_abe .String ();_abe .Reset ();return _bfg ,_gc ;
};func (_dde *zipDirectory )zipPath (_aed ,_de string )error {_ded ,_dg :=_g .ReadDir (_aed );if _dg !=nil {return _a .Errorf ("\u0072\u0065\u0061di\u006e\u0067\u0020\u0064\u0069\u0072\u0065\u0063\u0074o\u0072y\u003a \u0027%\u0073\u0027\u0020\u0066\u0061\u0069\u006c\u0065\u0064\u003a\u0020\u0025\u0077",_aed ,_dg );
};_add :=&_b .Builder {};for _ ,_cfd :=range _ded {_ceg ,_fb :=_dde .zipBasePaths (_cfd ,_aed ,_de ,_cfd .IsDir (),_add );if _cfd .IsDir (){if _ea :=_dde .zipPath (_ceg ,_fb );_ea !=nil {return _ea ;};continue ;};_bfb ,_gfg :=_g .ReadFile (_ceg );if _gfg !=nil {return _gfg ;
};_cd ,_gfg :=_dde ._cba .Create (_fb );if _gfg !=nil {return _gfg ;};if _ ,_gfg =_cd .Write (_bfb );_gfg !=nil {return _gfg ;};};return nil ;};type zipDirectory struct{_bf _ca .Buffer ;_cba *_f .Writer ;};

// Data implements Content interface.
func (_bdc *zipDirectory )Data ()[]byte {return _bdc ._bf .Bytes ()};
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ require (
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.1.1
github.com/spf13/viper v1.7.1
github.com/unidoc/unipdf/v3 v3.19.1
github.com/unidoc/unipdf/v3 v3.20.0
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
)
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,8 @@ github.com/unidoc/pkcs7 v0.0.0-20200411230602-d883fd70d1df h1:1RV3lxQ6L6xGFNhngp
github.com/unidoc/pkcs7 v0.0.0-20200411230602-d883fd70d1df/go.mod h1:UEzOZUEpJfDpywVJMUT8QiugqEZC29pDq7kdIZhWCr8=
github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a h1:RLtvUhe4DsUDl66m7MJ8OqBjq8jpWBXPK6/RKtqeTkc=
github.com/unidoc/timestamp v0.0.0-20200412005513-91597fd3793a/go.mod h1:j+qMWZVpZFTvDey3zxUkSgPJZEX33tDgU/QIA0IzCUw=
github.com/unidoc/unipdf/v3 v3.19.0 h1:DGa6xAMSXfRhcK4TPVzrSmSh0MvJ8aoB0Kcv8waCGTM=
github.com/unidoc/unipdf/v3 v3.19.0/go.mod h1:WdRz3hVhi/M0jFGXhsT5/9FDyRfga6KgI2ZQqjiOXaM=
github.com/unidoc/unipdf/v3 v3.19.1 h1:YCiKtYek7aHHsc3gx6ls6NlxY0+CfXy3KY4cCvyjqgY=
github.com/unidoc/unipdf/v3 v3.19.1/go.mod h1:WdRz3hVhi/M0jFGXhsT5/9FDyRfga6KgI2ZQqjiOXaM=
github.com/unidoc/unipdf/v3 v3.20.0 h1:efG2Y99K9xTELWmZuKGMgVYIhPsI0QbkNxx97IDMyyU=
github.com/unidoc/unipdf/v3 v3.20.0/go.mod h1:WdRz3hVhi/M0jFGXhsT5/9FDyRfga6KgI2ZQqjiOXaM=
github.com/unidoc/unitype v0.2.1 h1:x0jMn7pB/tNrjEVjy3Ukpxo++HOBQaTCXcTYFA6BH3w=
github.com/unidoc/unitype v0.2.1/go.mod h1:mafyug7zYmDOusqa7G0dJV45qp4b6TDAN+pHN7ZUIBU=
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
Expand Down
Loading

0 comments on commit ca9bdb6

Please sign in to comment.