repository

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package repository holds all interfaces and shared struct

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API added in v0.0.8

type API interface {
	Stats(http.ResponseWriter, StatsSummary)
}

API holds all function for api

type Collection added in v0.0.8

type Collection interface {
	Load()
	OnConfigUpdate(Config)
	Filter(string) GameType
	RemoveGame(string)
	CountGames() int
	AddNewGames([]FileDesc)
	Library() map[string]TitleDBEntry
	HasGameIDInLibrary(string) bool
	IsBaseGame(string) bool
	Games() GameType
	GetKey(string) (string, error)
	ResetGamesCollection()
}

Collection describes all information about collection

type Config

type Config interface {
	RootShop() string
	SetRootShop(string)
	Host() string
	Protocol() string
	Port() int
	ReverseProxy() bool
	WelcomeMessage() string
	NoWelcomeMessage() bool

	DebugNfs() bool
	DebugNoSecurity() bool
	DebugTicket() bool

	Sources() ConfigSources
	Directories() []string
	NfsShares() []string
	ShopTitle() string
	ShopTemplateData() ShopTemplate
	SetShopTemplateData(ShopTemplate)

	ForwardAuthURL() string
	IsBlacklisted(string) bool
	IsWhitelisted(string) bool
	IsBannedTheme(string) bool
	BannedTheme() []string

	CustomDB() map[string]TitleDBEntry
	VerifyNSP() bool

	AddHook(f func(Config))
	AddBeforeHook(f func(Config))
	LoadConfig()
}

Config interface

type ConfigSources added in v0.0.8

type ConfigSources struct {
	Directories []string `mapstructure:"directories"`
	Nfs         []string `mapstructure:"nfs"`
}

ConfigSources describe all sources type handled

type FileDesc

type FileDesc struct {
	GameID    string
	Size      int64
	GameInfo  string
	Path      string
	Extension string
	HostType  HostType
}

FileDesc structure

type GameFileType

type GameFileType struct {
	Size int64  `json:"size"`
	URL  string `json:"url"`
}

GameFileType stores the fields needed for game files

type GameID

type GameID interface {
	FullID() string
	ShortID() string
	Extension() string
}

GameID interface

type GameType

type GameType struct {
	Success        string                  `json:"success,omitempty"`
	Titledb        map[string]TitleDBEntry `json:"titledb"`
	Files          []GameFileType          `json:"files"`
	ThemeBlackList []string                `json:"themeBlackList,omitempty"`
}

GameType structure

type HostType

type HostType string

HostType new typed string

const (
	// LocalFile Describe local directory file
	LocalFile HostType = "localFile"
	// NFSShare Describe nfs directory file
	NFSShare HostType = "NFS"
)

type NInt added in v0.0.7

type NInt int

NInt is a nullable int

func (*NInt) UnmarshalJSON added in v0.0.7

func (n *NInt) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON handles unmarshalling null int

type NString added in v0.0.7

type NString string

NString is a nullable string

func (*NString) UnmarshalJSON added in v0.0.7

func (n *NString) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON handles unmarshalling null string

type Shop added in v0.0.8

type Shop struct {
	Collection Collection
	Sources    Sources
	Config     Config
	Stats      Stats
	API        API
}

Shop holds all tinshop information

type ShopTemplate

type ShopTemplate struct {
	ShopTitle string
}

ShopTemplate contains all variables used for shop template

type Source added in v0.0.7

type Source interface {
	Load([]string, bool)
	Download(http.ResponseWriter, *http.Request, string, string)
	UnWatchAll()
	Reset()
	GetFiles() []FileDesc
}

Source describes the common functions for Sources

type Sources

type Sources interface {
	OnConfigUpdate(Config)
	BeforeConfigUpdate(Config)
	GetFiles() []FileDesc
	HasGame(string) bool
	DownloadGame(string, http.ResponseWriter, *http.Request)
}

Sources describes all function to handle all sources

type Stats added in v0.0.8

type Stats interface {
	Load()
	Close() error
	ListVisit(*Switch) error
	DownloadAsked(string, string) error
	Summary() (StatsSummary, error)
}

Stats holds all information about statistics

type StatsSummary added in v0.0.8

type StatsSummary struct {
	Visit           uint64                 `json:"visit,omitempty"`
	UniqueSwitch    uint64                 `json:"uniqueSwitch,omitempty"`
	VisitPerSwitch  map[string]interface{} `json:"visitPerSwitch,omitempty"`
	DownloadAsked   uint64                 `json:"downloadAsked,omitempty"`
	DownloadDetails map[string]interface{} `json:"downloadDetails,omitempty"`
}

StatsSummary holds all information about tinshop

type Switch added in v0.0.8

type Switch struct {
	IP       string
	UID      string
	Theme    string
	Version  string
	Language string
}

Switch holds all information about the switch

type TitleDBEntry added in v0.0.6

type TitleDBEntry struct {
	ID              string   `mapstructure:"id" json:"id"`
	RightsID        string   `mapstructure:"rightsId" json:"rightsId,omitempty"`
	Name            string   `mapstructure:"name" json:"name,omitempty"`
	Version         NInt     `mapstructure:"version" json:"version,omitempty"`
	Key             NString  `mapstructure:"key" json:"key,omitempty"`
	IsDemo          bool     `mapstructure:"isDemo" json:"isDemo,omitempty"`
	Region          string   `mapstructure:"region" json:"region,omitempty"`
	Regions         []string `mapstructure:"regions" json:"regions,omitempty"`
	ReleaseDate     int      `mapstructure:"releaseDate" json:"releaseDate,omitempty"`
	NsuID           uint64   `mapstructure:"nsuId" json:"nsuId,omitempty"`
	Category        []string `mapstructure:"category" json:"category,omitempty"`
	RatingContent   []string `mapstructure:"ratingContent" json:"ratingContent,omitempty"`
	NumberOfPlayers int      `mapstructure:"numberOfPlayers" json:"numberOfPlayers,omitempty"`
	Rating          int      `mapstructure:"rating" json:"rating,omitempty"`
	Developer       string   `mapstructure:"developer" json:"developer,omitempty"`
	Publisher       string   `mapstructure:"publisher" json:"publisher,omitempty"`
	FrontBoxArt     string   `mapstructure:"frontBoxArt" json:"frontBoxArt,omitempty"`
	IconURL         string   `mapstructure:"iconUrl" json:"iconUrl,omitempty"`
	Screenshots     []string `mapstructure:"screenshots" json:"screenshots,omitempty"`
	BannerURL       string   `mapstructure:"bannerUrl" json:"bannerUrl,omitempty"`
	Intro           string   `mapstructure:"intro" json:"intro,omitempty"`
	Description     string   `mapstructure:"description" json:"description,omitempty"`
	Languages       []string `mapstructure:"languages" json:"languages,omitempty"`
	Size            int      `mapstructure:"size" json:"size,omitempty"`
	Rank            int      `mapstructure:"rank" json:"rank,omitempty"`
}

TitleDBEntry describe the various fields for entries

Jump to

Keyboard shortcuts

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