service

package
v0.0.0-...-7f3aa20 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MapAuthToken

func MapAuthToken(token *authToken) map[string]string

func NewAuthTokenProvider

func NewAuthTokenProvider() *authTokenProvider

func NewValidator

func NewValidator(validatorServerURL string) *curationValidator

func ParseAuthToken

func ParseAuthToken(value map[string]string) (*authToken, error)

ParseAuthToken parses map into token

func RemoveRepackFolder

func RemoveRepackFolder(ctx context.Context, filePath string)

Types

type AuthTokenizer

type AuthTokenizer interface {
	CreateAuthToken(userID int64) (*authToken, error)
}

type Clock

type Clock interface {
	Now() time.Time
	Unix(sec int64, nsec int64) time.Time
}

type MultipartFileProvider

type MultipartFileProvider interface {
	Filename() string
	Size() int64
	Open() (multipart.File, error)
}

type MultipartFileWrapper

type MultipartFileWrapper struct {
	// contains filtered or unexported fields
}

func NewMutlipartFileWrapper

func NewMutlipartFileWrapper(fileHeader *multipart.FileHeader) *MultipartFileWrapper

func (*MultipartFileWrapper) Filename

func (m *MultipartFileWrapper) Filename() string

func (*MultipartFileWrapper) Open

func (*MultipartFileWrapper) Size

func (m *MultipartFileWrapper) Size() int64

type RealClock

type RealClock struct {
}

func (*RealClock) Now

func (r *RealClock) Now() time.Time

func (*RealClock) Unix

func (r *RealClock) Unix(sec int64, nsec int64) time.Time

type SiteService

type SiteService struct {
	SSK              SubmissionStatusKeeper
	DataPacksIndexer ZipIndexer
	// contains filtered or unexported fields
}

func New

func New(l *logrus.Entry, db *sql.DB, pgdb *pgxpool.Pool, authBotSession, notificationBotSession *discordgo.Session,
	flashpointServerID, notificationChannelID, curationFeedChannelID, validatorServerURL string,
	sessionExpirationSeconds int64, submissionsDir, submissionImagesDir, flashfreezeDir string, isDev bool,
	rsu *resumableuploadservice.ResumableUploadService, archiveIndexerServerURL, flashfreezeIngestDir,
	dataPacksDir string) *SiteService

func (*SiteService) AddSubmissionToFlashpoint

func (s *SiteService) AddSubmissionToFlashpoint(ctx context.Context, submission *types.ExtendedSubmission, subDirFullPath string,
	dataPacksDir string, frozenPacksDir string, imagesDir string, r *http.Request) (*string, error)

func (*SiteService) DeleteGame

func (s *SiteService) DeleteGame(ctx context.Context, gameId string, reason string, imagesPath string, gamesPath string,
	deletedImagesPath string, deletedGamesPath string, frozenPacksPath string) error

func (*SiteService) DeleteUserSessions

func (s *SiteService) DeleteUserSessions(ctx context.Context, uid int64) (int64, error)

func (*SiteService) DeveloperImportDatabaseJson

func (s *SiteService) DeveloperImportDatabaseJson(ctx context.Context, data *types.LauncherDump) error

func (*SiteService) DeveloperTagDescFromValidator

func (s *SiteService) DeveloperTagDescFromValidator(ctx context.Context) error

func (*SiteService) FetchGames

func (s *SiteService) FetchGames(ctx context.Context, ids []string) ([]*types.Game, error)

func (*SiteService) FreezeGame

func (s *SiteService) FreezeGame(ctx context.Context, gameId string, uid int64, dataPacksPath string,
	frozenPacksPath string, deletedPacksPath string) error

func (*SiteService) FreezeSubmission

func (s *SiteService) FreezeSubmission(ctx context.Context, sid int64) error

func (*SiteService) GenAuthToken

func (s *SiteService) GenAuthToken(ctx context.Context, uid int64, scope string, client string, ipAddr string) (map[string]string, error)

func (*SiteService) GetApplyContentPatchPageData

func (s *SiteService) GetApplyContentPatchPageData(ctx context.Context, sid int64) (*types.ApplyContentPatchPageData, error)

func (*SiteService) GetBasePageData

func (s *SiteService) GetBasePageData(ctx context.Context) (*types.BasePageData, error)

GetBasePageData loads base user data, does not return error if user is not logged in

func (*SiteService) GetClientSecret

func (s *SiteService) GetClientSecret(ctx context.Context, clientID string) (string, error)

func (*SiteService) GetCurationImage

func (s *SiteService) GetCurationImage(ctx context.Context, ciid int64) (*types.CurationImage, error)

func (*SiteService) GetDeletedGamePageData

func (s *SiteService) GetDeletedGamePageData(ctx context.Context, modifiedAfter *string) ([]*types.DeletedGame, error)

func (*SiteService) GetFlashfreezeRootFile

func (s *SiteService) GetFlashfreezeRootFile(ctx context.Context, fid int64) (*types.FlashfreezeFile, error)

func (*SiteService) GetGameCountSinceDate

func (s *SiteService) GetGameCountSinceDate(ctx context.Context, modifiedAfter *string) (int, error)

func (*SiteService) GetGameDataIndexPageData

func (s *SiteService) GetGameDataIndexPageData(ctx context.Context, gameId string, date int64) (*types.GameDataIndexPageData, error)

func (*SiteService) GetGameDataPageData

func (s *SiteService) GetGameDataPageData(ctx context.Context, gameId string, date int64) (*types.GameDataPageData, error)

func (*SiteService) GetGamePageData

func (s *SiteService) GetGamePageData(ctx context.Context, gameId string, imageCdn string, compressedImages bool, revisionDate string) (*types.GamePageData, error)

func (*SiteService) GetGamesPageData

func (s *SiteService) GetGamesPageData(ctx context.Context, modifierAfter *string, modifiedBefore *string, broad bool, afterId *string) ([]*types.Game, []*types.AdditionalApp, []*types.GameData, [][]string, [][]string, error)

func (*SiteService) GetIndexMatchesHash

func (s *SiteService) GetIndexMatchesHash(ctx context.Context, hashType string, hashStr string) (*types.IndexMatchResult, error)

func (*SiteService) GetMetadataStatsPageData

func (s *SiteService) GetMetadataStatsPageData(ctx context.Context) (*types.MetadataStatsPageData, error)

func (*SiteService) GetNextSubmission

func (s *SiteService) GetNextSubmission(ctx context.Context, sid int64) (*int64, error)

func (*SiteService) GetPlatformsPageData

func (s *SiteService) GetPlatformsPageData(ctx context.Context, modifiedAfter *string) (*types.PlatformsPageData, error)

func (*SiteService) GetPreviousSubmission

func (s *SiteService) GetPreviousSubmission(ctx context.Context, sid int64) (*int64, error)

func (*SiteService) GetProfilePageData

func (s *SiteService) GetProfilePageData(ctx context.Context, uid int64) (*types.ProfilePageData, error)

func (*SiteService) GetSearchFlashfreezeData

func (s *SiteService) GetSearchFlashfreezeData(ctx context.Context, filter *types.FlashfreezeFilter) (*types.SearchFlashfreezePageData, error)

func (*SiteService) GetServerUser

func (s *SiteService) GetServerUser(ctx context.Context, uid int64) (*types.FlashpointDiscordUser, error)

func (*SiteService) GetSessionAuthInfo

func (s *SiteService) GetSessionAuthInfo(ctx context.Context, key string) (*types.SessionInfo, bool, error)

func (*SiteService) GetSessions

func (s *SiteService) GetSessions(ctx context.Context, uid int64) ([]*types.SessionInfo, error)

func (*SiteService) GetStatisticsPageData

func (s *SiteService) GetStatisticsPageData(ctx context.Context) (*types.StatisticsPageData, error)

func (*SiteService) GetSubmissionFiles

func (s *SiteService) GetSubmissionFiles(ctx context.Context, sfids []int64) ([]*types.SubmissionFile, error)

func (*SiteService) GetSubmissionsFilesPageData

func (s *SiteService) GetSubmissionsFilesPageData(ctx context.Context, sid int64) (*types.SubmissionsFilesPageData, error)

func (*SiteService) GetSubmissionsPageData

func (s *SiteService) GetSubmissionsPageData(ctx context.Context, filter *types.SubmissionsFilter) (*types.SubmissionsPageData, error)

func (*SiteService) GetTagPageData

func (s *SiteService) GetTagPageData(ctx context.Context, tagIdStr string) (*types.TagPageData, error)

func (*SiteService) GetTagsPageData

func (s *SiteService) GetTagsPageData(ctx context.Context, modifiedAfter *string) (*types.TagsPageData, error)

func (*SiteService) GetUserRoles

func (s *SiteService) GetUserRoles(ctx context.Context, uid int64) ([]string, error)

func (*SiteService) GetUserStatistics

func (s *SiteService) GetUserStatistics(ctx context.Context, uid int64) (*types.UserStatistics, error)

func (*SiteService) GetUsers

func (s *SiteService) GetUsers(ctx context.Context) ([]*types.User, error)

func (*SiteService) GetViewSubmissionPageData

func (s *SiteService) GetViewSubmissionPageData(ctx context.Context, uid, sid int64) (*types.ViewSubmissionPageData, error)

func (*SiteService) IndexUnindexedFlashfreezeItems

func (s *SiteService) IndexUnindexedFlashfreezeItems(l *logrus.Entry)

func (*SiteService) IngestFlashfreezeItems

func (s *SiteService) IngestFlashfreezeItems(l *logrus.Entry)

func (*SiteService) IngestUnknownFlashfreezeItems

func (s *SiteService) IngestUnknownFlashfreezeItems(l *logrus.Entry)

func (*SiteService) IsChunkReceived

func (s *SiteService) IsChunkReceived(ctx context.Context, resumableParams *types.ResumableParams) (bool, error)

func (*SiteService) Logout

func (s *SiteService) Logout(ctx context.Context, secret string) error

func (*SiteService) NukeSessionTable

func (s *SiteService) NukeSessionTable(ctx context.Context) error

NukeSessionTable nukes the session table

func (*SiteService) OverrideBot

func (s *SiteService) OverrideBot(ctx context.Context, sid int64) error

func (*SiteService) ProduceRemindersAboutRequestedChanges

func (s *SiteService) ProduceRemindersAboutRequestedChanges(ctx context.Context) (int, error)

ProduceRemindersAboutRequestedChanges generates notifications for every user with submissions which are waiting for changes more than a month

func (*SiteService) ReceiveComments

func (s *SiteService) ReceiveComments(ctx context.Context, uid int64, sids []int64, formAction, formMessage,
	formIgnoreDupeActions, subDirFullPath, dataPacksDir, frozenPacksDir, imagesDir string, r *http.Request) error

func (*SiteService) ReceiveFlashfreezeChunk

func (s *SiteService) ReceiveFlashfreezeChunk(ctx context.Context, resumableParams *types.ResumableParams, chunk []byte) (*int64, error)

func (*SiteService) ReceiveSubmissionChunk

func (s *SiteService) ReceiveSubmissionChunk(ctx context.Context, sid *int64, resumableParams *types.ResumableParams, chunk []byte) (*string, error)

func (*SiteService) RecomputeSubmissionCacheAll

func (s *SiteService) RecomputeSubmissionCacheAll(ctx context.Context)

func (*SiteService) RestoreGame

func (s *SiteService) RestoreGame(ctx context.Context, gameId string, reason string, imagesPath string, gamesPath string,
	deletedImagesPath string, deletedGamesPath string, frozenPacksPath string) error

func (*SiteService) RevokeSession

func (s *SiteService) RevokeSession(ctx context.Context, uid int64, sessionID int64) error

func (*SiteService) RunNotificationConsumer

func (s *SiteService) RunNotificationConsumer(logger *logrus.Entry, ctx context.Context, wg *sync.WaitGroup)

func (*SiteService) SaveGame

func (s *SiteService) SaveGame(ctx context.Context, game *types.Game) error

func (*SiteService) SaveGameData

func (s *SiteService) SaveGameData(ctx context.Context, gameId string, date int64, gameData *types.GameData) error

func (*SiteService) SaveTag

func (s *SiteService) SaveTag(ctx context.Context, tag *types.Tag) error

func (*SiteService) SaveUser

func (s *SiteService) SaveUser(ctx context.Context, discordUser *types.DiscordUser, scope string, clientID string, ipAddr string) (*authToken, error)

func (*SiteService) SearchSubmissions

func (s *SiteService) SearchSubmissions(ctx context.Context, filter *types.SubmissionsFilter) ([]*types.ExtendedSubmission, int64, error)

func (*SiteService) SetClientAppSecret

func (s *SiteService) SetClientAppSecret(ctx context.Context, clientID string, clientSecret string) error

func (*SiteService) SoftDeleteComment

func (s *SiteService) SoftDeleteComment(ctx context.Context, cid int64, deleteReason string) error

func (*SiteService) SoftDeleteSubmission

func (s *SiteService) SoftDeleteSubmission(ctx context.Context, sid int64, deleteReason string) error

func (*SiteService) SoftDeleteSubmissionFile

func (s *SiteService) SoftDeleteSubmissionFile(ctx context.Context, sfid int64, deleteReason string) error

func (*SiteService) UnfreezeGame

func (s *SiteService) UnfreezeGame(ctx context.Context, gameId string, uid int64, dataPacksPath string,
	frozenPacksPath string, deletedPacksPath string) error

func (*SiteService) UnfreezeSubmission

func (s *SiteService) UnfreezeSubmission(ctx context.Context, sid int64) error

func (*SiteService) UpdateMasterDB

func (s *SiteService) UpdateMasterDB(ctx context.Context) error

func (*SiteService) UpdateNotificationSettings

func (s *SiteService) UpdateNotificationSettings(ctx context.Context, uid int64, notificationActions []string) error

func (*SiteService) UpdateSubscriptionSettings

func (s *SiteService) UpdateSubscriptionSettings(ctx context.Context, uid, sid int64, subscribe bool) error

type SubmissionStatusKeeper

type SubmissionStatusKeeper struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*SubmissionStatusKeeper) Get

func (*SubmissionStatusKeeper) SetCopying

func (s *SubmissionStatusKeeper) SetCopying(tempName string, message string)

func (*SubmissionStatusKeeper) SetFailed

func (s *SubmissionStatusKeeper) SetFailed(tempName, message string)

func (*SubmissionStatusKeeper) SetFinalizing

func (s *SubmissionStatusKeeper) SetFinalizing(tempName string)

func (*SubmissionStatusKeeper) SetReceived

func (s *SubmissionStatusKeeper) SetReceived(tempName string)

func (*SubmissionStatusKeeper) SetSuccess

func (s *SubmissionStatusKeeper) SetSuccess(tempName string, sid int64)

func (*SubmissionStatusKeeper) SetValidating

func (s *SubmissionStatusKeeper) SetValidating(tempName string)

type Validator

type Validator interface {
	Validate(ctx context.Context, file io.Reader, filename string) (*types.ValidatorResponse, error)
	GetTags(ctx context.Context) ([]types.Tag, error)
	ProvideArchiveForValidation(filePath string) (*types.ValidatorResponse, error)
	ProvideArchiveForRepacking(filePath string) (*types.ValidatorRepackResponse, error)
}

type ZipIndexer

type ZipIndexer struct {
	// contains filtered or unexported fields
}

func NewZipIndexer

func NewZipIndexer(pool *pgxpool.Pool, dataPacksDir string, l *logrus.Entry) ZipIndexer

func (*ZipIndexer) GetStatus

func (z *ZipIndexer) GetStatus() (string, error)

func (*ZipIndexer) Start

func (z *ZipIndexer) Start()

func (*ZipIndexer) Stop

func (z *ZipIndexer) Stop()

Jump to

Keyboard shortcuts

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