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 ¶
- func CheckNetwork()
- func ConnectWebSocket(ctx echo.Context) error
- func CreateNet(address, s, e, c string) string
- func DeleteFile(ctx echo.Context) error
- func DeleteOperateFileOrDir(ctx echo.Context) error
- func DeleteSambaConnections(ctx echo.Context) error
- func DeleteSambaShares(ctx echo.Context) error
- func DeleteSambaUser(ctx echo.Context) error
- func DirPath(ctx echo.Context) error
- func GetAddress() string
- func GetAlerts(ctx echo.Context) error
- func GetAutoUpdate(ctx echo.Context) error
- func GetCasaOSErrorLogs(ctx echo.Context) error
- func GetCasaOSPort(ctx echo.Context) error
- func GetDownloadFile(ctx echo.Context) error
- func GetDownloadSingleFile(ctx echo.Context) error
- func GetFileCount(ctx echo.Context) error
- func GetFileImage(ctx echo.Context) error
- func GetFileUpload(ctx echo.Context) error
- func GetFilerContent(ctx echo.Context) error
- func GetLocalFile(ctx echo.Context) error
- func GetPeers(ctx echo.Context) error
- func GetPort(ctx echo.Context) error
- func GetRecoverStorage(ctx echo.Context) error
- func GetSambaConnectionsList(ctx echo.Context) error
- func GetSambaSharesList(ctx echo.Context) error
- func GetSambaStatus(ctx echo.Context) error
- func GetSambaUsersList(ctx echo.Context) error
- func GetSearchResult(ctx echo.Context) error
- func GetSize(ctx echo.Context) error
- func GetStorage(ctx echo.Context) error
- func GetSystemCheckVersion(ctx echo.Context) error
- func GetSystemConfigDebug(ctx echo.Context) error
- func GetSystemCupInfo(ctx echo.Context) error
- func GetSystemDiskInfo(ctx echo.Context) error
- func GetSystemEntry(ctx echo.Context) error
- func GetSystemHardwareInfo(ctx echo.Context) error
- func GetSystemMemInfo(ctx echo.Context) error
- func GetSystemNetInfo(ctx echo.Context) error
- func GetSystemPackageUpdateStatus(ctx echo.Context) error
- func GetSystemPackageUpdates(ctx echo.Context) error
- func GetSystemProxy(ctx echo.Context) error
- func GetSystemUtilization(ctx echo.Context) error
- func GetTelemetry(ctx echo.Context) error
- func GetZTIPs() []gjson.Result
- func JoinAndUpdateNet(address, networkId, ip string)
- func ListDriverInfo(ctx echo.Context) error
- func ListStorages(ctx echo.Context) error
- func MkdirAll(ctx echo.Context) error
- func NotifyWS(ctx echo.Context) error
- func PortCheck(ctx echo.Context) error
- func PostAlertsTest(ctx echo.Context) error
- func PostCreateFile(ctx echo.Context) error
- func PostFileOctet(ctx echo.Context) error
- func PostFileUpload(ctx echo.Context) error
- func PostKillCasaOS(ctx echo.Context) error
- func PostNotifyMessage(ctx echo.Context) error
- func PostOperateFileOrDir(ctx echo.Context) error
- func PostSambaConnectionsCreate(ctx echo.Context) error
- func PostSambaSharesCreate(ctx echo.Context) error
- func PostSambaUserCreate(ctx echo.Context) error
- func PostSshLogin(ctx echo.Context) error
- func PostSystemStatusNotify(ctx echo.Context) error
- func PutAlerts(ctx echo.Context) error
- func PutAutoUpdate(ctx echo.Context) error
- func PutCasaOSPort(ctx echo.Context) error
- func PutFileContent(ctx echo.Context) error
- func PutNotifyRead(ctx echo.Context) error
- func PutSambaShare(ctx echo.Context) error
- func PutSambaUserPassword(ctx echo.Context) error
- func PutSystemState(ctx echo.Context) error
- func PutTelemetry(ctx echo.Context) error
- func RenamePath(ctx echo.Context) error
- func StartSystemPackageUpdate(ctx echo.Context) error
- func SystemUpdate(ctx echo.Context) error
- func UmountStorage(ctx echo.Context) error
- func WsSsh(ctx echo.Context) error
- func ZerotierProxy(ctx echo.Context) error
- type CenterHandler
- type Client
- type FsListResp
- type ListReq
- type ObjResp
- type PeerModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckNetwork ¶
func CheckNetwork()
func ConnectWebSocket ¶
func DeleteFile ¶
@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"]" @Success 200 {string} string "ok" @Router /file/delete [delete]
func DeleteOperateFileOrDir ¶
func DeleteSambaConnections ¶
func DeleteSambaShares ¶
func DeleteSambaUser ¶
DeleteSambaUser removes a share account, refusing while any share still names it. Removing it anyway would leave those shares listing 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 DirPath ¶
@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 GetAddress ¶
func GetAddress() string
func GetAlerts ¶ added in v0.4.63
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
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 ¶
@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 ¶
@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 GetDownloadFile ¶
@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 GetFileCount ¶
func GetFileImage ¶
@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 GetFileUpload ¶
@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 ¶
@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 GetLocalFile ¶
func GetPort ¶
@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 GetSambaSharesList ¶
func GetSambaStatus ¶
func GetSambaUsersList ¶
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 GetStorage ¶
func GetSystemCheckVersion ¶
@Summary check version @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/version/check [get]
func GetSystemCupInfo ¶
@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 ¶
@Summary get disk info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/disk [get]
func GetSystemEntry ¶
func GetSystemHardwareInfo ¶
@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 ¶
@Summary get mem info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/mem [get]
func GetSystemNetInfo ¶
@Summary get Net info @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/net [get]
func GetSystemPackageUpdateStatus ¶
@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 ¶
@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 GetSystemUtilization ¶
@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
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 JoinAndUpdateNet ¶
func JoinAndUpdateNet(address, networkId, ip string)
func ListDriverInfo ¶
func ListStorages ¶
func MkdirAll ¶
@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 ¶
@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 PortCheck ¶
@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
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 ¶
@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 PostFileUpload ¶
@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 PostKillCasaOS ¶
@Summary active killing casaos @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/restart [post]
func PostNotifyMessage ¶
func PostOperateFileOrDir ¶
@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 PostSambaSharesCreate ¶
func PostSambaUserCreate ¶
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 PostSystemStatusNotify ¶
func PutAlerts ¶ added in v0.4.63
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
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 PutCasaOSPort ¶
@Summary edit casaos server port @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Param port json string true "port" @Success 200 {string} string "ok" @Router /sys/port [put]
func PutFileContent ¶
@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 PutNotifyRead ¶
@Summary 标记notify已读 @Produce application/json @Accept application/json @Tags notify @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /notify/read/{id} [put]
func PutSambaShare ¶
PutSambaShare moves an existing share between guest access and a named account, in either direction, and turns its Time Machine flag on or off. An empty username makes it a guest share again.
The body replaces both fields, so a client that omits time_machine clears it.
Only the shared directory itself is re-owned, never its contents. A media share can hold millions of files and walking them inside an HTTP request is not something a NAS should be asked to do. It is not needed either: 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.
func PutSambaUserPassword ¶
PutSambaUserPassword replaces the password of an existing share account.
func PutSystemState ¶
func PutTelemetry ¶ added in v0.4.60
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 RenamePath ¶
@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 StartSystemPackageUpdate ¶
@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 ¶
@Summary 系统信息 @Produce application/json @Accept application/json @Tags sys @Security ApiKeyAuth @Success 200 {string} string "ok" @Router /sys/update [post]
func UmountStorage ¶
func ZerotierProxy ¶
Types ¶
type CenterHandler ¶
type CenterHandler struct {
// contains filtered or unexported fields
}
type FsListResp ¶
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"`
}