constants

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusCode200Color = ColorGreen  // HTTP 200 成功响应颜色
	StatusCode300Color = ColorGray   // HTTP 300 重定向颜色
	StatusCode400Color = ColorYellow // HTTP 400 客户端错误颜色
	StatusCode500Color = ColorRed    // HTTP 500 服务器错误颜色
)

HTTP 状态码对应颜色

View Source
const (
	MethodGetColor     = ColorBlue   // GET 方法颜色
	MethodPostColor    = ColorCyan   // POST 方法颜色
	MethodPutColor     = ColorYellow // PUT 方法颜色
	MethodPatchColor   = ColorGreen  // PATCH 方法颜色
	MethodDeleteColor  = ColorRed    // DELETE 方法颜色
	MethodHeadColor    = ColorPurple // HEAD 方法颜色
	MethodOptionsColor = ColorGray   // OPTIONS 方法颜色
)

HTTP 方法对应颜色

View Source

Variables

View Source
var EmbyRegexp = &EmbyRegexps{
	Router: RouterRegexps{
		VideosHandler:        regexp.MustCompile(`(?i)^(/emby)?/Videos/\d+/(stream|original)(\.\w+)?$`),
		ModifyBaseHtmlPlayer: regexp.MustCompile(`(?i)^/web/modules/htmlvideoplayer/basehtmlplayer.js$`),
		ModifyIndex:          regexp.MustCompile(`^/web/index.html$`),
		ModifyPlaybackInfo:   regexp.MustCompile(`(?i)^(/emby)?/Items/\d+/PlaybackInfo$`),
		ModifySubtitles:      regexp.MustCompile(`(?i)^(/emby)?/Videos/\d+/\w+/subtitles$`),
	},
	Others: OthersRegexps{
		VideoRedirectReg: regexp.MustCompile(`(?i)^(/emby)?/videos/(.*)/stream/(.*)`),
	},

	Cache: CacheRegexps{
		Image:    regexp.MustCompile(`(?i)^(/emby)?/Items/\d+/Images(/.*)?$`),
		Subtitle: regexp.MustCompile(`(?i)/Videos/(.*)/Subtitles/(.*)/Stream\.(ass|ssa|srt|)?$`),
	},
}
View Source
var FNTVRegexp = &FNTVRouterRegexps{
	StreamHandler: regexp.MustCompile(`^/v/api/v1/stream$`),
	Cache: CacheRegexps{
		Image:    regexp.MustCompile(`^/v/api/v1/sys/img/[\d\w]{2}/[\d\w]{2}/[\d\w]+\.[\d\w]+$`),
		Subtitle: regexp.MustCompile(`^/v/api/v1/subtitle/dl/[\d\w]+$`),
	},
}
View Source
var InvalidMediaServerErr = errors.New("invalid  MediaServerType")
View Source
var JellyfinRegexp = &JellyfinRegexps{
	Router: JellyfinRouterRegexps{
		VideosHandler:      regexp.MustCompile(`/Videos/[\w-]+/(stream|original)(\.\w+)?$`),
		ModifyIndex:        regexp.MustCompile(`^/web/$`),
		ModifyPlaybackInfo: regexp.MustCompile(`^/Items/\w+/PlaybackInfo$`),
		ModifySubtitles:    regexp.MustCompile(`/Videos/\d+/\w+/subtitles$`),
	},
	Cache: CacheRegexps{

		Image: regexp.MustCompile(`(?i)/Items/\w+/Images(/.*)?$`),

		Subtitle: regexp.MustCompile(`(?i)/Videos/(.*)/Subtitles/(.*)/Stream\.(ass|ssa|srt|)?$`),
	},
}

Functions

This section is empty.

Types

type CacheRegexps

type CacheRegexps struct {
	Image    *regexp.Regexp // 图片缓存匹配
	Subtitle *regexp.Regexp // 字幕缓存匹配
}

type Color

type Color uint8
const (
	ColorBlack  Color = iota // 黑色
	ColorRed                 // 红色
	ColorGreen               // 绿色
	ColorYellow              // 黄色
	ColorBlue                // 蓝色
	ColorPurple              // 紫色
	ColorCyan                // 青色
	ColorGray                // 灰色
)

基础颜色枚举

func (Color) ColorBackground

func (c Color) ColorBackground(s string) string

func (Color) ColorString

func (c Color) ColorString(s string) string

type EmbyRegexps

type EmbyRegexps struct {
	Router RouterRegexps
	Others OthersRegexps
	Cache  CacheRegexps
}

type FNTVRouterRegexps

type FNTVRouterRegexps struct {
	StreamHandler *regexp.Regexp
	Cache         CacheRegexps
}

飞牛影视媒体服务器正则表达式

type FliterMode

type FliterMode uint8
const (
	WHITELIST FliterMode = iota
	BLACKLIST
)

func (FliterMode) MarshalJSON

func (f FliterMode) MarshalJSON() ([]byte, error)

func (FliterMode) MarshalText

func (f FliterMode) MarshalText() ([]byte, error)

func (FliterMode) MarshalYAML

func (f FliterMode) MarshalYAML() (any, error)

func (FliterMode) String

func (f FliterMode) String() string

func (*FliterMode) UnmarshalJSON

func (f *FliterMode) UnmarshalJSON(data []byte) error

func (*FliterMode) UnmarshalText

func (f *FliterMode) UnmarshalText(text []byte) error

func (*FliterMode) UnmarshalYAML

func (f *FliterMode) UnmarshalYAML(value *yaml.Node) error

type JellyfinRegexps

type JellyfinRegexps struct {
	Router JellyfinRouterRegexps
	Cache  CacheRegexps
}

type JellyfinRouterRegexps

type JellyfinRouterRegexps struct {
	VideosHandler      *regexp.Regexp // 普通视频处理接口匹配
	ModifyIndex        *regexp.Regexp // Web 首页
	ModifyPlaybackInfo *regexp.Regexp // 播放信息处理接口
	ModifySubtitles    *regexp.Regexp // 字幕处理接口
}

type MediaServerType

type MediaServerType uint8 // 媒体服务器类型
const (
	EMBY     MediaServerType = iota // 媒体服务器类型:EmbyServer
	JELLYFIN                        // 媒体服务器类型:Jellyfin
	PLEX                            // 媒体服务器类型:Plex
	FNTV                            // 媒体服务器类型:飞牛影视
)

func (MediaServerType) String

func (m MediaServerType) String() string

func (*MediaServerType) UnMarshalJSON

func (m *MediaServerType) UnMarshalJSON(data []byte) error

func (*MediaServerType) UnmarshalYAML

func (m *MediaServerType) UnmarshalYAML(value *yaml.Node) error

type OthersRegexps

type OthersRegexps struct {
	VideoRedirectReg *regexp.Regexp // 视频重定向匹配,统一视频请求格式
}

type ReferrerPolicy

type ReferrerPolicy string

ReferrerPolicy 定义 HTTP Referer 策略类型

const (
	NoReferrer                  ReferrerPolicy = "no-referrer"                     // 不发送 Referer 头部
	NoReferrerWhenDowngrade     ReferrerPolicy = "no-referrer-when-downgrade"      // 从 HTTPS 到 HTTP 时不发送
	Origin                      ReferrerPolicy = "origin"                          // 跨域发送域名,同域发送完整 URL
	OriginWhenCrossOrigin       ReferrerPolicy = "origin-when-cross-origin"        // 跨域仅发送域名
	SameOrigin                  ReferrerPolicy = "same-origin"                     // 仅同域发送
	StrictOrigin                ReferrerPolicy = "strict-origin"                   // HTTPS 到 HTTPS 时发送域名
	StrictOriginWhenCrossOrigin ReferrerPolicy = "strict-origin-when-cross-origin" // 跨域发送域名,同域完整 URL(仅 HTTPS)
	UnsafeURL                   ReferrerPolicy = "unsafe-url"                      // 始终发送完整 URL
)

type RouterRegexps

type RouterRegexps struct {
	VideosHandler        *regexp.Regexp // 普通视频处理接口匹配
	ModifyBaseHtmlPlayer *regexp.Regexp // 修改 Web 的 basehtmlplayer.js
	ModifyIndex          *regexp.Regexp // Web 首页
	ModifyPlaybackInfo   *regexp.Regexp // 播放信息处理接口
	ModifySubtitles      *regexp.Regexp // 字幕处理接口
}

type StrmFileType

type StrmFileType uint8 // Strm 文件类型
const (
	UnknownStrm StrmFileType = iota
	HTTPStrm
	AlistStrm
)

func (StrmFileType) String

func (s StrmFileType) String() string

Jump to

Keyboard shortcuts

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