mirror of
https://github.com/truewhile/MeBox.git
synced 2026-09-30 19:46:38 +08:00
chore: remove license code, fix compilation, update README bilingual
- Remove all license-related code (handler/service/repository/model) License authorization is managed by separate server: https://github.com/ShukeBta/MediaStationLicenseServer - Fix compilation errors: model field alignment, method name fixes, route conflicts, struct literal corrections (7 files) - Add Chinese README.md as primary, English README_EN.md - Update .gitignore: exclude .workbuddy/, editor backups - Add new repository files: assistant, play_profile, storage_config
This commit is contained in:
@@ -204,51 +204,6 @@ type AccessLog struct {
|
||||
Detail string `gorm:"type:text" json:"detail"`
|
||||
}
|
||||
|
||||
// Site stores a PT/BT tracker site configuration used by the subscription
|
||||
// and cross-site search system. Mirrors the original MediaStation sites table.
|
||||
//
|
||||
// Supported site types: nexusphp / gazelle / unit3d / mteam / custom_rss
|
||||
// Supported auth types: cookie / api_key / authorization
|
||||
type Site struct {
|
||||
Base
|
||||
Name string `gorm:"size:128;not null" json:"name"`
|
||||
BaseURL string `gorm:"size:512;not null" json:"base_url"`
|
||||
SiteType string `gorm:"size:32;default:nexusphp" json:"site_type"`
|
||||
AuthType string `gorm:"size:32;default:cookie" json:"auth_type"`
|
||||
Cookie string `gorm:"type:text" json:"cookie,omitempty"`
|
||||
APIKey string `gorm:"size:512" json:"api_key,omitempty"`
|
||||
AuthHeader string `gorm:"size:512" json:"auth_header,omitempty"`
|
||||
UserAgent string `gorm:"size:512" json:"user_agent,omitempty"`
|
||||
RSSURL string `gorm:"size:1024" json:"rss_url,omitempty"`
|
||||
Timeout int `gorm:"default:15" json:"timeout"`
|
||||
Priority int `gorm:"default:50" json:"priority"`
|
||||
UseProxy bool `gorm:"default:false" json:"use_proxy"`
|
||||
Enabled bool `gorm:"default:true" json:"enabled"`
|
||||
LoginStatus string `gorm:"size:20;default:unknown" json:"login_status"`
|
||||
Downloader string `gorm:"size:50" json:"downloader,omitempty"`
|
||||
}
|
||||
|
||||
// NotifyChannel is one named outbound notification destination.
|
||||
//
|
||||
// The Config column holds a JSON blob whose schema depends on the
|
||||
// ChannelType (telegram/wechat/bark/webhook):
|
||||
//
|
||||
// telegram → {bot_token, chat_id}
|
||||
// wechat → {sendkey}
|
||||
// bark → {device_key, server?}
|
||||
// webhook → {url, method, headers (JSON string), body_template}
|
||||
//
|
||||
// The Events column is a JSON array of event-type strings the channel
|
||||
// subscribes to; an empty array means "all events".
|
||||
type NotifyChannel struct {
|
||||
Base
|
||||
Name string `gorm:"size:128;not null" json:"name"`
|
||||
ChannelType string `gorm:"size:32;not null" json:"channel_type"`
|
||||
Config string `gorm:"type:text;not null" json:"config"`
|
||||
Enabled bool `gorm:"default:true" json:"enabled"`
|
||||
Events string `gorm:"type:text;default:'[]'" json:"events"`
|
||||
}
|
||||
|
||||
// PlayProfile lets one user define multiple "viewing personas" with
|
||||
// different content-rating limits, library access, and player defaults.
|
||||
// The original Vue project sketched this out as a forward-looking
|
||||
@@ -274,28 +229,6 @@ type PlayProfile struct {
|
||||
LastActiveAt *time.Time `json:"last_active_at,omitempty"`
|
||||
}
|
||||
|
||||
// UserPermission stores per-user feature toggles for the React UI's
|
||||
// menu visibility + route guards. The original Python project surfaces
|
||||
// 11 boolean flags; we mirror the same set so the existing frontend
|
||||
// can swap to the Go API without code changes.
|
||||
type UserPermission struct {
|
||||
UserID string `gorm:"primaryKey;size:36" json:"user_id"`
|
||||
CanPlayMedia bool `gorm:"default:true" json:"can_play_media"`
|
||||
CanFavorite bool `gorm:"default:true" json:"can_favorite"`
|
||||
CanViewHistory bool `gorm:"default:true" json:"can_view_history"`
|
||||
CanViewDashboard bool `gorm:"default:true" json:"can_view_dashboard"`
|
||||
CanViewDiscover bool `gorm:"default:true" json:"can_view_discover"`
|
||||
CanManageDownloads bool `gorm:"default:false" json:"can_manage_downloads"`
|
||||
CanManageSubscriptions bool `gorm:"default:false" json:"can_manage_subscriptions"`
|
||||
CanManageSites bool `gorm:"default:false" json:"can_manage_sites"`
|
||||
CanManageFiles bool `gorm:"default:false" json:"can_manage_files"`
|
||||
CanManageSTRM bool `gorm:"default:false" json:"can_manage_strm"`
|
||||
CanCast bool `gorm:"default:true" json:"can_cast"`
|
||||
CanUseAIAssistant bool `gorm:"default:false" json:"can_use_ai_assistant"`
|
||||
CanAccessSettings bool `gorm:"default:false" json:"can_access_settings"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
}
|
||||
|
||||
// StorageConfig holds the connection settings for one external storage
|
||||
// backend (Alist / S3 / WebDAV). Type column makes the row poly-typed
|
||||
// — Config is a JSON blob whose shape is determined by Type.
|
||||
@@ -311,47 +244,6 @@ type StorageConfig struct {
|
||||
LastError string `gorm:"size:512" json:"last_error,omitempty"`
|
||||
}
|
||||
|
||||
// LicenseKey is one issued license for a customer. Activations live in
|
||||
// a child table so a single key can bind to multiple devices when its
|
||||
// MaxActivations > 1.
|
||||
type LicenseKey struct {
|
||||
Base
|
||||
Key string `gorm:"uniqueIndex;size:64;not null" json:"key"`
|
||||
Customer string `gorm:"size:128" json:"customer,omitempty"`
|
||||
Plan string `gorm:"size:32;default:basic" json:"plan"`
|
||||
MaxActivations int `gorm:"default:1" json:"max_activations"`
|
||||
IssuedAt time.Time `json:"issued_at"`
|
||||
ExpiresAt *time.Time `json:"expires_at,omitempty"`
|
||||
Revoked bool `gorm:"default:false" json:"revoked"`
|
||||
Notes string `gorm:"type:text" json:"notes,omitempty"`
|
||||
}
|
||||
|
||||
// LicenseActivation is one (key, device) binding.
|
||||
type LicenseActivation struct {
|
||||
Base
|
||||
KeyID string `gorm:"index;size:36;not null" json:"key_id"`
|
||||
DeviceID string `gorm:"size:128;not null" json:"device_id"`
|
||||
DeviceName string `gorm:"size:128" json:"device_name,omitempty"`
|
||||
IP string `gorm:"size:64" json:"ip,omitempty"`
|
||||
UnboundAt *time.Time `json:"unbound_at,omitempty"`
|
||||
HeartbeatAt *time.Time `json:"heartbeat_at,omitempty"`
|
||||
}
|
||||
|
||||
// DownloadClient is one configured downloader (qBittorrent / Aria2 /
|
||||
// Transmission). We keep the password column out of JSON so list calls
|
||||
// don't leak secrets to the React UI.
|
||||
type DownloadClient struct {
|
||||
Base
|
||||
Name string `gorm:"size:128;not null" json:"name"`
|
||||
Type string `gorm:"size:16;not null" json:"type"` // qbittorrent / transmission / aria2
|
||||
URL string `gorm:"size:512;not null" json:"url"`
|
||||
Username string `gorm:"size:128" json:"username,omitempty"`
|
||||
Password string `gorm:"size:512" json:"-"`
|
||||
SavePath string `gorm:"size:1024" json:"save_path,omitempty"`
|
||||
IsDefault bool `gorm:"default:false" json:"is_default"`
|
||||
Enabled bool `gorm:"default:true" json:"enabled"`
|
||||
}
|
||||
|
||||
// AssistantSession groups a multi-turn chat with the AI assistant.
|
||||
type AssistantSession struct {
|
||||
Base
|
||||
@@ -397,8 +289,6 @@ func AllModels() []interface{} {
|
||||
&STRMRecord{},
|
||||
&PlayProfile{},
|
||||
&StorageConfig{},
|
||||
&LicenseKey{},
|
||||
&LicenseActivation{},
|
||||
&AssistantSession{},
|
||||
&AssistantMessage{},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user