v1

package
v0.4.99 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 64 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

* @Author: LinkLeong link@icewhale.com * @Date: 2022-07-26 11:08:48 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-17 18:25:42 * @FilePath: /CasaOS/route/v1/samba.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortSystemOSUpgrade added in v0.4.74

func AbortSystemOSUpgrade(ctx echo.Context) error

@Summary call off an upgrade before its point of no return @Description The owner's click on "stop": the unit is stopped and the machine is put back as it was. Valid while the unit runs the blocks that can be undone (refreshing, rehearsing, running before block 5); after that nothing can be called off. Works whatever the switch says. The body is {}. 202 with the status; 409 with data.error_code: no_run, run_unreadable, not_abortable (data.data.reason: point_of_no_return, past_block or not_running); 500 internal when the flag of the call could not be written. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the unit is stopped and is put back: data is the status" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/abort [post]

func AckSystemOSUpgrade added in v0.4.74

func AckSystemOSUpgrade(ctx echo.Context) error

@Summary the owner's word on an upgrade that is not running @Description action is acknowledge (close a run that ended or stopped, which lets backups and automatic updates go on), discard (the same, and drop the plan it was made for; for a rehearsal, put the machine back) or manual (take the run over: the core stops acting, and the owner finishes the hop by hand from its text). A machine that is half upgraded is let go of only with the word that the status gives in ack_word, typed in word. Works whatever the switch says. 200 with the status; 400 bad_request for a field that is not valid; 409 with data.error_code: no_run, run_unreadable, not_terminal (data.data.state), not_resumable (discard of a rehearsal whose unwind cannot be started now), word_required, bad_word, unit_active; 500 close_failed when the backup folder could not be put away (the run is as it was), start_failed when the log could not say that the owner took the run over. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result "data is the status" @Failure 400 {object} model.Result "the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/ack [post]

func CheckNetwork

func CheckNetwork()

func ConnectWebSocket

func ConnectWebSocket(ctx echo.Context) error

func CreateNet

func CreateNet(address, s, e, c string) string

func DeleteFile

func DeleteFile(ctx echo.Context) error

@Summary delete file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param body body string true "paths eg ["/a/b/c","/d/e/f"]" @Param to_trash query bool false "move to the trash of each disk instead of deleting" @Success 200 {string} string "ok" @Router /file/delete [delete]

func DeleteFleetBox added in v0.4.90

func DeleteFleetBox(ctx echo.Context) error

DeleteFleetBox revokes a box.

@Summary fleet: remove a box @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id} [delete]

func DeleteFleetMember added in v0.4.90

func DeleteFleetMember(ctx echo.Context) error

DeleteFleetMember leaves the fleet.

@Summary fleet: leave the fleet @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/member [delete]

func DeleteFleetRemoteDevice added in v0.4.96

func DeleteFleetRemoteDevice(ctx echo.Context) error

DeleteFleetRemoteDevice takes a phone or PC off the network.

@Summary fleet: remove a phone or PC @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote/devices/{id} [delete]

func DeleteOperateFileOrDir

func DeleteOperateFileOrDir(ctx echo.Context) error

func DeleteSambaConnections

func DeleteSambaConnections(ctx echo.Context) error

func DeleteSambaShares

func DeleteSambaShares(ctx echo.Context) error

func DeleteSambaUser

func DeleteSambaUser(ctx echo.Context) error

DeleteSambaUser removes a share account, taking it out of every share it may mount first. A share it owns passes to another member, with the files it owned.

It refuses while the account is the only member of a share. Removing it anyway would leave that share with a "valid users" entry that no longer resolves, which smbd treats as nobody being allowed in — the share would simply stop working with no explanation.

func DeleteTrash added in v0.4.85

func DeleteTrash(ctx echo.Context) error

DeleteTrash removes items for good.

func DirPath

func DirPath(ctx echo.Context) error

@Summary 获取目录列表 @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path query string false "路径" @Success 200 {string} string "ok" @Router /file/dirpath [get]

func EmptyTrash added in v0.4.85

func EmptyTrash(ctx echo.Context) error

EmptyTrash removes everything in the trash.

func FleetRelay added in v0.4.90

func FleetRelay(ctx echo.Context) error

FleetRelay forwards a request into a box's tunnel and answers what the box answered, as it is. Only the routes of the table pass; everything else is 403.

@Summary fleet: relay one of a box's own routes @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id}/relay/{path} [get]

func FleetTunnel added in v0.4.90

func FleetTunnel(ctx echo.Context) error

FleetTunnel is the box's end of a tunnel: a WebSocket, outside the JWT group, authorised by the box's key.

func GetAddress

func GetAddress() string

func GetAlerts added in v0.4.63

func GetAlerts(ctx echo.Context) error

GetAlerts answers the push alerts' channels, each by name, service and host and never by its URL, the categories, the disk threshold and the last send that failed.

@Summary push alerts: channels and settings @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/alerts [get]

func GetAutoUpdate added in v0.4.62

func GetAutoUpdate(ctx echo.Context) error

GetAutoUpdate answers whether automatic updates are on, their window, their state, the release they aim at and their last attempt.

@Summary automatic updates: settings and state @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/autoupdate [get]

func GetCasaOSErrorLogs

func GetCasaOSErrorLogs(ctx echo.Context) error

@Summary get logs @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/error/logs [get]

func GetCasaOSPort

func GetCasaOSPort(ctx echo.Context) error

@Summary get casaos server port @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/port [get]

func GetDockerUpdateStatus added in v0.4.67

func GetDockerUpdateStatus(ctx echo.Context) error

@Summary how the update of Docker is going, or how it went @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/docker/update/status [get]

func GetDownloadFile

func GetDownloadFile(ctx echo.Context) error

@Summary download @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param format query string false "Compression format" Enums(zip,tar,targz) @Param files query string true "file list eg: filename1,filename2,filename3 " @Success 200 {string} string "ok" @Router /file/download [get]

func GetDownloadSingleFile

func GetDownloadSingleFile(ctx echo.Context) error

func GetFileCount

func GetFileCount(ctx echo.Context) error

func GetFileImage

func GetFileImage(ctx echo.Context) error

@Summary image thumbnail/original image @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path query string true "path" @Param type query string false "original,thumbnail" Enums(original,thumbnail) @Success 200 {string} string "ok" @Router /file/image [get]

func GetFileRoots added in v0.4.90

func GetFileRoots(ctx echo.Context) error

GetFileRoots answers the configured file ManagementRoots. Empty: the file API is unconfined and the dashboard keeps /DATA.

func GetFileUpload

func GetFileUpload(ctx echo.Context) error

@Summary upload file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path formData string false "file path" @Param file formData file true "file" @Success 200 {string} string "ok" @Router /file/upload [get]

func GetFilerContent

func GetFilerContent(ctx echo.Context) error

@Summary 读取文件 @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path query string true "路径" @Success 200 {string} string "ok" @Router /file/read [get]

func GetFleet added in v0.4.90

func GetFleet(ctx echo.Context) error

GetFleet answers the role of this box and the state of the role it plays.

@Summary fleet: the role and its state @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet [get]

func GetFleetRemote added in v0.4.96

func GetFleetRemote(ctx echo.Context) error

GetFleetRemote asks the relay for the devices on this box's network and, on a master, its boxes' addresses. The dashboard calls it on demand (the remote access page opening, a refresh button), never on a timer: the relay limits Bearer calls to 60 an hour per IP, shared with join keys.

@Summary fleet: remote access devices and addresses @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote [get]

func GetLocalFile

func GetLocalFile(ctx echo.Context) error

func GetPeers

func GetPeers(ctx echo.Context) error

func GetPort

func GetPort(ctx echo.Context) error

@Summary 获取一个可用端口 @Produce application/json @Accept application/json @Tags app @Param type query string true "端口类型 udp/tcp" @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /app/getport [get]

func GetRecoverStorage

func GetRecoverStorage(ctx echo.Context) error

func GetSambaConnectionsList

func GetSambaConnectionsList(ctx echo.Context) error

client

func GetSambaSharesList

func GetSambaSharesList(ctx echo.Context) error

func GetSambaStatus

func GetSambaStatus(ctx echo.Context) error

func GetSambaUsersList

func GetSambaUsersList(ctx echo.Context) error

GetSambaUsersList returns the share accounts CasaOS created. Accounts that belong to the operating system are not listed and cannot be managed here.

func GetSearchResult

func GetSearchResult(ctx echo.Context) error

func GetSize

func GetSize(ctx echo.Context) error

func GetStats added in v0.4.80

func GetStats(ctx echo.Context) error

GetStats lists what is measured: the machine.

@Summary statistics: the measured items @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/stats [get]

func GetStatsAlerts added in v0.4.80

func GetStatsAlerts(ctx echo.Context) error

GetStatsAlerts answers the alert rules of the machine and its firing alerts.

@Summary statistics: alert rules and firing alerts of one item @Produce application/json @Tags sys @Security ApiKeyAuth @Param id path string true "item id" @Success 200 {object} model.Result @Router /sys/stats/{id}/alerts [get]

func GetStatsSeries added in v0.4.80

func GetStatsSeries(ctx echo.Context) error

GetStatsSeries answers the history of the machine over ?range= (live when absent).

@Summary statistics: the series of one item @Produce application/json @Tags sys @Security ApiKeyAuth @Param id path string true "item id" @Param range query string false "live, 15m, 1h, 24h or 7d" @Success 200 {object} model.Result @Router /sys/stats/{id} [get]

func GetStorage

func GetStorage(ctx echo.Context) error

func GetSystemCheckVersion

func GetSystemCheckVersion(ctx echo.Context) error

@Summary check version @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/version/check [get]

func GetSystemConfigDebug

func GetSystemConfigDebug(ctx echo.Context) error

系统配置

func GetSystemCupInfo

func GetSystemCupInfo(ctx echo.Context) error

@Summary get cpu info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/cpu [get]

func GetSystemDiskInfo

func GetSystemDiskInfo(ctx echo.Context) error

@Summary get disk info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/disk [get]

func GetSystemDockerContainers added in v0.4.67

func GetSystemDockerContainers(ctx echo.Context) error

@Summary list the running Docker containers, which an update of Docker stops @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/docker/containers [get]

func GetSystemEntry

func GetSystemEntry(ctx echo.Context) error

func GetSystemHardwareInfo

func GetSystemHardwareInfo(ctx echo.Context) error

@Summary get system hardware info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/hardware/info [get]

func GetSystemMemInfo

func GetSystemMemInfo(ctx echo.Context) error

@Summary get mem info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/mem [get]

func GetSystemModuleStatus added in v0.4.75

func GetSystemModuleStatus(ctx echo.Context) error

@Summary how the job of a module is going, and the module @Description data.job is the job that the core started for the module, or the last that it started: kind (install, remove or update, as the core started it; "" when the log does not say, as for a job that was started by hand), state (idle, running, succeeded, refused, failed or interrupted), step (where it is, or where it failed), code (why it was refused or failed), undo (rolled_back, rolled_back_with_left or rollback_incomplete for an install or an update that failed after it changed the box), kept_packages (the packages an install that failed left on the box, null when it is not known), started_at, ended_at and log_tail (the last 20 lines of the log that are not marker lines, as text). data.status is the module as the assistant says it: installed, version, unit (active, enabled) and route (answers). It runs no apt and takes no lock of a job: it is safe to ask every few seconds. 400 bad_request for a name that is not a module's. @Produce application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 200 {object} model.Result @Failure 400 {object} model.Result "the name is not a module's: data.error_code is bad_request" @Router /sys/modules/{name}/status [get]

func GetSystemModules added in v0.4.75

func GetSystemModules(ctx echo.Context) error

@Summary the modules that this release can install, and what the box says of each @Description The catalogue of this release joined with what is installed: catalogue (ok, and when it is not, error: none, unreadable or invalid, with the place in detail; the list is then empty, never partial), and modules, each with name, title, description, tier (core or community), tag, whether the catalogue has it, installed (null, or its version), system (supported, and the codes of the checks that say no: os, arch, recasaos) and broken when its manifest cannot be read. It only reads. A module that is installed and no longer in the catalogue is listed all the same, with catalogue false. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/modules [get]

func GetSystemNetInfo

func GetSystemNetInfo(ctx echo.Context) error

@Summary get Net info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/net [get]

func GetSystemOS added in v0.4.69

func GetSystemOS(ctx echo.Context) error

@Summary the operating system, and how long its security updates last @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os [get]

func GetSystemOSPlan added in v0.4.73

func GetSystemOSPlan(ctx echo.Context) error

@Summary how the plan of the upgrade of the operating system is going, or how it went @Description Whether a plan can be made (plannable, and reason when it cannot; unknown when that could not be told, and then it is asked again), the state of the job (idle, running, done, failed), its phase, its times, why it failed (error: code, phase, detail, data), the sandbox directory that a job that is over could not remove (sandbox_left_behind) and, when it is done and has not expired, the plan without the tree of the sources. It runs no apt, and takes no lock of the package updater; asking who the machine is takes a moment when no job runs, and the requests that come together share the answer. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os/upgrade/plan [get]

func GetSystemOSReadiness added in v0.4.71

func GetSystemOSReadiness(ctx echo.Context) error

@Summary whether this machine could be upgraded to the next release of its operating system @Description A report that only reads the machine: the state (ready, attention, blocked, latest, unsupported), the checks by code with their severity, and the same as plain text. It takes up to twenty seconds. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os/readiness [get]

func GetSystemOSRunbook added in v0.4.73

func GetSystemOSRunbook(ctx echo.Context) error

@Summary the text with which to do the hop to the next release of the operating system by hand @Description Written from the plan that is there, for this machine: a shell file of blocks, each to be read and pasted into a console, with its blocks listed. 409 with data.error_code no_plan (data.data.reason: idle, running, failed, expired, blocked) when there is no plan to write it from, no_runbook when the text could not be written safely. With run=current it is the text of the upgrade that is open instead (the one that was written when it began, which does not need the plan to be alive), with from_run true, for the owner who takes the run over: 409 no_run when there is none, run_unreadable when its text cannot be read; any other value of run is a 400. It has what the files of the box say, so the token goes in the Authorization header, and is not the refresh token. @Produce application/json @Tags sys @Security ApiKeyAuth @Param run query string false "current: the text of the upgrade that is open, and not of the plan" @Success 200 {object} model.Result @Failure 400 {object} model.Result "run is asked for and is not current" @Failure 409 {object} model.Result "no plan, or no runbook, or no run: data.error_code says which" @Router /sys/os/upgrade/runbook [get]

func GetSystemOSUpgradeStatus added in v0.4.74

func GetSystemOSUpgradeStatus(ctx echo.Context) error

@Summary how the upgrade of the operating system is going @Description The state of the upgrade that is open or the last that was, as a code the page puts in words (state, reason, cause, class of what stopped it), the block that runs, whether the point of no return is behind it, whether the machine is held (busy), what the owner can do now (actions, which the page shows as they are), the checks that stand before the restart, the findings of the check afterwards, where the owner stands if they take the run over (manual) and the end of the unit's output with the addresses of the sources reduced to their host. It runs no apt and takes no lock of a run: it is safe to ask every few seconds. beta_enabled says whether the switch of the feature is on; the upgrade that is open is told whatever the switch says. @Description last_refresh_at (RFC 3339, UTC) is when the old release was last brought up to date; it is left out when there is no such time or it cannot be read. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/os/upgrade/status [get]

func GetSystemPackageUpdateStatus

func GetSystemPackageUpdateStatus(ctx echo.Context) error

@Summary get operating system package update status @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/packages/update/status [get]

func GetSystemPackageUpdates

func GetSystemPackageUpdates(ctx echo.Context) error

@Summary check for operating system package updates @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/packages [get]

func GetSystemProxy

func GetSystemProxy(ctx echo.Context) error

func GetSystemUtilization

func GetSystemUtilization(ctx echo.Context) error

@Summary system utilization @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/utilization [get]

func GetTelemetry added in v0.4.60

func GetTelemetry(ctx echo.Context) error

GetTelemetry answers whether the anonymous statistics are on, whether the dashboard's notice was seen, and the heartbeat exactly as it would be sent now.

@Summary anonymous statistics: state and preview @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/telemetry [get]

func GetTrash added in v0.4.85

func GetTrash(ctx echo.Context) error

GetTrash lists the trash of every disk, the last deleted first, with the space it takes.

func GetZTIPs

func GetZTIPs() []gjson.Result

func InstallSystemModule added in v0.4.75

func InstallSystemModule(ctx echo.Context) error

@Summary install a module, or update one that is installed @Description Starts the unit that installs the module, for the plan that the user read (plan_id): the plan is made again now and must be the same, and nothing else may be changing the box. The body is strict JSON, {"plan_id": "m1-..."} for an install and {"plan_id": "m1-...", "mode": "update"} for the update of a module that is installed (the plan_id is the one of the plan of that mode, and a mode that is not there is an install), with no field besides them; mode is install or update, any other value is a 400 bad_request (data.data.field is mode). 202 with the status (data.job.kind is install, or update for an update, and data.job.state is running; follow it with GET /sys/modules/{name}/status); 400 bad_request (data.data.field) for a name, a body or a field that is not valid; 409 with data.error_code when it is refused: not_root, unsupported, busy (data.data.reason), plan_changed, plan_timeout, and the codes of the plan's checks (catalogue, os, arch, recasaos, already_installed, foreign_unit, dpkg_state, disk_short, disk_unknown, apt_missing, apt_failed, apt_removes, apt_downgrades, held_package, package_not_exact, with data.data.checks; for an update: catalogue, os, arch, recasaos, not_installed, manifest_invalid, files_unreadable, files_unverified, version_unknown, up_to_date, downgrade, foreign_unit, unit_changed, busy, dpkg_state, disk_short, disk_unknown, apt_missing, apt_failed, apt_removes, apt_downgrades, held_package, package_not_exact); 500 start_failed when the unit could not be started (the log could not be written, systemd did not start it, or /usr/bin/casaos is not a program that can be run): nothing was changed. Every busy carries data.data.reason. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the name, the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: nothing was changed" @Router /sys/modules/{name}/install [post]

func JoinAndUpdateNet

func JoinAndUpdateNet(address, networkId, ip string)

func ListDriverInfo

func ListDriverInfo(ctx echo.Context) error

func ListStorages

func ListStorages(ctx echo.Context) error

func MkdirAll

func MkdirAll(ctx echo.Context) error

@Summary create folder @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path body string true "path of folder" @Success 200 {string} string "ok" @Router /file/mkdir [post]

func NotifyWS

func NotifyWS(ctx echo.Context) error

@Summary websocket 接口,连接成功后发送一个"notify"字符串 @Produce application/json @Accept application/json @Tags notify @Security ApiKeyAuth @Param token path string true "token" @Success 200 {string} string "ok" @Router /notify/ws [get]

func PatchFleetBox added in v0.4.90

func PatchFleetBox(ctx echo.Context) error

PatchFleetBox renames a box or changes its dashboard link.

@Summary fleet: rename a box or change its address @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id} [patch]

func PlanSystemModule added in v0.4.75

func PlanSystemModule(ctx echo.Context) error

@Summary the plan of installing a module, or of updating one that is installed: what the box says of it and what apt would do, with the machine unchanged @Description Runs the module assistant's plan in the core, for at most 60 seconds. The body is optional and, as it always was, ignored when it is not a JSON object or has no "mode" key: that is the plan of an install. {"mode": "update"} is the plan of the update of a module that is installed to the tag the catalogue names; when "mode" is there it is install or update, once, and anything else is a 400 bad_request (data.data.field is mode). The checks of an install in their order (catalogue, os, arch, recasaos, already_installed, foreign_unit, busy, dpkg_state, disk, apt, each with code, ok and detail); those of an update (catalogue, os, arch, recasaos, installed, newer, foreign_unit, busy, dpkg_state, disk, apt), with mode "update" and update (installed and latest tags, added: the packages apt says it would install (those of the new manifest that are not installed), dropped: those it no longer names, which are never removed), and refused with not_installed, manifest_invalid, files_unreadable, files_unverified, version_unknown, up_to_date, downgrade or unit_changed besides the codes of an install; then refused (null, or the code of the first check that failed), the packages apt would install and upgrade with the sizes it gives, the archive, and plan_id, the id that the install or the update must be given back. A plan that is refused is still a plan: 200 with refused set. 400 bad_request (data.data.field is name or mode) for a name or a mode that is not valid; 409 with data.error_code plan_timeout when the plan could not be made in its time. It changes nothing. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 200 {object} model.Result @Failure 400 {object} model.Result "the name is not a module's: data.error_code is bad_request" @Failure 409 {object} model.Result "plan_timeout" @Router /sys/modules/{name}/plan [post]

func PortCheck

func PortCheck(ctx echo.Context) error

@Summary 检查端口是否可用 @Produce application/json @Accept application/json @Tags app @Param port path int true "端口号" @Param type query string true "端口类型 udp/tcp" @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /app/check/{port} [get]

func PostAlertsTest added in v0.4.63

func PostAlertsTest(ctx echo.Context) error

PostAlertsTest sends a test message to channel_id, or to every channel without it, and answers per channel {id, ok, error} once each has answered. An unknown channel_id is a 400.

@Summary push alerts: send a test message @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/alerts/test [post]

func PostCreateFile

func PostCreateFile(ctx echo.Context) error

@Summary create file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path body string true "path of folder (path need to url encode)" @Success 200 {string} string "ok" @Router /file/create [post]

func PostFileOctet

func PostFileOctet(ctx echo.Context) error

func PostFileUpload

func PostFileUpload(ctx echo.Context) error

@Summary upload file @Produce application/json @Accept multipart/form-data @Tags file @Security ApiKeyAuth @Param path formData string false "file path" @Param file formData file true "file" @Success 200 {string} string "ok" @Router /file/upload [post]

func PostFleetBoxCode added in v0.4.90

func PostFleetBoxCode(ctx echo.Context) error

PostFleetBoxCode gives a box a fresh code; the old one stops working.

@Summary fleet: regenerate a box's code @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes/{id}/code [post]

func PostFleetBoxes added in v0.4.90

func PostFleetBoxes(ctx echo.Context) error

PostFleetBoxes enrols a box and hands over its code once. self enrols this box itself.

@Summary fleet: add a box, get its enrolment code @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/boxes [post]

func PostFleetRemoteDevice added in v0.4.96

func PostFleetRemoteDevice(ctx echo.Context) error

PostFleetRemoteDevice gives a one-time code a phone or PC joins the network with.

@Summary fleet: add a phone or PC, get its code @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote/devices [post]

func PostKillCasaOS

func PostKillCasaOS(ctx echo.Context) error

@Summary active killing casaos @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/stop [post]

func PostNotifyMessage

func PostNotifyMessage(ctx echo.Context) error

func PostOperateFileOrDir

func PostOperateFileOrDir(ctx echo.Context) error

@Summary copy or move file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param body body model.FileOperate true "type:move,copy" @Success 200 {string} string "ok" @Router /file/operate [post]

func PostSambaConnectionsCreate

func PostSambaConnectionsCreate(ctx echo.Context) error

func PostSambaSharesCreate

func PostSambaSharesCreate(ctx echo.Context) error

func PostSambaUserCreate

func PostSambaUserCreate(ctx echo.Context) error

PostSambaUserCreate adds an account that can mount protected shares. It has no home directory and no login shell, so it cannot be used to reach the host.

func PostSshLogin

func PostSshLogin(ctx echo.Context) error

func PostSystemStatusNotify

func PostSystemStatusNotify(ctx echo.Context) error

func PutAlerts added in v0.4.63

func PutAlerts(ctx echo.Context) error

PutAlerts sets channels, categories and disk_threshold, each optional; other fields are ignored. channels replaces the list: an entry with an id and no url keeps its stored URL, a new entry needs a url. A URL Shoutrrr cannot parse, an unknown id or a threshold outside 50 to 99 is a 400. It answers the new settings, as GET does.

@Summary push alerts: set the channels, categories and disk threshold @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/alerts [put]

func PutAutoUpdate added in v0.4.62

func PutAutoUpdate(ctx echo.Context) error

PutAutoUpdate sets enabled, window_start and window_end, and resumes a paused release with resume, each optional; other fields are ignored. A window that is not HH:MM, or shorter than an hour, is a 400. It answers the new state, as GET does.

@Summary automatic updates: turn them on or off, set the window, resume @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/autoupdate [put]

func PutFileContent

func PutFileContent(ctx echo.Context) error

@Summary update file @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param path body string true "path" @Param content body string true "content" @Success 200 {string} string "ok" @Router /file/update [put]

func PutFleetMaster added in v0.4.90

func PutFleetMaster(ctx echo.Context) error

PutFleetMaster turns the master role on, or off. On: over the relay given (the dashboard names the official one too), or in advanced mode at an address typed by hand; neither is a 400. Disabling closes every tunnel, forgets the boxes and, over a relay, deletes the fleet there and leaves its network.

@Summary fleet: become the master, or stop being one @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/master [put]

func PutFleetMember added in v0.4.90

func PutFleetMember(ctx echo.Context) error

PutFleetMember joins (or re-joins) a fleet from a pasted code. A box with remote access answers 409 until leave_remote confirms that joining turns it off.

@Summary fleet: join a fleet @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Param code body string true "the code pasted from the master" @Param leave_remote body bool false "confirms that joining turns this box's remote access off" @Success 200 {object} model.Result @Failure 409 {object} model.Result "this box has remote access: send leave_remote true to join anyway" @Router /fleet/member [put]

func PutFleetRelay added in v0.4.93

func PutFleetRelay(ctx echo.Context) error

PutFleetRelay moves the master to another relay: a new fleet there, this box on its network, and every box asked for a new code.

@Summary fleet: change the master's relay @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/relay [put]

func PutFleetRemote added in v0.4.96

func PutFleetRemote(ctx echo.Context) error

PutFleetRemote turns remote access on, over the relay given (the official one when empty), or off.

@Summary fleet: turn remote access on or off @Accept application/json @Produce application/json @Tags fleet @Security ApiKeyAuth @Success 200 {object} model.Result @Router /fleet/remote [put]

func PutNotifyRead

func PutNotifyRead(ctx echo.Context) error

@Summary 标记notify已读 @Produce application/json @Accept application/json @Tags notify @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /notify/read/{id} [put]

func PutSambaShare

func PutSambaShare(ctx echo.Context) error

PutSambaShare sets who may mount an existing share, moving it between guest access and named accounts in either direction, and turns its Time Machine flag on or off. An empty member list makes it a guest share again; a body with a username and no members is what older clients send, and means that one account with write access.

The body replaces all of it, so a client that omits time_machine clears it.

Moving between guest access and accounts re-owns only the shared directory itself, never its contents: files created under a guest share are world-readable, and files created under a protected share stay reachable by root, which is who a guest session maps to. A change from one owning account to another also hands the old owner's files over, in the background after the answer (see moveShareOwnership).

func PutSambaUserPassword

func PutSambaUserPassword(ctx echo.Context) error

PutSambaUserPassword replaces the password of an existing share account.

func PutSambaUserShares added in v0.4.95

func PutSambaUserShares(ctx echo.Context) error

PutSambaUserShares sets which protected shares one account may mount, and whether it may write there: the member's view of the same data the share dialog edits. Shares left out of the list lose the account.

Guest shares are refused rather than quietly protected, and so is a change that would leave a share with nobody at all: an empty "valid users" would let every account in, and turning it back into a guest share would publish a private folder.

func PutStatsAlerts added in v0.4.80

func PutStatsAlerts(ctx echo.Context) error

PutStatsAlerts replaces the rules listed, by key; the others keep theirs. A malformed body, whatever its fault, is bad_rules naming the field.

@Summary statistics: set alert rules of one item @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Param id path string true "item id" @Success 200 {object} model.Result @Router /sys/stats/{id}/alerts [put]

func PutSystemState

func PutSystemState(ctx echo.Context) error

func PutTelemetry added in v0.4.60

func PutTelemetry(ctx echo.Context) error

PutTelemetry sets enabled and notice_seen, each optional; other fields are ignored. It answers the new state, as GET does.

@Summary anonymous statistics: turn them on or off, mark the notice seen @Accept application/json @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/telemetry [put]

func RebootSystemOSUpgrade added in v0.4.74

func RebootSystemOSUpgrade(ctx echo.Context) error

@Summary restart the machine that waits for its restart @Description The owner's click on "restart now". Valid when the machine waits for its restart (awaiting_reboot, reboot_stalled, or a refresh that asks for one), with no unit of the upgrade running, no other package manager at work and, for a hop, what stands before the restart green (asked again now). Works whatever the switch says. The body is {}. 202 with the status (rebooting); 409 with data.error_code: no_run, run_unreadable, not_awaiting_reboot (data.data.state), barrier_failed (data.data.checks), unit_active, dpkg_locked; 500 reboot_failed when systemd would not restart the machine, start_failed when the log of the run could not say that the restart was asked for (nothing was asked), internal for anything else. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the restart was asked for: data is the status" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "reboot_failed" @Router /sys/os/upgrade/reboot [post]

func RemoveSystemModule added in v0.4.75

func RemoveSystemModule(ctx echo.Context) error

@Summary remove a module @Description Starts the unit that removes the module: its unit is stopped and disabled, and exactly the files it put down are deleted, with its manifest. It never purges packages and never touches the module's data. The body is {}. 202 with the status (data.job.kind is remove and data.job.state is running); 400 bad_request for a name or a body that is not valid; 409 with data.error_code when it is refused: not_root, unsupported, busy (data.data.reason), not_installed. 500 start_failed when the unit could not be started (the log could not be written, systemd did not start it, or /usr/bin/casaos is not a program that can be run): nothing was changed. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Param name path string true "the name of the module" @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the name or the body is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: nothing was changed" @Router /sys/modules/{name}/remove [post]

func RenamePath

func RenamePath(ctx echo.Context) error

@Summary rename file or dir @Produce application/json @Accept application/json @Tags file @Security ApiKeyAuth @Param oldpath body string true "path of old" @Param newpath body string true "path of new" @Success 200 {string} string "ok" @Router /file/rename [put]

func RestoreTrash added in v0.4.85

func RestoreTrash(ctx echo.Context) error

RestoreTrash puts items back where they were and answers where they are now (another name when theirs is taken).

func ResumeSystemOSUpgrade added in v0.4.74

func ResumeSystemOSUpgrade(ctx echo.Context) error

@Summary go on with an upgrade that stopped half way @Description The owner's click on "go on": starts a unit of its own that mends what the stop left and runs the blocks that remain. Valid for a run that stopped or was interrupted after its point of no return, for a class of stop that can be gone on from. Works whatever the switch says. The body is {}. 202 with the status; 409 with data.error_code: no_run, run_unreadable, not_resumable (data.data.state, data.data.class), unit_active, busy; 500 start_failed when the unit could not be started, internal for anything else. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "a unit was started: data is the status" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/resume [post]

func SetSystemOSUpgradeBeta added in v0.4.74

func SetSystemOSUpgradeBeta(ctx echo.Context) error

@Summary switch the upgrade of the operating system on or off @Description The owner's switch of the feature, which gates what begins something (a start); what is open goes on whatever it says, so that a machine that is half upgraded is never trapped behind it. Turning it off while a run is open is refused. The same as creating or removing the file /etc/casaos/os-upgrade.beta. 200 with data.beta_enabled; 400 bad_request when enabled is not true or false; 409 run_open (data.data.state, data.data.run_id) when turning it off with a run open. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result "data.beta_enabled is what the switch is now" @Failure 400 {object} model.Result "the body has no enabled, or it is not true or false: data.error_code is bad_request" @Failure 409 {object} model.Result "run_open" @Router /sys/os/upgrade/beta [post]

func StartDockerUpdate added in v0.4.67

func StartDockerUpdate(ctx echo.Context) error

@Summary update the Docker engine, to the plan the check offered @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Failure 400 {object} model.Result "the body is not a plan_id" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 501 {object} model.Result "this host cannot update packages" @Router /sys/docker/update [post]

func StartSystemOSPlan added in v0.4.73

func StartSystemOSPlan(ctx echo.Context) error

@Summary start the plan of the upgrade of the operating system: what apt would do, with the machine unchanged @Description Starts a job that rewrites the sources to the next release in a temporary directory, lets apt plan the upgrade there (a real update of the target's package lists, a simulated transaction) and judges what it says. It changes nothing of the machine. 202 when a job began (data.state is running), 200 when one already runs (data.already_running), 409 with data.error_code (not_root, hop_not_planned, identity_unsupported, busy, no_room) when none can be started. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "a job began" @Success 200 {object} model.Result "a job already runs: data.already_running" @Failure 409 {object} model.Result "refused: data.error_code says why" @Router /sys/os/upgrade/plan [post]

func StartSystemOSUpgrade added in v0.4.74

func StartSystemOSUpgrade(ctx echo.Context) error

@Summary start the upgrade of the operating system, or its rehearsal @Description Starts the unit that runs the blocks of the hop to the next release for the plan that the owner read: its plan_id, what they said stands between them and a machine that does not come back (safety_net: snapshot, console_and_backup or reinstall_ok), the name of the machine typed again (hostname), the removals and the sources put aside that they accepted (accept_removals, paused_sources, as the plan lists them) and the acknowledgements that the plan asks for (acks: no_interruption and no_way_back always, sources_paused when the plan puts sources aside, removals_read when it has removals to accept). With rehearsal true it runs only the half that can be undone, holds the sources of the next release for half an hour and puts the machine back; it needs neither safety_net nor no_way_back. The body is strict JSON with no field besides these. 202 with the status when the unit was started; 400 bad_request (data.data.field) for a body or a field that is not valid; 409 with data.error_code when it is refused (beta_off, not_root, identity_unsupported, hop_not_planned, run_open, manual_run_found, no_plan, plan_changed, plan_blocked, plan_older_than_refresh, bad_safety_net, hostname_mismatch, acks_missing, removals_mismatch, paused_mismatch, sources_changed, readiness_refuses, busy, apps_busy, no_room, runbook_unsafe, runbook_too_large); 500 start_failed when nothing could be started: no unit was started and no package was touched. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: no unit was started and no package was touched" @Router /sys/os/upgrade/start [post]

func StartSystemOSUpgradeRefresh added in v0.4.74

func StartSystemOSUpgradeRefresh(ctx echo.Context) error

@Summary bring the old release up to its last state @Description Starts the unit that brings the release that the machine runs to its last state (apt-get update and apt-get dist-upgrade with the phased updates, removing nothing, with the sources that are not Debian's put aside and put back), which the plan is made after: a plan that was made before it is not good for a start. It has no point of no return: when it stops, the unit puts the sources and the timers back. It ends as refreshed, or as reboot_first when the machine wants a restart (the restart button is then valid). accept_releaseinfo_change, false when it is not said, is the owner's word that a repository whose release information changed (its Origin, Label or Codename: apt of Debian 11 takes a new Suite or Version without a word) is to be taken: a refresh that apt stopped for it is failed with failure.hint releaseinfo_change, and is asked again with it said. A download that got 404 from the security mirror of Debian 11 (security.debian.org, deb.debian.org or an alias) that the refresh did not move to archive.debian.org is failed with class network and failure.hint security_archive_gap. The body is strict JSON with no field besides that. 202 with the status when the unit was started; 400 bad_request (data.data.field) for a body or a field that is not valid; 409 with data.error_code when it is refused (beta_off, not_root, identity_unsupported, hop_not_planned, run_open, manual_run_found, readiness_refuses, busy, apps_busy, no_room, source_unrecognized with data.data.file and line, runbook_unsafe, runbook_too_large); 500 start_failed when nothing could be started: no unit was started and no package was touched. The token goes in the Authorization header, and is not the refresh token. @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 202 {object} model.Result "the unit was started: data is the status" @Failure 400 {object} model.Result "the body or a field is not valid: data.error_code is bad_request" @Failure 409 {object} model.Result "refused: data.error_code says why" @Failure 500 {object} model.Result "start_failed: no unit was started and no package was touched" @Router /sys/os/upgrade/refresh [post]

func StartSystemPackageUpdate

func StartSystemPackageUpdate(ctx echo.Context) error

@Summary start operating system package updates @Produce application/json @Tags sys @Security ApiKeyAuth @Success 200 {object} model.Result @Router /sys/packages/update [post]

func SystemUpdate

func SystemUpdate(ctx echo.Context) error

@Summary 系统信息 @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/update [post]

func UmountStorage

func UmountStorage(ctx echo.Context) error

func WsSsh

func WsSsh(ctx echo.Context) error

func ZerotierProxy

func ZerotierProxy(ctx echo.Context) error

Types

type CenterHandler

type CenterHandler struct {
	// contains filtered or unexported fields
}

type Client

type Client struct {
	ID           string       `json:"id"`
	IP           string       `json:"ip"`
	Name         service.Name `json:"name"`
	RtcSupported bool         `json:"rtcSupported"`
	TimerId      int          `json:"timerId"`
	LastBeat     time.Time    `json:"lastBeat"`
	// contains filtered or unexported fields
}

type FsListResp

type FsListResp struct {
	Content  []ObjResp `json:"content"`
	Total    int64     `json:"total"`
	Readme   string    `json:"readme,omitempty"`
	Write    bool      `json:"write,omitempty"`
	Provider string    `json:"provider,omitempty"`
	Index    int       `json:"index"`
	Size     int       `json:"size"`
}

type ListReq

type ListReq struct {
	model.PageReq
	Path string `json:"path" form:"path"`
}

type ObjResp

type ObjResp struct {
	Name       string                 `json:"name"`
	Size       int64                  `json:"size"`
	IsDir      bool                   `json:"is_dir"`
	Modified   time.Time              `json:"modified"`
	Sign       string                 `json:"sign"`
	Thumb      string                 `json:"thumb"`
	Type       int                    `json:"type"`
	Path       string                 `json:"path"`
	Date       time.Time              `json:"date"`
	Extensions map[string]interface{} `json:"extensions"`
}

type PeerModel

type PeerModel struct {
	ID           string       `json:"id"`
	Name         service.Name `json:"name"`
	RtcSupported bool         `json:"rtcSupported"`
}

Jump to

Keyboard shortcuts

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