1
0
mirror of https://github.com/IceWhaleTech/CasaOS.git synced 2025-07-06 23:37:26 +02:00
Files
CasaOS/model/manifest.go

131 lines
3.6 KiB
Go
Raw Normal View History

2021-09-26 10:35:02 +08:00
package model
import (
"database/sql/driver"
"encoding/json"
)
type TcpPorts struct {
Desc string `json:"desc"`
ContainerPort int `json:"container_port"`
}
type UdpPorts struct {
Desc string `json:"desc"`
ContainerPort int `json:"container_port"`
}
/*******************使用gorm支持json************************************/
type PortMap struct {
ContainerPort string `json:"container"`
CommendPort string `json:"host"`
2021-09-26 10:35:02 +08:00
Protocol string `json:"protocol"`
Desc string `json:"desc"`
Type int `json:"type"`
2021-09-26 10:35:02 +08:00
}
type PortArray []PortMap
2021-09-26 10:35:02 +08:00
// Value 实现方法
func (p PortArray) Value() (driver.Value, error) {
2021-09-26 10:35:02 +08:00
return json.Marshal(p)
}
// Scan 实现方法
func (p *PortArray) Scan(input interface{}) error {
2021-09-26 10:35:02 +08:00
return json.Unmarshal(input.([]byte), p)
}
/************************************************************************/
/*******************使用gorm支持json************************************/
type Env struct {
Name string `json:"container"`
Value string `json:"host"`
Desc string `json:"desc"`
Type int `json:"type"`
2021-09-26 10:35:02 +08:00
}
type JSON json.RawMessage
type EnvArray []Env
2021-09-26 10:35:02 +08:00
// Value 实现方法
func (p EnvArray) Value() (driver.Value, error) {
2021-09-26 10:35:02 +08:00
return json.Marshal(p)
//return .MarshalJSON()
}
// Scan 实现方法
func (p *EnvArray) Scan(input interface{}) error {
2021-09-26 10:35:02 +08:00
return json.Unmarshal(input.([]byte), p)
}
/************************************************************************/
/*******************使用gorm支持json************************************/
type PathMap struct {
ContainerPath string `json:"container"`
Path string `json:"host"`
Type int `json:"type"`
Desc string `json:"desc"`
2021-09-26 10:35:02 +08:00
}
type PathArray []PathMap
2021-09-26 10:35:02 +08:00
// Value 实现方法
func (p PathArray) Value() (driver.Value, error) {
2021-09-26 10:35:02 +08:00
return json.Marshal(p)
}
// Scan 实现方法
func (p *PathArray) Scan(input interface{}) error {
2021-09-26 10:35:02 +08:00
return json.Unmarshal(input.([]byte), p)
}
/************************************************************************/
//type PostData struct {
// Envs EnvArrey `json:"envs,omitempty"`
// Udp PortArrey `json:"udp_ports"`
// Tcp PortArrey `json:"tcp_ports"`
// Volumes PathArrey `json:"volumes"`
// Devices PathArrey `json:"devices"`
// Port string `json:"port,omitempty"`
// PortMap string `json:"port_map"`
// CpuShares int64 `json:"cpu_shares,omitempty"`
// Memory int64 `json:"memory,omitempty"`
// Restart string `json:"restart,omitempty"`
// EnableUPNP bool `json:"enable_upnp"`
// Label string `json:"label"`
// Position bool `json:"position"`
//}
type CustomizationPostData struct {
✨ New Feature - [Apps] This is a feature that has been highly requested by the community. Import the original Docker application into CasaOS. Now it's easy to import with just a few clicks! - [Apps] App list supports a custom sorting function! You can arrange apps in different orders by dragging the icons. - [Apps] App custom installation supports Docker Compose configuration import in YAML format. - [Files] Added thumbnail preview function for image files. - [Connect] Multiple CasaConenct devices in the LAN will be transmitted through the LAN network. - [System] Added a switch for auto-mounting USB disk devices. 🎈 Enhancement - [System] Optimized the system update alert, you will see the new version update log from the next version. - [Apps] Added live preview for icons in custom installed apps. - [Apps] Optimized the input of WebUI. - [Files] Completely updated the image preview, now it supports switching all images in the same folder, as well as dragging, zooming, rotating and resetting. - [Widgets] Added color levels for CPU and RAM charts. - [Conenct] Optimized the display of the right-click menu of the Connect friends list. 🎈 Changed - [Files] Change the initial display directory to /DATA 🐞 Fixed - [System] Fixed an issue with Raspberry Pi devices failing to boot using USB disks. (Achieved by disabling USB disk auto-mount) - [Apps] Fixed the issue that some Docker CLI commands failed to import. - [Apps] Fixed the issue that the app is not easily recognized in /DATA/AppData directory and docker command line after installation, it will be shown as the app name. (Newly installed apps only) - [Apps] Fixed the issue that Pi-hole cannot be launched after installation in the app store. - [Apps] Fixed the issue that apps cannot be updated with WatchTower. - [Files] Fixed the issue that when there is an upload task, the task status is lost after closing Files.
2022-05-13 18:12:26 +08:00
CustomId string `json:"custom_id"`
2021-09-26 10:35:02 +08:00
Origin string `json:"origin"`
NetworkModel string `json:"network_model"`
Index string `json:"index"`
Icon string `json:"icon"`
Image string `json:"image"`
Envs EnvArray `json:"envs"`
Ports PortArray `json:"ports"`
Volumes PathArray `json:"volumes"`
Devices PathArray `json:"devices"`
2021-09-26 10:35:02 +08:00
//Port string `json:"port,omitempty"`
2022-02-17 18:43:25 +08:00
PortMap string `json:"port_map"`
CpuShares int64 `json:"cpu_shares"`
Memory int64 `json:"memory"`
Restart string `json:"restart"`
EnableUPNP bool `json:"enable_upnp"`
Label string `json:"label"`
Description string `json:"description"`
Position bool `json:"position"`
HostName string `json:"host_name"`
Privileged bool `json:"privileged"`
CapAdd []string `json:"cap_add"`
Cmd []string `json:"cmd"`
2021-09-26 10:35:02 +08:00
}