consts

package
v0.0.0-...-1fd2613 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0 Imports: 1 Imported by: 69

Documentation

Overview

Package consts is only for declaring some constants used by the stack, like some slugs, IDs, doctypes, etc.

Index

Constants

View Source
const (
	// StoreSlug is the slug of the store application: it can install
	// konnectors and applications.
	StoreSlug = "store"
	// HomeSlug is the slug of the default app, where the user is redirected
	// after login.
	HomeSlug = "home"
	// SettingsSlug is the slug of the settings application.
	SettingsSlug = "settings"
	// DriveSlug is the slug of the drive app, where the user can be sent if
	// the disk quota alert is raised.
	DriveSlug = "drive"
	// NotesSlug is the slug of notes app, which is used by the stack for
	// referencing a directory that contains the notes with collaborative
	// edition.
	NotesSlug = "notes"
	// PassSlug is the slug of cozy-pass webapp, which is used by the stack for
	// linking the bitwarden OAuth clients.
	PassSlug = "passwords"
	// DataProxySlug is the slug of the dataproxy webapp, which is used for
	// embedding a PouchDB in the client (used by the search for example).
	DataProxySlug = "dataproxy"
)
View Source
const (
	// BitwardenSettingsID is the id of the settings document for bitwarden
	BitwardenSettingsID = "io.cozy.settings.bitwarden"
	// ContextSettingsID is the id of the settings JSON-API response for the context
	ContextSettingsID = "io.cozy.settings.context"
	// ClientsUsageID is the id of the settings JSON-API response for clients-usage
	ClientsUsageID = "io.cozy.settings.clients-usage"
	// DiskUsageID is the id of the settings JSON-API response for disk-usage
	DiskUsageID = "io.cozy.settings.disk-usage"
	// InstanceSettingsID is the id of settings document for the instance
	InstanceSettingsID = "io.cozy.settings.instance"
	// CapabilitiesSettingsID is the id of the settings document with the
	// capabilities for a given instance
	CapabilitiesSettingsID = "io.cozy.settings.capabilities"
	// ExternalTiesID is the id of the settings document with the external ties
	// for a given instance
	ExternalTiesID = "io.cozy.settings.external-ties"
	// PassphraseParametersID is the id of settings document for the passphrase
	// parameters used to hash the master password on client side.
	PassphraseParametersID = "io.cozy.settings.passphrase"
	// FlagsSettingsID is the id of settings document with the feature flags.
	FlagsSettingsID = "io.cozy.settings.flags"
	// InstanceFlagsSettingsID is the id of the settings documents with the
	// feature flags specific to this instance.
	InstanceFlagsSettingsID = "io.cozy.settings.flags.instance"
	// ManagerFlagsSettingsID is the id of the settings documents with the
	// feature flags coming from the manager (via the feature sets).
	ManagerFlagsSettingsID = "io.cozy.settings.flags.manager"
	// ConfigFlagsSettingsID is the id of the settings documents with the
	// feature flags defined in the contexts section of the configuration file.
	ConfigFlagsSettingsID = "io.cozy.settings.flags.config"
	// ContextFlagsSettingsID is the id of the settings documents with the
	// feature flags defined with a ratio on the contexts.
	ContextFlagsSettingsID = "io.cozy.settings.flags.context"
	// DefaultFlagsSettingsID is the id of the settings documents with the
	// default feature flags.
	DefaultFlagsSettingsID = "io.cozy.settings.flags.default"
)
View Source
const (
	// BitwardenCozyOrganizationName is the name of the organization used to
	// share passwords between Cozy and Bitwarden clients.
	BitwardenCozyOrganizationName = "Cozy"
	// BitwardenCozyCollectionName is the name of the collection used to
	// share passwords between Cozy and Bitwarden clients.
	BitwardenCozyCollectionName = "Cozy Connectors"

	// BitwardenProtocol is the name of the bitwarden protocol
	BitwardenProtocol = "Bitwarden"
	// BitwardenCipherRelationship is the name of the account-cipher relationship
	BitwardenCipherRelationship = "vaultCipher"
)
View Source
const (
	// Apps doc type for client-side application manifests
	Apps = "io.cozy.apps"
	// AppsSuggestion doc type for suggesting apps to the user
	AppsSuggestion = "io.cozy.apps.suggestions"
	// AppsOpenParameters doc type for the parameters used by the flagship to
	// open a webapp
	AppsOpenParameters = "io.cozy.apps.open"
	// AppLogs doc type for logs sent by apps and konnectors
	AppLogs = "io.cozy.apps.logs"
	// Konnectors doc type for konnector application manifests
	Konnectors = "io.cozy.konnectors"
	// KonnectorsMaintenance doc type for maintenance of konnectors.
	KonnectorsMaintenance = "io.cozy.konnectors.maintenance"
	// Archives doc type for zip archives with files and directories
	Archives = "io.cozy.files.archives"
	// Exports doc type for global exports archives
	Exports = "io.cozy.exports"
	// ExportsRequests doc type for a request to move to another Cozy
	ExportsRequests = "io.cozy.exports.requests"
	// Imports doc type for global exports archives
	Imports = "io.cozy.imports"
	// Doctypes doc type for doctype list
	Doctypes = "io.cozy.doctypes"
	// Files doc type for type for files and directories
	Files = "io.cozy.files"
	// FilesMetadata doc type for metadata of files
	FilesMetadata = "io.cozy.files.metadata"
	// FilesVersions doc type for versioning file contents
	FilesVersions = "io.cozy.files.versions"
	// FilesShortcuts doc type for high-level information about .url files
	FilesShortcuts = "io.cozy.files.shortcuts"
	// Thumbnails is a synthetic doctype for thumbnails, used for realtime
	// events
	Thumbnails = "io.cozy.files.thumbnails"
	// CertifiedCarbonCopy is a synthetic doctype, used for given permission to
	// add the carbonCopy metadata on files
	CertifiedCarbonCopy = "io.cozy.certified.carbon_copy"
	// CertifiedElectronicSafe is a synthetic doctype, used for given
	// permission to add the electronicSafe metadata on files
	CertifiedElectronicSafe = "io.cozy.certified.electronic_safe"
	// DirSizes is a synthetic doctype, used for giving the size of a
	// directory.
	DirSizes = "io.cozy.files.sizes"
	// PhotosAlbums doc type for photos albums
	PhotosAlbums = "io.cozy.photos.albums"
	// Intents doc type for intents persisted in couchdb
	Intents = "io.cozy.intents"
	// Jobs doc type for queued jobs
	Jobs = "io.cozy.jobs"
	// JobEvents doc type for real time events sent by jobs
	JobEvents = "io.cozy.jobs.events"
	// Support doc type for sending mail to the support
	Support = "io.cozy.support"
	// Notifications doc type for notifications
	Notifications = "io.cozy.notifications"
	// OAuthAccessCodes doc type for OAuth2 access codes
	OAuthAccessCodes = "io.cozy.oauth.access_codes"
	// OAuthClients doc type for OAuth2 clients
	OAuthClients = "io.cozy.oauth.clients"
	// Permissions doc type for permissions identifying a connection
	Permissions = "io.cozy.permissions"
	// Contacts doc type for sharing
	Contacts = "io.cozy.contacts"
	// Groups of contacts doc type for sharing
	Groups = "io.cozy.contacts.groups"
	// RemoteRequests doc type for logging requests to remote websites
	RemoteRequests = "io.cozy.remote.requests"
	// RemoteSecrets doc type for secrets used by remote doctypes
	RemoteSecrets = "io.cozy.remote.secrets"
	// Sessions doc type for sessions identifying a connection
	Sessions = "io.cozy.sessions"
	// SessionsLogins doc type for sessions identifying a connection
	SessionsLogins = "io.cozy.sessions.logins"
	// Settings doc type for settings to customize an instance
	Settings = "io.cozy.settings"
	// Shared doc type for keepking track of documents in sharings
	Shared = "io.cozy.shared"
	// Sharings doc type for document and file sharing
	Sharings = "io.cozy.sharings"
	// SharingsMembers doc type for members of a sharing
	SharingsMembers = "io.cozy.sharings.members"
	// SharingsAnswer doc type for credentials exchange for sharings
	SharingsAnswer = "io.cozy.sharings.answer"
	// SharingsMoved doc type for when a Cozy is moved to a new address
	SharingsMoved = "io.cozy.sharings.moved"
	// SharingsInitialSync doc type for real-time events for initial sync of a
	// sharing
	SharingsInitialSync = "io.cozy.sharings.initial_sync"
	// Triggers doc type for triggers, jobs launchers
	Triggers = "io.cozy.triggers"
	// TriggersState doc type for triggers current state, jobs launchers
	TriggersState = "io.cozy.triggers.state"
	// Accounts doc type for accounts
	Accounts = "io.cozy.accounts"
	// SoftDeletedAccounts doc type for old revisions of deleted accounts
	SoftDeletedAccounts = "io.cozy.accounts.soft_deleted"
	// AccountTypes doc type for account types
	AccountTypes = "io.cozy.account_types"
	// BitwardenProfiles doc type for Bitwarden profile
	BitwardenProfiles = "com.bitwarden.profiles"
	// BitwardenCiphers doc type for Bitwarden ciphers
	BitwardenCiphers = "com.bitwarden.ciphers"
	// BitwardenFolders doc type for Bitwarden folders
	BitwardenFolders = "com.bitwarden.folders"
	// BitwardenOrganizations doc type for Bitwarden organizations
	BitwardenOrganizations = "com.bitwarden.organizations"
	// BitwardenContacts doc type for Bitwarden users that can be added to
	// an organization
	BitwardenContacts = "com.bitwarden.contacts"
	// NotesDocuments doc type is used for manipulating the documents that
	// represents a note before they are persisted to a file.
	NotesDocuments = "io.cozy.notes.documents"
	// NotesSteps doc type is used for patching a note.
	NotesSteps = "io.cozy.notes.steps"
	// NotesTelepointers doc type is used for the position of the cursor in a
	// note.
	NotesTelepointers = "io.cozy.notes.telepointers"
	// NotesEvents doc type is used for realtime events related to a note, like
	// a change of title.
	NotesEvents = "io.cozy.notes.events"
	// NotesURL doc type is used to return the URL where a note can be edited.
	NotesURL = "io.cozy.notes.url"
	// NotesImages doc type used for images used by a note
	NotesImages = "io.cozy.notes.images"
	// OfficeURL doc type is used to return the URL where an office document can be edited.
	OfficeURL = "io.cozy.office.url"
	// AuthConfirmations doc type used for realtime events when confirming
	// authentication.
	AuthConfirmations = "io.cozy.auth.confirmations"
	// SourceAccountIdentifier doc type is used to link a directory to the
	// konnector account that imports documents inside it.
	SourceAccountIdentifier = "io.cozy.accounts.sourceAccountIdentifier"
	// NextCloudFiles doc type is used when listing files from a NextCloud via
	// WebDAV.
	NextCloudFiles = "io.cozy.remote.nextcloud.files"
	// ChatConversations doc type is used for a chat between the user and a chatbot.
	ChatConversations = "io.cozy.ai.chat.conversations"
	// ChatEvents doc type is used for RAG events about a chat conversation.
	ChatEvents = "io.cozy.ai.chat.events"
)
View Source
const (
	// DirType is the type attribute for directories
	DirType = "directory"
	// FileType is the type attribute for files
	FileType = "file"
)
View Source
const (
	// RootDirID is the root directory identifier
	RootDirID = "io.cozy.files.root-dir"
	// TrashDirID is the trash directory identifier
	TrashDirID = "io.cozy.files.trash-dir"
	// SharedWithMeDirID is the identifier of the directory where the sharings
	// will put their folders for the shared files
	SharedWithMeDirID = "io.cozy.files.shared-with-me-dir"
	// NoLongerSharedDirID is the identifier of the directory where the files &
	// folders removed from a sharing but still used via a reference are put
	NoLongerSharedDirID = "io.cozy.files.no-longer-shared-dir"
	// DrivesDirID is the identifier of the directory where the
	// (shared|external) drives are saved.
	SharedDrivesDirID = "io.cozy.files.shared-drives-dir"
)
View Source
const (
	// ShortcutMimeType is the mime-type for the .url files.
	ShortcutMimeType = "application/internet-shortcut"
	// NoteMimeType is the mime-type for the .cozy-note files.
	NoteMimeType = "text/vnd.cozy.note+markdown"
)
View Source
const (
	// CarbonCopyKey is the metadata key for a carbon copy (certified)
	CarbonCopyKey = "carbonCopy"
	// ElectronicSafeKey is the metadata key for an electronic safe (certified)
	ElectronicSafeKey = "electronicSafe"
	// FavoriteKey is the metadata key for a favorite.
	FavoriteKey = "favorite"
)
View Source
const (
	// NoteImageOriginalFormat is the format for the original image in a note.
	NoteImageOriginalFormat = "original"
	// NoteImageThumbFormat is the format for a resized image in a note.
	NoteImageThumbFormat = "thumb"
)
View Source
const (
	AppAudience               = "app"          // used by client-side apps
	KonnectorAudience         = "konn"         // used by konnectors
	CLIAudience               = "cli"          // used by command line interface
	ShareAudience             = "share"        // used for share by links code
	RegistrationTokenAudience = "registration" // OAuth registration tokens
	AccessTokenAudience       = "access"       // OAuth access tokens
	RefreshTokenAudience      = "refresh"      // OAuth refresh tokens
)

This is the list of possible audience values for JWT.

View Source
const Configs = "configs"

Configs doc type assets documents configuration

View Source
const DefaultLocale = "en"

DefaultLocale is the default locale when creating an instance and for i18n.

View Source
const Instances = "instances"

Instances doc type for User's instance document

View Source
const MaxItemsPerPageForMango = 1000

MaxItemsPerPageForMango is the maximal value accepted for the limit parameter used for mango pagination

View Source
const ShortCodeLen = 12

ShortCodeLen is the number of chars for the shortcode

View Source
const TinyCodeLen = 6

TinyCodeLen is the number of digits for the tinycode

Variables

View Source
var (
	DefaultValidityDuration = 24 * time.Hour

	AppTokenValidityDuration       = 24 * time.Hour
	KonnectorTokenValidityDuration = 30 * time.Minute
	CLITokenValidityDuration       = 30 * time.Minute

	AccessTokenValidityDuration = 7 * 24 * time.Hour
)

TokenValidityDuration is the duration where a token is valid in seconds (1 week)

View Source
var KnownFlatDomains = []string{
	"mycozy.cloud",
	"cozy.rocks",
}

KnownFlatDomains is a list of top-domains that can hosts cozy instances with flat sub-domains.

View Source
var PlatformApps = []string{
	"banks",
	"contacts",
	"drive",
	"home",
	"notes",
	"passwords",
	"photos",
	"settings",
	"store",
	"coachco2",
	"mespapiers",
	"dataproxy",
}

PlatformApps is the list of applications that can be updated automatically even if their permissions have changed.

View Source
var SupportedLocales = []string{"en", "fr"}

SupportedLocales is the list of supported locales tags.

Functions

This section is empty.

Types

type AppType

type AppType int

AppType is an enum to represent the type of application: webapp clientside or konnector serverside.

const (
	// WebappType is the clientside application type
	WebappType AppType = iota + 1
	// KonnectorType is the serverside application type
	KonnectorType
)

func NewAppType

func NewAppType(doctype string) AppType

NewAppType creates a new AppType from a string

func (AppType) String

func (at AppType) String() string

String returns the human-readable doctype from the AppType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL