2021-05-31 16:22:30 +00:00
|
|
|
package license ;import (_ea "bytes";_e "compress/gzip";_g "crypto";_fg "crypto/aes";_da "crypto/cipher";_fe "crypto/rand";_ed "crypto/rsa";_ec "crypto/sha256";_a "crypto/sha512";_bed "crypto/x509";_cb "encoding/base64";_eaf "encoding/binary";_cae "encoding/hex";_be "encoding/json";_cbb "encoding/pem";_dg "errors";_dgd "fmt";_cgg "github.com/unidoc/unioffice";_cda "github.com/unidoc/unioffice/common";_ca "io";_bc "io/ioutil";_eg "log";_fc "net";_cg "net/http";_b "os";_ga "path/filepath";_d "regexp";_f "sort";_dge "strings";_cd "sync";_gf "time";);func _edd (_bgcc []byte )(_ca .Reader ,error ){_gca :=new (_ea .Buffer );_dcf :=_e .NewWriter (_gca );_dcf .Write (_bgcc );_fad :=_dcf .Close ();if _fad !=nil {return nil ,_fad ;};return _gca ,nil ;};func (_ge *LicenseKey )TypeToString ()string {if _ge ._fec {return "M\u0065t\u0065\u0072\u0065\u0064\u0020\u0073\u0075\u0062s\u0063\u0072\u0069\u0070ti\u006f\u006e";};if _ge .Tier ==LicenseTierUnlicensed {return "\u0055\u006e\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0064";};if _ge .Tier ==LicenseTierCommunity {return "\u0041\u0047PL\u0076\u0033\u0020O\u0070\u0065\u006e\u0020Sou\u0072ce\u0020\u0043\u006f\u006d\u006d\u0075\u006eit\u0079\u0020\u004c\u0069\u0063\u0065\u006es\u0065";};if _ge .Tier ==LicenseTierIndividual ||_ge .Tier =="\u0069\u006e\u0064i\u0065"{return "\u0043\u006f\u006dm\u0065\u0072\u0063\u0069a\u006c\u0020\u004c\u0069\u0063\u0065\u006es\u0065\u0020\u002d\u0020\u0049\u006e\u0064\u0069\u0076\u0069\u0064\u0075\u0061\u006c";};return "\u0043\u006fm\u006d\u0065\u0072\u0063\u0069\u0061\u006c\u0020\u004c\u0069\u0063\u0065\u006e\u0073\u0065\u0020\u002d\u0020\u0042\u0075\u0073\u0069ne\u0073\u0073";};func (_eec defaultStateHolder )loadState (_bdd string )(reportState ,error ){_cdae :=_aab ();if len (_cdae )==0{return reportState {},_dg .New ("\u0068\u006fm\u0065\u0020\u0064i\u0072\u0020\u006e\u006f\u0074\u0020\u0073\u0065\u0074");};_agc :=_ga .Join (_cdae ,"\u002eu\u006e\u0069\u0064\u006f\u0063");_ega :=_b .MkdirAll (_agc ,0777);if _ega !=nil {return reportState {},_ega ;};if len (_bdd )< 20{return reportState {},_dg .New ("i\u006e\u0076\u0061\u006c\u0069\u0064\u0020\u006b\u0065\u0079");};_cdc :=[]byte (_bdd );_fdg :=_a .Sum512_256 (_cdc [:20]);_gfb :=_cae .EncodeToString (_fdg [:]);_gb :=_ga .Join (_agc ,_gfb );_ffd ,_ega :=_bc .ReadFile (_gb );if _ega !=nil {if _b .IsNotExist (_ega ){return reportState {},nil ;};_cgg .Log ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0025\u0076\u000a",_ega );return reportState {},_dg .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0064\u0061\u0074\u0061");};const _dbeb ="\u0068\u00619\u004e\u004b\u0038]\u0052\u0062\u004c\u002a\u006d\u0034\u004c\u004b\u0057";_ffd ,_ega =_eac ([]byte (_dbeb ),_ffd );if _ega !=nil {return reportState {},_ega ;};var _ecg reportState ;_ega =_be .Unmarshal (_ffd ,&_ecg );if _ega !=nil {_cgg .Log ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0049\u006e\u0076\u0061\u006c\u0069d\u0020\u0064\u0061\u0074\u0061\u003a\u0020\u0025\u0076\u000a",_ega );return reportState {},_dg .New ("\u0069\u006e\u0076a\u006c\u0069\u0064\u0020\u0064\u0061\u0074\u0061");};return _ecg ,nil ;};const _ac ="\u0033\u0030\u0035\u0063\u0033\u0030\u0030\u00640\u0036\u0030\u0039\u0032\u0061\u0038\u00364\u0038\u0038\u0036\u0066\u0037\u0030d\u0030\u0031\u0030\u0031\u0030\u00310\u0035\u0030\u0030\u0030\u0033\u0034\u0062\u0030\u0030\u0033\u0030\u00348\u0030\u0032\u0034\u0031\u0030\u0030\u0062\u0038\u0037\u0065\u0061\u0066\u0062\u0036\u0063\u0030\u0037\u0034\u0039\u0039\u0065\u0062\u00397\u0063\u0063\u0039\u0064\u0033\u0035\u0036\u0035\u0065\u0063\u00663\u0031\u0036\u0038\u0031\u0039\u0036\u0033\u0030\u0031\u0039\u0030\u0037c\u0038\u0034\u0031\u0061\u0064\u0064c6\u0036\u0035\u0030\u0038\u0036\u0062\u0062\u0033\u0065\u0064\u0038\u0065\u0062\u0031\u0032\u0064\u0039\u0064\u0061\u0032\u0036\u0063\u0061\u0066\u0061\u0039\u0036\u00345\u0030\u00314\u0036\u0064\u0061\u0038\u0062\u0064\u0030\u0063c\u0066\u0031\u0035\u0035\u0066\u0063a\u0063\u0063\u00368\u0036\u0039\u0035\u0035\u0065\u0066\u0030\u0033\u0030\u0032\u0066\u0061\u0034\u0034\u0061\u0061\u0033\u0065\u00
|