Home Download Docs Code Community
     1	/*
     2	Copyright 2015 The Perkeep Authors
     3	
     4	Licensed under the Apache License, Version 2.0 (the "License");
     5	you may not use this file except in compliance with the License.
     6	You may obtain a copy of the License at
     7	
     8	     http://www.apache.org/licenses/LICENSE-2.0
     9	
    10	Unless required by applicable law or agreed to in writing, software
    11	distributed under the License is distributed on an "AS IS" BASIS,
    12	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13	See the License for the specific language governing permissions and
    14	limitations under the License.
    15	*/
    16	
    17	package camtypes
    18	
    19	import (
    20		"perkeep.org/pkg/blob"
    21	
    22		"go4.org/types"
    23	)
    24	
    25	// Discovery is the JSON response for discovery requests.
    26	type Discovery struct {
    27		BlobRoot     string `json:"blobRoot"`
    28		JSONSignRoot string `json:"jsonSignRoot"`
    29		HelpRoot     string `json:"helpRoot"`
    30		ImporterRoot string `json:"importerRoot"`
    31		SearchRoot   string `json:"searchRoot"`
    32		StatusRoot   string `json:"statusRoot"`
    33		ShareRoot    string `json:"shareRoot"`
    34	
    35		OwnerName string `json:"ownerName"` // Name of the owner.
    36		UserName  string `json:"userName"`  // Name of the user.
    37	
    38		// StorageGeneration is the UUID for the storage generation.
    39		StorageGeneration string `json:"storageGeneration,omitempty"`
    40		// StorageGenerationError is the error that occurred on generating the storage, if any.
    41		StorageGenerationError string `json:"storageGenerationError,omitempty"`
    42		// StorageInitTime is the initialization time of the storage.
    43		StorageInitTime types.Time3339 `json:"storageInitTime,omitempty"`
    44	
    45		ThumbVersion string `json:"thumbVersion"` // Thumbnailing version.
    46	
    47		// AuthToken is an auth.OpAll token used by the web UI and the WebSocket.
    48		// It is randomly generated the first time discovery is served.
    49		AuthToken string `json:"authToken"`
    50	
    51		// HasLegacySHA1Index reports whether this server
    52		// contains legacy SHA-1 sums of files in its wholeref
    53		// index. When true, clients can additional compute the SHA-1 of
    54		// local files to upload to avoid uploading duplicates.
    55		HasLegacySHA1Index bool `json:"hasLegacySHA1Index"`
    56	
    57		// SyncHandlers lists discovery information about the available sync handlers.
    58		SyncHandlers []SyncHandlerDiscovery `json:"syncHandlers,omitempty"`
    59		// Signing contains discovery information for signing.
    60		Signing *SignDiscovery `json:"signing,omitempty"`
    61		// UIDiscovery contains discovery information for the UI.
    62		*UIDiscovery
    63	}
    64	
    65	// SignDiscovery contains discovery information for jsonsign.
    66	// It is part of the server's JSON response for discovery requests.
    67	type SignDiscovery struct {
    68		// PublicKey is the path to the public signing key.
    69		PublicKey string `json:"publicKey,omitempty"`
    70		// PublicKeyBlobRef is the blob.Ref for the public key.
    71		PublicKeyBlobRef blob.Ref `json:"publicKeyBlobRef,omitempty"`
    72		// PublicKeyID is the ID of the public key.
    73		PublicKeyID string `json:"publicKeyId"`
    74		// SignHandler is the URL path prefix to the signing handler.
    75		SignHandler string `json:"signHandler"`
    76		// VerifyHandler it the URL path prefix to the signature verification handler.
    77		VerifyHandler string `json:"verifyHandler"`
    78	}
    79	
    80	// SyncHandlerDiscovery contains discovery information about a sync handler.
    81	// It is part of the JSON response to discovery requests.
    82	type SyncHandlerDiscovery struct {
    83		// From is the source of the sync handler.
    84		From string `json:"from"`
    85		// To is the destination of the sync handler.
    86		To string `json:"to"`
    87		// ToIndex is true if the sync is from a blob storage to an index.
    88		ToIndex bool `json:"toIndex"`
    89	}
    90	
    91	// UIDiscovery contains discovery information for the user interface.
    92	// It is part of the JSON response to discovery requests.
    93	type UIDiscovery struct {
    94		// UIRoot is the URL prefix path to the UI handler.
    95		UIRoot string `json:"uiRoot"`
    96		// UploadHelper is the path to the upload helper.
    97		UploadHelper string `json:"uploadHelper"`
    98		// DirectoryHelper is the path to the directory helper.
    99		DirectoryHelper string `json:"directoryHelper"`
   100		// DownloaderHelper is the path to the downloader helper.
   101		DownloadHelper string `json:"downloadHelper"`
   102		// PublishRoots lists discovery information for all publishing roots,
   103		// mapped by the respective root name.
   104		PublishRoots map[string]*PublishRootDiscovery `json:"publishRoots"`
   105		// MapClustering defines whether to cluster position markers on the map aspect.
   106		MapClustering bool `json:"mapClustering"`
   107		// ImportShare is the path to the share importer handler.
   108		ImportShare string `json:"importShare"`
   109	}
   110	
   111	// PublishRootDiscovery contains discovery information for the publish roots.
   112	type PublishRootDiscovery struct {
   113		Name string `json:"name"`
   114		// Prefix lists prefixes belonging to the publishing root.
   115		Prefix []string `json:"prefix"`
   116		// CurrentPermanode is the permanode associated with the publishing root.
   117		CurrentPermanode blob.Ref `json:"currentPermanode"`
   118	}
Website layout inspired by memcached.
Content by the authors.