12 lines
36 KiB
Go
Raw Normal View History

2021-03-16 20:51:18 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2022-01-15 21:17:38 +00:00
package license ;import (_bf "bytes";_c "compress/gzip";_dc "crypto";_fc "crypto/aes";_cfb "crypto/cipher";_bfg "crypto/rand";_ceg "crypto/rsa";_ba "crypto/sha256";_ab "crypto/sha512";_bfb "crypto/x509";_cf "encoding/base64";_ec "encoding/binary";_f "encoding/hex";_fg "encoding/json";_ce "encoding/pem";_ae "errors";_ef "fmt";_abe "github.com/unidoc/unioffice/common";_efg "github.com/unidoc/unioffice/common/logger";_df "io";_e "io/ioutil";_bd "log";_dcg "net";_cb "net/http";_af "os";_bb "path/filepath";_db "regexp";_a "sort";_ag "strings";_b "sync";_aeg "time";);type LegacyLicense struct{Name string ;Signature string `json:",omitempty"`;Expiration _aeg .Time ;LicenseType LegacyLicenseType ;};func (_gfa *meteredClient )getStatus ()(meteredStatusResp ,error ){var _dba meteredStatusResp ;_fce :=_gfa ._dee +"\u002fm\u0065t\u0065\u0072\u0065\u0064\u002f\u0073\u0074\u0061\u0074\u0075\u0073";var _bgc meteredStatusForm ;_bgce ,_faa :=_fg .Marshal (_bgc );if _faa !=nil {return _dba ,_faa ;};_eba ,_faa :=_da (_bgce );if _faa !=nil {return _dba ,_faa ;};_bef ,_faa :=_cb .NewRequest ("\u0050\u004f\u0053\u0054",_fce ,_eba );if _faa !=nil {return _dba ,_faa ;};_bef .Header .Add ("\u0043\u006f\u006et\u0065\u006e\u0074\u002d\u0054\u0079\u0070\u0065","\u0061\u0070p\u006c\u0069\u0063a\u0074\u0069\u006f\u006e\u002f\u006a\u0073\u006f\u006e");_bef .Header .Add ("\u0043\u006fn\u0074\u0065\u006et\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067","\u0067\u007a\u0069\u0070");_bef .Header .Add ("\u0041c\u0063e\u0070\u0074\u002d\u0045\u006e\u0063\u006f\u0064\u0069\u006e\u0067","\u0067\u007a\u0069\u0070");_bef .Header .Add ("\u0058-\u0041\u0050\u0049\u002d\u004b\u0045Y",_gfa ._add );_gcf ,_faa :=_gfa ._adf .Do (_bef );if _faa !=nil {return _dba ,_faa ;};defer _gcf .Body .Close ();if _gcf .StatusCode !=200{return _dba ,_ef .Errorf ("\u0066\u0061i\u006c\u0065\u0064\u0020t\u006f\u0020c\u0068\u0065\u0063\u006b\u0069\u006e\u002c\u0020s\u0074\u0061\u0074\u0075\u0073\u0020\u0063\u006f\u0064\u0065\u0020\u0069s\u003a\u0020\u0025\u0064",_gcf .StatusCode );};_fd ,_faa :=_adfc (_gcf );if _faa !=nil {return _dba ,_faa ;};_faa =_fg .Unmarshal (_fd ,&_dba );if _faa !=nil {return _dba ,_faa ;};return _dba ,nil ;};func _gb (_bdd string )(LicenseKey ,error ){var _gd LicenseKey ;_gac ,_adb :=_bcb (_bfa ,_ad ,_bdd );if _adb !=nil {return _gd ,_adb ;};_dcge ,_adb :=_cda (_dbb ,_gac );if _adb !=nil {return _gd ,_adb ;};_adb =_fg .Unmarshal (_dcge ,&_gd );if _adb !=nil {return _gd ,_adb ;};_gd .CreatedAt =_aeg .Unix (_gd .CreatedAtInt ,0);if _gd .ExpiresAtInt > 0{_efa :=_aeg .Unix (_gd .ExpiresAtInt ,0);_gd .ExpiresAt =_efa ;};return _gd ,nil ;};const (_bfa ="\u002d\u002d\u002d--\u0042\u0045\u0047\u0049\u004e\u0020\u0055\u004e\u0049D\u004fC\u0020L\u0049C\u0045\u004e\u0053\u0045\u0020\u004b\u0045\u0059\u002d\u002d\u002d\u002d\u002d";_ad ="\u002d\u002d\u002d\u002d\u002d\u0045\u004e\u0044\u0020\u0055\u004e\u0049\u0044\u004f\u0043 \u004cI\u0043\u0045\u004e\u0053\u0045\u0020\u004b\u0045\u0059\u002d\u002d\u002d\u002d\u002d";);var _cdd =_aeg .Date (2019,6,6,0,0,0,0,_aeg .UTC );type MeteredStatus struct{OK bool ;Credits int64 ;Used int64 ;};const _bbg ="\u0055\u004e\u0049\u004fFF\u0049\u0043\u0045\u005f\u004c\u0049\u0043\u0045\u004e\u0053\u0045\u005f\u0050\u0041T\u0048";func _ed (_g string ,_aa []byte )(string ,error ){_dd ,_ :=_ce .Decode ([]byte (_g ));if _dd ==nil {return "",_ef .Errorf ("\u0050\u0072\u0069\u0076\u004b\u0065\u0079\u0020\u0066a\u0069\u006c\u0065\u0064");};_bbb ,_ced :=_bfb .ParsePKCS1PrivateKey (_dd .Bytes );if _ced !=nil {return "",_ced ;};_cd :=_ab .New ();_cd .Write (_aa );_eg :=_cd .Sum (nil );_bc ,_ced :=_ceg .SignPKCS1v15 (_bfg .Reader ,_bbb ,_dc .SHA512 ,_eg );if _ced !=nil {return "",_ced ;};_cab :=_cf .StdEncoding .EncodeToString (_aa );_cab +="\u000a\u002b\u000a";_cab +=_cf .StdEncoding .EncodeToString (_bc );return _cab ,nil ;};func _gbfc ()(_dcg .IP ,error ){_cfcg ,_deec :=_dcg .Dial ("\u0075\u0064\u0070","\u0038\u002e\u0038\u002e\u0038\u002e\u0038\u003a\u0038\u0030");if _deec !=nil {return nil ,_deec ;};defer _cfcg .Close ();_gcd :=_cfcg .Loc