github.com/cloudreve/Cloudreve/v3@v3.0.0-20240224133659-3edb00a6484c/pkg/wopi/types.go (about) 1 package wopi 2 3 import ( 4 "encoding/gob" 5 "encoding/xml" 6 "net/url" 7 ) 8 9 // Response content from discovery endpoint. 10 type WopiDiscovery struct { 11 XMLName xml.Name `xml:"wopi-discovery"` 12 Text string `xml:",chardata"` 13 NetZone struct { 14 Text string `xml:",chardata"` 15 Name string `xml:"name,attr"` 16 App []struct { 17 Text string `xml:",chardata"` 18 Name string `xml:"name,attr"` 19 FavIconUrl string `xml:"favIconUrl,attr"` 20 BootstrapperUrl string `xml:"bootstrapperUrl,attr"` 21 AppBootstrapperUrl string `xml:"appBootstrapperUrl,attr"` 22 ApplicationBaseUrl string `xml:"applicationBaseUrl,attr"` 23 StaticResourceOrigin string `xml:"staticResourceOrigin,attr"` 24 CheckLicense string `xml:"checkLicense,attr"` 25 Action []Action `xml:"action"` 26 } `xml:"app"` 27 } `xml:"net-zone"` 28 ProofKey struct { 29 Text string `xml:",chardata"` 30 Oldvalue string `xml:"oldvalue,attr"` 31 Oldmodulus string `xml:"oldmodulus,attr"` 32 Oldexponent string `xml:"oldexponent,attr"` 33 Value string `xml:"value,attr"` 34 Modulus string `xml:"modulus,attr"` 35 Exponent string `xml:"exponent,attr"` 36 } `xml:"proof-key"` 37 } 38 39 type Action struct { 40 Text string `xml:",chardata"` 41 Name string `xml:"name,attr"` 42 Ext string `xml:"ext,attr"` 43 Default string `xml:"default,attr"` 44 Urlsrc string `xml:"urlsrc,attr"` 45 Requires string `xml:"requires,attr"` 46 Targetext string `xml:"targetext,attr"` 47 Progid string `xml:"progid,attr"` 48 UseParent string `xml:"useParent,attr"` 49 Newprogid string `xml:"newprogid,attr"` 50 Newext string `xml:"newext,attr"` 51 } 52 53 type Session struct { 54 AccessToken string 55 AccessTokenTTL int64 56 ActionURL *url.URL 57 } 58 59 type SessionCache struct { 60 AccessToken string 61 FileID uint 62 UserID uint 63 Action ActonType 64 } 65 66 func init() { 67 gob.Register(WopiDiscovery{}) 68 gob.Register(Action{}) 69 gob.Register(SessionCache{}) 70 }