Documentation ¶
Index ¶
- Variables
- func GetBaseAPI(db *db.DB, mailer kilonova.Mailer) (*BaseAPI, *StatusError)
- func InitializeBaseAPI(ctx context.Context) (*BaseAPI, *StatusError)
- type BaseAPI
- func (s *BaseAPI) AddContestEditor(ctx context.Context, pbid int, uid int) *StatusError
- func (s *BaseAPI) AddContestTester(ctx context.Context, pbid int, uid int) *StatusError
- func (s *BaseAPI) AddDonation(ctx context.Context, donation *kilonova.Donation) *kilonova.StatusError
- func (s *BaseAPI) AddProblemEditor(ctx context.Context, pbid int, uid int) *StatusError
- func (s *BaseAPI) AddProblemViewer(ctx context.Context, pbid int, uid int) *StatusError
- func (s *BaseAPI) AnswerContestQuestion(ctx context.Context, id int, text string) *StatusError
- func (s *BaseAPI) Attachment(ctx context.Context, id int) (*kilonova.Attachment, *StatusError)
- func (s *BaseAPI) AttachmentData(ctx context.Context, id int) ([]byte, *StatusError)
- func (s *BaseAPI) AttemptedProblems(ctx context.Context, user *kilonova.UserBrief, lookingUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)deprecated
- func (s *BaseAPI) BlogPost(ctx context.Context, id int) (*kilonova.BlogPost, *StatusError)
- func (s *BaseAPI) BlogPostAttByName(ctx context.Context, postID int, name string) (*kilonova.Attachment, *StatusError)
- func (s *BaseAPI) BlogPostAttachment(ctx context.Context, postID, attachmentID int) (*kilonova.Attachment, *StatusError)
- func (s *BaseAPI) BlogPostAttachments(ctx context.Context, postID int) ([]*kilonova.Attachment, *StatusError)
- func (s *BaseAPI) BlogPostBySlug(ctx context.Context, slug string) (*kilonova.BlogPost, *StatusError)
- func (s *BaseAPI) BlogPostDescVariants(ctx context.Context, problemID int, getPrivate bool) ([]*kilonova.StatementVariant, *StatusError)
- func (s *BaseAPI) BlogPosts(ctx context.Context, filter kilonova.BlogPostFilter) ([]*kilonova.BlogPost, *StatusError)
- func (s *BaseAPI) CanJoinContest(c *kilonova.Contest) bool
- func (s *BaseAPI) CanSubmitInContest(user *kilonova.UserBrief, c *kilonova.Contest) bool
- func (s *BaseAPI) CanViewContestLeaderboard(user *kilonova.UserBrief, contest *kilonova.Contest) bool
- func (s *BaseAPI) CanViewContestProblems(ctx context.Context, user *kilonova.UserBrief, contest *kilonova.Contest) bool
- func (s *BaseAPI) CanViewTests(user *kilonova.UserBrief, problem *kilonova.Problem) bool
- func (s *BaseAPI) CancelSubscription(ctx context.Context, id int) *kilonova.StatusError
- func (s *BaseAPI) CaptchaImageHandler() http.Handler
- func (s *BaseAPI) CheckCaptcha(id string, digits string) bool
- func (s *BaseAPI) CheckPasswordResetRequest(ctx context.Context, rid string) bool
- func (s *BaseAPI) CheckValidPassword(pwd string) *StatusError
- func (s *BaseAPI) CheckValidUsername(name string) *StatusError
- func (s *BaseAPI) CheckVerificationEmail(ctx context.Context, vid string) bool
- func (s *BaseAPI) CleanupSubTasks(ctx context.Context, problemID int) *StatusError
- func (s *BaseAPI) Close() *StatusError
- func (s *BaseAPI) ConfirmVerificationEmail(vid string, user *kilonova.UserBrief) *StatusError
- func (s *BaseAPI) Contest(ctx context.Context, id int) (*kilonova.Contest, *StatusError)
- func (s *BaseAPI) ContestAnnouncement(ctx context.Context, id int) (*kilonova.ContestAnnouncement, *StatusError)
- func (s *BaseAPI) ContestAnnouncements(ctx context.Context, contestID int) ([]*kilonova.ContestAnnouncement, *StatusError)
- func (s *BaseAPI) ContestCount(ctx context.Context, filter kilonova.ContestFilter) (int, *StatusError)
- func (s *BaseAPI) ContestInvitation(ctx context.Context, id string) (*kilonova.ContestInvitation, *StatusError)
- func (s *BaseAPI) ContestInvitations(ctx context.Context, contestID int) ([]*kilonova.ContestInvitation, *StatusError)
- func (s *BaseAPI) ContestLeaderboard(ctx context.Context, contest *kilonova.Contest, freezeTime *time.Time, ...) (*kilonova.ContestLeaderboard, *StatusError)
- func (s *BaseAPI) ContestMaxScore(ctx context.Context, uid, pbID, contestID int, freezeTime *time.Time) decimal.Decimal
- func (s *BaseAPI) ContestProblem(ctx context.Context, contest *kilonova.Contest, ...) (*kilonova.Problem, *StatusError)
- func (s *BaseAPI) ContestProblems(ctx context.Context, contest *kilonova.Contest, ...) ([]*kilonova.ScoredProblem, *StatusError)
- func (s *BaseAPI) ContestQuestion(ctx context.Context, id int) (*kilonova.ContestQuestion, *StatusError)
- func (s *BaseAPI) ContestQuestions(ctx context.Context, contestID int) ([]*kilonova.ContestQuestion, *StatusError)
- func (s *BaseAPI) ContestRegistration(ctx context.Context, contestID, userID int) (*kilonova.ContestRegistration, *StatusError)
- func (s *BaseAPI) ContestRegistrationCount(ctx context.Context, contestID int) (int, *StatusError)
- func (s *BaseAPI) ContestRegistrations(ctx context.Context, contestID int, fuzzyName *string, inviteID *string, ...) ([]*kilonova.ContestRegistration, *StatusError)
- func (s *BaseAPI) ContestUserQuestions(ctx context.Context, contestID, userID int) ([]*kilonova.ContestQuestion, *StatusError)
- func (s *BaseAPI) Contests(ctx context.Context, filter kilonova.ContestFilter) ([]*kilonova.Contest, *StatusError)
- func (s *BaseAPI) CountBlogPosts(ctx context.Context, filter kilonova.BlogPostFilter) (int, *StatusError)
- func (s *BaseAPI) CountSessions(ctx context.Context, filter *SessionFilter) (int, *StatusError)
- func (s *BaseAPI) CountUsers(ctx context.Context, filter kilonova.UserFilter) (int, *StatusError)
- func (s *BaseAPI) CreateBlogPost(ctx context.Context, title string, author *kilonova.UserBrief) (int, string, *StatusError)
- func (s *BaseAPI) CreateBlogPostAttachment(ctx context.Context, att *kilonova.Attachment, postID int, r io.Reader, ...) *StatusError
- func (s *BaseAPI) CreateContest(ctx context.Context, name string, cType kilonova.ContestType, ...) (int, *StatusError)
- func (s *BaseAPI) CreateContestAnnouncement(ctx context.Context, contestID int, text string) (int, *StatusError)
- func (s *BaseAPI) CreateContestInvitation(ctx context.Context, contestID int, author *kilonova.UserBrief, maxUses *int) (string, *StatusError)
- func (s *BaseAPI) CreateContestQuestion(ctx context.Context, contest *kilonova.Contest, authorID int, text string) (int, *StatusError)
- func (s *BaseAPI) CreatePaste(ctx context.Context, sub *kilonova.Submission, user *kilonova.UserBrief) (string, *StatusError)
- func (s *BaseAPI) CreateProblem(ctx context.Context, title string, author *UserBrief, consoleInput bool) (*kilonova.Problem, *StatusError)
- func (s *BaseAPI) CreateProblemAttachment(ctx context.Context, att *kilonova.Attachment, problemID int, r io.Reader, ...) *StatusError
- func (s *BaseAPI) CreateProblemList(ctx context.Context, pblist *kilonova.ProblemList) *StatusError
- func (s *BaseAPI) CreateSession(ctx context.Context, uid int) (string, *StatusError)
- func (s *BaseAPI) CreateSubTask(ctx context.Context, subtask *kilonova.SubTask) *StatusError
- func (s *BaseAPI) CreateSubmission(ctx context.Context, author *UserFull, problem *kilonova.Problem, code []byte, ...) (int, *StatusError)
- func (s *BaseAPI) CreateTag(ctx context.Context, name string, tagType kilonova.TagType) (int, *StatusError)
- func (s *BaseAPI) CreateTest(ctx context.Context, test *kilonova.Test) *StatusError
- func (s *BaseAPI) DelAttachmentRenders(attID int) error
- func (s *BaseAPI) DeleteBlogPost(ctx context.Context, post *kilonova.BlogPost) *StatusError
- func (s *BaseAPI) DeleteBlogPostAtts(ctx context.Context, postID int, attIDs []int) (int, *StatusError)
- func (s *BaseAPI) DeleteContest(ctx context.Context, contest *kilonova.Contest) *StatusError
- func (s *BaseAPI) DeleteContestAnnouncement(ctx context.Context, announcementID int) *StatusError
- func (s *BaseAPI) DeletePaste(ctx context.Context, id string) *StatusError
- func (s *BaseAPI) DeleteProblem(ctx context.Context, problem *kilonova.Problem) *StatusError
- func (s *BaseAPI) DeleteProblemAtts(ctx context.Context, problemID int, attIDs []int) (int, *StatusError)
- func (s *BaseAPI) DeleteProblemList(ctx context.Context, id int) *StatusError
- func (s *BaseAPI) DeleteSubTask(ctx context.Context, subtaskID int) *StatusError
- func (s *BaseAPI) DeleteSubTasks(ctx context.Context, problemID int) *StatusError
- func (s *BaseAPI) DeleteSubmission(ctx context.Context, subID int) *StatusError
- func (s *BaseAPI) DeleteTag(ctx context.Context, tag *kilonova.Tag) *StatusError
- func (s *BaseAPI) DeleteTest(ctx context.Context, id int) *StatusError
- func (s *BaseAPI) DeleteTests(ctx context.Context, problemID int) *StatusError
- func (s *BaseAPI) DeleteUser(ctx context.Context, user *kilonova.UserBrief) *StatusError
- func (s *BaseAPI) Donations(ctx context.Context) ([]*kilonova.Donation, *kilonova.StatusError)
- func (s *BaseAPI) EvictionLogger() *slog.Logger
- func (s *BaseAPI) ExtendSession(ctx context.Context, sid string) (time.Time, *StatusError)
- func (s *BaseAPI) FinalizePasswordReset(ctx context.Context, rid string, newPassword string) *StatusError
- func (s *BaseAPI) FormatDescName(lang, format, t string) string
- func (s *BaseAPI) FullProblemList(ctx context.Context, listID int, user *kilonova.UserBrief, ...) (*FullProblemList, *StatusError)
- func (s *BaseAPI) FullSubmission(ctx context.Context, subid int) (*FullSubmission, *StatusError)
- func (s *BaseAPI) GenerateUser(ctx context.Context, uname, pwd, lang string, theme kilonova.PreferredTheme, ...) (*kilonova.UserFull, *StatusError)
- func (s *BaseAPI) GetAttachmentRender(attID int, renderType string) (io.ReadSeekCloser, error)
- func (s *BaseAPI) GetAuditLogs(ctx context.Context, count int, offset int) ([]*kilonova.AuditLog, *StatusError)
- func (s *BaseAPI) GetAvatar(email string, size int, maxLastMod time.Time) (io.ReadSeekCloser, time.Time, bool, error)
- func (s *BaseAPI) GetLogCount(ctx context.Context) (int, *StatusError)
- func (s *BaseAPI) GetPwdResetRequestUser(ctx context.Context, rid string) (int, *StatusError)
- func (s *BaseAPI) GetRequestInfo(r *http.Request) (ip *netip.Addr, ua string)
- func (s *BaseAPI) GetSessCookie(r *http.Request) string
- func (s *BaseAPI) GetSession(ctx context.Context, sid string) (int, *StatusError)
- func (s *BaseAPI) GetVerificationUser(ctx context.Context, vid string) (int, *StatusError)
- func (s *BaseAPI) IsBlogPostEditor(user *kilonova.UserBrief, post *kilonova.BlogPost) bool
- func (s *BaseAPI) IsBlogPostVisible(user *kilonova.UserBrief, post *kilonova.BlogPost) bool
- func (s *BaseAPI) IsContestEditor(user *kilonova.UserBrief, contest *kilonova.Contest) bool
- func (s *BaseAPI) IsContestTester(user *kilonova.UserBrief, contest *kilonova.Contest) bool
- func (s *BaseAPI) IsContestVisible(user *kilonova.UserBrief, contest *kilonova.Contest) bool
- func (s *BaseAPI) IsPasteEditor(paste *kilonova.SubmissionPaste, user *kilonova.UserBrief) bool
- func (s *BaseAPI) IsProblemEditor(user *kilonova.UserBrief, problem *kilonova.Problem) bool
- func (s *BaseAPI) IsProblemFullyVisible(user *kilonova.UserBrief, problem *kilonova.Problem) bool
- func (s *BaseAPI) IsProblemVisible(user *kilonova.UserBrief, problem *kilonova.Problem) bool
- func (s *BaseAPI) IsSubmissionEditor(sub *kilonova.Submission, user *kilonova.UserBrief) bool
- func (s *BaseAPI) KickUserFromContest(ctx context.Context, contestID, userID int) *StatusError
- func (s *BaseAPI) LastSubmissionTime(ctx context.Context, filter kilonova.SubmissionFilter) (*time.Time, *StatusError)
- func (s *BaseAPI) LogInfo(ctx context.Context, msg string, args ...any)
- func (s *BaseAPI) LogSignup(ctx context.Context, userID int, ip *netip.Addr, userAgent *string) *kilonova.StatusError
- func (s *BaseAPI) LogSystemAction(ctx context.Context, msg string, args ...any)
- func (s *BaseAPI) LogToDiscord(ctx context.Context, msg string, args ...any)
- func (s *BaseAPI) LogUserAction(ctx context.Context, msg string, args ...any)
- func (s *BaseAPI) LogVerbose(ctx context.Context, msg string, args ...any)
- func (s *BaseAPI) Login(ctx context.Context, uname, pwd string) (*kilonova.UserFull, *StatusError)
- func (s *BaseAPI) MOSSSubmissions(ctx context.Context, contestID int) ([]*kilonova.MOSSSubmission, *StatusError)
- func (s *BaseAPI) MailerEnabled() bool
- func (s *BaseAPI) MaxScore(ctx context.Context, uid, pbID int) decimal.Decimal
- func (s *BaseAPI) MaxScoreSubID(ctx context.Context, uid, pbID int) (int, *StatusError)
- func (s *BaseAPI) MaximumScoreSubTaskTests(ctx context.Context, problemID, userID int, contestID *int) ([]*kilonova.SubTest, *StatusError)
- func (s *BaseAPI) MaximumScoreSubTasks(ctx context.Context, problemID, userID int, contestID *int) ([]*kilonova.SubmissionSubTask, *StatusError)
- func (s *BaseAPI) MergeTags(ctx context.Context, original int, toReplace []int) *StatusError
- func (s *BaseAPI) MustSolveCaptcha(ctx context.Context, ip *netip.Addr) bool
- func (s *BaseAPI) NewCaptchaID() string
- func (s *BaseAPI) NextVID(ctx context.Context, problemID int) int
- func (s *BaseAPI) NumSolvedFromPblist(ctx context.Context, listID int, userID int) (int, *StatusError)
- func (s *BaseAPI) NumSolvedFromPblists(ctx context.Context, listIDs []int, user *kilonova.UserBrief) (map[int]int, *StatusError)
- func (s *BaseAPI) PblistChildrenLists(ctx context.Context, problemListID int) ([]*kilonova.ProblemList, *StatusError)
- func (s *BaseAPI) PblistParentLists(ctx context.Context, problemListID int) ([]*kilonova.ProblemList, *StatusError)
- func (s *BaseAPI) Problem(ctx context.Context, id int) (*kilonova.Problem, *StatusError)
- func (s *BaseAPI) ProblemAttByName(ctx context.Context, problemID int, name string) (*kilonova.Attachment, *StatusError)
- func (s *BaseAPI) ProblemAttDataByName(ctx context.Context, problemID int, name string) ([]byte, *StatusError)
- func (s *BaseAPI) ProblemAttachment(ctx context.Context, problemID, attachmentID int) (*kilonova.Attachment, *StatusError)
- func (s *BaseAPI) ProblemAttachments(ctx context.Context, problemID int) ([]*kilonova.Attachment, *StatusError)
- func (s *BaseAPI) ProblemChecklist(ctx context.Context, pbid int) (*kilonova.ProblemChecklist, *StatusError)
- func (s *BaseAPI) ProblemDescVariants(ctx context.Context, problemID int, getPrivate bool) ([]*kilonova.StatementVariant, *StatusError)
- func (s *BaseAPI) ProblemEditors(ctx context.Context, pbid int) ([]*kilonova.UserBrief, *StatusError)
- func (s *BaseAPI) ProblemList(ctx context.Context, id int) (*kilonova.ProblemList, *StatusError)
- func (s *BaseAPI) ProblemListByName(ctx context.Context, name string) (*kilonova.ProblemList, *StatusError)
- func (s *BaseAPI) ProblemListProblems(ctx context.Context, ids []int, lookingUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)
- func (s *BaseAPI) ProblemLists(ctx context.Context, filter kilonova.ProblemListFilter) ([]*kilonova.ProblemList, *StatusError)
- func (s *BaseAPI) ProblemParentLists(ctx context.Context, problemID int, showHidable bool) ([]*kilonova.ProblemList, *StatusError)
- func (s *BaseAPI) ProblemRunningContests(ctx context.Context, problemID int) ([]*kilonova.Contest, *StatusError)
- func (s *BaseAPI) ProblemSettings(ctx context.Context, problemID int) (*kilonova.ProblemEvalSettings, *StatusError)
- func (s *BaseAPI) ProblemStatistics(ctx context.Context, problem *kilonova.Problem, lookingUser *UserBrief) (*ProblemStatistics, *StatusError)
- func (s *BaseAPI) ProblemTags(ctx context.Context, problemID int) ([]*kilonova.Tag, *StatusError)
- func (s *BaseAPI) ProblemViewers(ctx context.Context, pbid int) ([]*kilonova.UserBrief, *StatusError)
- func (s *BaseAPI) Problems(ctx context.Context, filter kilonova.ProblemFilter) ([]*kilonova.Problem, *StatusError)
- func (s *BaseAPI) PurgeTestData(testID int) error
- func (s *BaseAPI) RawSubmission(ctx context.Context, id int) (*kilonova.Submission, *StatusError)
- func (s *BaseAPI) RawSubmissionCode(ctx context.Context, subid int) ([]byte, *StatusError)
- func (s *BaseAPI) RawSubmissions(ctx context.Context, filter kilonova.SubmissionFilter) ([]*kilonova.Submission, *StatusError)
- func (s *BaseAPI) RegisterContestUser(ctx context.Context, contest *kilonova.Contest, userID int, ...) *StatusError
- func (s *BaseAPI) RegisterGrader(gr interface{ ... })
- func (s *BaseAPI) RelevantTags(ctx context.Context, tagID int, max int) ([]*kilonova.Tag, *StatusError)
- func (s *BaseAPI) RemainingSubmissionCount(ctx context.Context, contest *kilonova.Contest, problem *kilonova.Problem, ...) (int, *StatusError)
- func (s *BaseAPI) RemoveSession(ctx context.Context, sid string) *StatusError
- func (s *BaseAPI) RemoveUserSessions(ctx context.Context, uid int) *StatusError
- func (s *BaseAPI) RenderMarkdown(src []byte, ctx *kilonova.RenderContext) ([]byte, *StatusError)
- func (s *BaseAPI) RenderedBlogPostDesc(ctx context.Context, post *kilonova.BlogPost, lang, format, t string) ([]byte, *StatusError)
- func (s *BaseAPI) RenderedProblemDesc(ctx context.Context, problem *kilonova.Problem, lang, format, t string) ([]byte, *StatusError)
- func (s *BaseAPI) ResetProblemSubmissions(ctx context.Context, problem *kilonova.Problem) *StatusError
- func (s *BaseAPI) ResetSubmission(ctx context.Context, id int) *StatusError
- func (s *BaseAPI) ResetWaitingSubmissions(ctx context.Context) *StatusError
- func (s *BaseAPI) RunMOSS(ctx context.Context, contest *kilonova.Contest) *StatusError
- func (s *BaseAPI) SaveAttachmentRender(attID int, renderType string, data []byte) error
- func (s *BaseAPI) SaveAvatar(email string, size int, r io.Reader) error
- func (s *BaseAPI) SaveTestInput(testID int, input io.Reader) error
- func (s *BaseAPI) SaveTestOutput(testID int, output io.Reader) error
- func (s *BaseAPI) ScoredProblems(ctx context.Context, filter kilonova.ProblemFilter, ...) ([]*kilonova.ScoredProblem, *StatusError)
- func (s *BaseAPI) SearchProblems(ctx context.Context, filter kilonova.ProblemFilter, ...) ([]*FullProblem, int, *StatusError)
- func (s *BaseAPI) SendMail(msg *kilonova.MailerMessage) *StatusError
- func (s *BaseAPI) SendPasswordResetEmail(ctx context.Context, userID int, name, email string) *StatusError
- func (s *BaseAPI) SendVerificationEmail(ctx context.Context, userID int, name, email string) *StatusError
- func (s *BaseAPI) SessionDevices(ctx context.Context, sid string) ([]*SessionDevice, *StatusError)
- func (s *BaseAPI) SessionUser(ctx context.Context, sid string, r *http.Request) (*kilonova.UserFull, *StatusError)
- func (s *BaseAPI) Sessions(ctx context.Context, filter *SessionFilter) ([]*Session, *StatusError)
- func (s *BaseAPI) SetAdmin(ctx context.Context, userID int, toSet bool) *StatusError
- func (s *BaseAPI) SetForceUsernameChange(ctx context.Context, userID int, force bool) *StatusError
- func (s *BaseAPI) SetProposer(ctx context.Context, userID int, toSet bool) *StatusError
- func (s *BaseAPI) SetUserLockout(ctx context.Context, userID int, lockout bool) *StatusError
- func (s *BaseAPI) Signup(ctx context.Context, email, uname, pwd, lang string, ...) (int, *StatusError)
- func (s *BaseAPI) SolvedProblems(ctx context.Context, user *kilonova.UserBrief, lookingUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)deprecated
- func (s *BaseAPI) Start(ctx context.Context)
- func (s *BaseAPI) StartContestRegistration(ctx context.Context, contest *kilonova.Contest, userID int) *StatusError
- func (s *BaseAPI) StripContestAccess(ctx context.Context, pbid int, uid int) *StatusError
- func (s *BaseAPI) StripProblemAccess(ctx context.Context, pbid int, uid int) *StatusError
- func (s *BaseAPI) SubTask(ctx context.Context, problemID int, subtaskVID int) (*kilonova.SubTask, *StatusError)
- func (s *BaseAPI) SubTasks(ctx context.Context, problemID int) ([]*kilonova.SubTask, *StatusError)
- func (s *BaseAPI) SubTasksByTest(ctx context.Context, problemID, testID int) ([]*kilonova.SubTask, *StatusError)
- func (s *BaseAPI) SubTest(ctx context.Context, id int) (*kilonova.SubTest, *StatusError)
- func (s *BaseAPI) SubTests(ctx context.Context, submissionID int) ([]*kilonova.SubTest, *StatusError)
- func (s *BaseAPI) Submission(ctx context.Context, subid int, lookingUser *UserBrief) (*FullSubmission, *StatusError)
- func (s *BaseAPI) SubmissionCode(ctx context.Context, sub *kilonova.Submission, subProblem *kilonova.Problem, ...) ([]byte, *StatusError)
- func (s *BaseAPI) SubmissionPaste(ctx context.Context, id string) (*kilonova.SubmissionPaste, *StatusError)
- func (s *BaseAPI) SubmissionSubTasks(ctx context.Context, subID int) ([]*kilonova.SubmissionSubTask, *StatusError)
- func (s *BaseAPI) Submissions(ctx context.Context, filter kilonova.SubmissionFilter, look bool, ...) (*Submissions, *StatusError)
- func (s *BaseAPI) SubtestReader(subtest int) (io.ReadCloser, error)
- func (s *BaseAPI) TagByID(ctx context.Context, id int) (*kilonova.Tag, *StatusError)
- func (s *BaseAPI) TagByLooseName(ctx context.Context, name string) (*kilonova.Tag, *StatusError)
- func (s *BaseAPI) TagByName(ctx context.Context, name string) (*kilonova.Tag, *StatusError)
- func (s *BaseAPI) Tags(ctx context.Context) ([]*kilonova.Tag, *StatusError)
- func (s *BaseAPI) TagsByID(ctx context.Context, tagIDs []int) ([]*kilonova.Tag, *StatusError)
- func (s *BaseAPI) TagsByType(ctx context.Context, tagType kilonova.TagType) ([]*kilonova.Tag, *StatusError)
- func (s *BaseAPI) Test(ctx context.Context, pbID int, testVID int) (*kilonova.Test, *StatusError)
- func (s *BaseAPI) TestInput(testID int) (io.ReadCloser, error)
- func (s *BaseAPI) TestOutput(testID int) (io.ReadCloser, error)
- func (s *BaseAPI) Tests(ctx context.Context, pbID int) ([]*kilonova.Test, *StatusError)
- func (s *BaseAPI) ToggleDeepPbListProblems(ctx context.Context, list *kilonova.ProblemList, deep bool, ...) *kilonova.StatusError
- func (s *BaseAPI) UpdateAttachment(ctx context.Context, aid int, upd *kilonova.AttachmentUpdate) *StatusError
- func (s *BaseAPI) UpdateAttachmentData(ctx context.Context, aid int, data []byte, author *kilonova.UserBrief) *StatusError
- func (s *BaseAPI) UpdateBlogPost(ctx context.Context, id int, upd kilonova.BlogPostUpdate) *StatusError
- func (s *BaseAPI) UpdateConfig(ctx context.Context, upd ConfigUpdate) *StatusError
- func (s *BaseAPI) UpdateContest(ctx context.Context, id int, upd kilonova.ContestUpdate) *kilonova.StatusError
- func (s *BaseAPI) UpdateContestAnnouncement(ctx context.Context, announcementID int, text string) *StatusError
- func (s *BaseAPI) UpdateContestInvitation(ctx context.Context, id string, expired bool) *StatusError
- func (s *BaseAPI) UpdateContestProblems(ctx context.Context, id int, list []int) *StatusError
- func (s *BaseAPI) UpdateProblem(ctx context.Context, id int, args kilonova.ProblemUpdate, ...) *StatusError
- func (s *BaseAPI) UpdateProblemList(ctx context.Context, id int, upd kilonova.ProblemListUpdate) *StatusError
- func (s *BaseAPI) UpdateProblemListProblems(ctx context.Context, id int, list []int) *StatusError
- func (s *BaseAPI) UpdateProblemListSublists(ctx context.Context, id int, listIDs []int) *StatusError
- func (s *BaseAPI) UpdateProblemTags(ctx context.Context, problemID int, tagIDs []int) *StatusError
- func (s *BaseAPI) UpdateSubTask(ctx context.Context, id int, upd kilonova.SubTaskUpdate) *StatusError
- func (s *BaseAPI) UpdateSubTaskTests(ctx context.Context, id int, testIDs []int) *StatusError
- func (s *BaseAPI) UpdateSubTest(ctx context.Context, id int, upd kilonova.SubTestUpdate) *StatusError
- func (s *BaseAPI) UpdateSubmission(ctx context.Context, id int, status kilonova.SubmissionUpdate) *StatusError
- func (s *BaseAPI) UpdateSubmissionSubtaskPercentage(ctx context.Context, id int, percentage decimal.Decimal) *kilonova.StatusError
- func (s *BaseAPI) UpdateTagName(ctx context.Context, tag *kilonova.Tag, newName string) *StatusError
- func (s *BaseAPI) UpdateTagType(ctx context.Context, tag *kilonova.Tag, newType kilonova.TagType) *StatusError
- func (s *BaseAPI) UpdateTest(ctx context.Context, testID int, upd kilonova.TestUpdate) *StatusError
- func (s *BaseAPI) UpdateUser(ctx context.Context, userID int, upd kilonova.UserUpdate) *StatusError
- func (s *BaseAPI) UpdateUserPassword(ctx context.Context, uid int, password string) *StatusError
- func (s *BaseAPI) UpdateUsername(ctx context.Context, userID int, newName string, checkUsed bool, ...) *StatusError
- func (s *BaseAPI) UserBlogPosts(ctx context.Context, userID int, lookingUser *kilonova.UserBrief) ([]*kilonova.BlogPost, *StatusError)
- func (s *BaseAPI) UserBrief(ctx context.Context, id int) (*UserBrief, *StatusError)
- func (s *BaseAPI) UserBriefByName(ctx context.Context, name string) (*UserBrief, *StatusError)
- func (s *BaseAPI) UserContestFreezeTime(user *kilonova.UserBrief, contest *kilonova.Contest, showFrozen bool) *time.Time
- func (s *BaseAPI) UserFull(ctx context.Context, id int) (*UserFull, *StatusError)
- func (s *BaseAPI) UserFullByEmail(ctx context.Context, email string) (*UserFull, *StatusError)
- func (s *BaseAPI) UserFullByName(ctx context.Context, name string) (*UserFull, *StatusError)
- func (s *BaseAPI) UserSessions(ctx context.Context, userID int) ([]*Session, *StatusError)
- func (s *BaseAPI) UsernameChangeHistory(ctx context.Context, userID int) ([]*kilonova.UsernameChange, *StatusError)
- func (s *BaseAPI) UsersBrief(ctx context.Context, filter kilonova.UserFilter) ([]*UserBrief, *StatusError)
- func (s *BaseAPI) VerifyUserPassword(ctx context.Context, uid int, password string) *StatusError
- func (s *BaseAPI) VisibleFutureContests(ctx context.Context, user *kilonova.UserBrief) ([]*kilonova.Contest, *StatusError)
- func (s *BaseAPI) VisibleRunningContests(ctx context.Context, user *kilonova.UserBrief) ([]*kilonova.Contest, *StatusError)
- func (s *BaseAPI) WakeGrader()
- type ConfigUpdate
- type FullProblem
- type FullProblemList
- type FullSubmission
- type ProblemStatistics
- type Session
- type SessionDevice
- type SessionFilter
- type StatusError
- type Submissions
- type UserBrief
- type UserFull
Constants ¶
This section is empty.
Variables ¶
var ( ImportantUpdatesWebhook = config.GenFlag[string]("admin.important_webhook", "", "Webhook URL for audit log-level events") VerboseUpdatesWebhook = config.GenFlag[string]("admin.verbose_webhook", "", "Webhook URL for verbose platform information") )
var ( NormalUserVirtualContests = config.GenFlag[bool]("behavior.contests.anyone_virtual", false, "Anyone can create virtual contests") NormalUserVCLimit = config.GenFlag[int]("behavior.contests.normal_user_max_day", 10, "Number of maximum contests a non-proposer can create per day") )
var ( ErrNoUpdates = kilonova.ErrNoUpdates ErrMissingRequired = kilonova.ErrMissingRequired ErrNotFound = kilonova.ErrNotFound ErrUnknownError = kilonova.ErrUnknownError ErrContextCanceled = kilonova.ErrContextCanceled )
var ( SubForEveryoneConfig = config.GenFlag("behavior.everyone_subs", true, "Anyone can view others' source code") PastesEnabled = config.GenFlag("feature.pastes.enabled", true, "Pastes") LimitedSubCount = config.GenFlag[int]("behavior.submissions.max_viewing_count", 9999, "Maximum number of submissions to count on subs page. Set to < 0 to disable") )
var ( WaitingSubLimit = config.GenFlag[int]("behavior.submissions.user_max_waiting", 5, "Maximum number of unfinished submissions in the eval queue (for a single user)") TotalSubLimit = config.GenFlag[int]("behavior.submissions.user_max_minute", 20, "Maximum number of submissions uploaded per minute (for a single user with verified email)") UnverifiedSubLimit = config.GenFlag[int]("behavior.submissions.user_max_unverified", 5, "Maximum number of submissions uploaded per minute (for a single user with unverified email)") )
var (
CanChangeNames = config.GenFlag("feature.username_changes.enabled", true, "Anyone can change their usernames")
)
var (
MigrateOnStart = config.GenFlag("behavior.db.run_migrations", true, "Run PostgreSQL migrations on platform start")
)
var (
SignupEnabled = config.GenFlag("feature.platform.signup", true, "Manual signup")
)
var (
TrueIPHeader = config.GenFlag[string]("server.listen.true_ip_header", "", "True IP header. Leave empty if not behind reverse proxy, the proxy's remote ip header (X-Forwarded-For, for example) otherwise")
)
Functions ¶
func GetBaseAPI ¶
func InitializeBaseAPI ¶
func InitializeBaseAPI(ctx context.Context) (*BaseAPI, *StatusError)
Types ¶
type BaseAPI ¶
type BaseAPI struct {
// contains filtered or unexported fields
}
func (*BaseAPI) AddContestEditor ¶
func (*BaseAPI) AddContestTester ¶
func (*BaseAPI) AddDonation ¶
func (*BaseAPI) AddProblemEditor ¶
func (*BaseAPI) AddProblemViewer ¶
func (*BaseAPI) AnswerContestQuestion ¶
func (*BaseAPI) Attachment ¶
func (s *BaseAPI) Attachment(ctx context.Context, id int) (*kilonova.Attachment, *StatusError)
func (*BaseAPI) AttachmentData ¶
func (*BaseAPI) AttemptedProblems
deprecated
func (s *BaseAPI) AttemptedProblems(ctx context.Context, user *kilonova.UserBrief, lookingUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)
Deprecated: TODO: Remove
func (*BaseAPI) BlogPostAttByName ¶
func (s *BaseAPI) BlogPostAttByName(ctx context.Context, postID int, name string) (*kilonova.Attachment, *StatusError)
func (*BaseAPI) BlogPostAttachment ¶
func (s *BaseAPI) BlogPostAttachment(ctx context.Context, postID, attachmentID int) (*kilonova.Attachment, *StatusError)
func (*BaseAPI) BlogPostAttachments ¶
func (s *BaseAPI) BlogPostAttachments(ctx context.Context, postID int) ([]*kilonova.Attachment, *StatusError)
func (*BaseAPI) BlogPostBySlug ¶
func (*BaseAPI) BlogPostDescVariants ¶
func (s *BaseAPI) BlogPostDescVariants(ctx context.Context, problemID int, getPrivate bool) ([]*kilonova.StatementVariant, *StatusError)
func (*BaseAPI) BlogPosts ¶
func (s *BaseAPI) BlogPosts(ctx context.Context, filter kilonova.BlogPostFilter) ([]*kilonova.BlogPost, *StatusError)
func (*BaseAPI) CanSubmitInContest ¶
CanSubmitInContest checks if the user is either a contestant and the contest is running, or a tester/editor/admin. Ended contests cannot have submissions created by anyone Also, USACO-style contests are fun to handle...
func (*BaseAPI) CanViewContestLeaderboard ¶ added in v0.25.0
func (*BaseAPI) CanViewContestProblems ¶
func (s *BaseAPI) CanViewContestProblems(ctx context.Context, user *kilonova.UserBrief, contest *kilonova.Contest) bool
CanViewContestProblems checks if the user can see a contest's problems. Note that this does not neccesairly mean that he can submit in them! A problem may be viewable because the contest is running and visible, but only registered people should submit It's a bit frustrating but it's an important distinction If you think about it, all submitters can view problems, but not all problem viewers can submit
func (*BaseAPI) CanViewTests ¶
func (*BaseAPI) CancelSubscription ¶
func (*BaseAPI) CaptchaImageHandler ¶ added in v0.25.0
func (*BaseAPI) CheckCaptcha ¶ added in v0.25.0
func (*BaseAPI) CheckPasswordResetRequest ¶
func (*BaseAPI) CheckValidPassword ¶
func (s *BaseAPI) CheckValidPassword(pwd string) *StatusError
func (*BaseAPI) CheckValidUsername ¶
func (s *BaseAPI) CheckValidUsername(name string) *StatusError
func (*BaseAPI) CheckVerificationEmail ¶
func (*BaseAPI) CleanupSubTasks ¶
func (s *BaseAPI) CleanupSubTasks(ctx context.Context, problemID int) *StatusError
CleanupSubtasks removes all subtasks from a problem that do not have any tests
func (*BaseAPI) Close ¶
func (s *BaseAPI) Close() *StatusError
func (*BaseAPI) ConfirmVerificationEmail ¶
func (s *BaseAPI) ConfirmVerificationEmail(vid string, user *kilonova.UserBrief) *StatusError
func (*BaseAPI) ContestAnnouncement ¶
func (s *BaseAPI) ContestAnnouncement(ctx context.Context, id int) (*kilonova.ContestAnnouncement, *StatusError)
func (*BaseAPI) ContestAnnouncements ¶
func (s *BaseAPI) ContestAnnouncements(ctx context.Context, contestID int) ([]*kilonova.ContestAnnouncement, *StatusError)
func (*BaseAPI) ContestCount ¶
func (s *BaseAPI) ContestCount(ctx context.Context, filter kilonova.ContestFilter) (int, *StatusError)
func (*BaseAPI) ContestInvitation ¶
func (s *BaseAPI) ContestInvitation(ctx context.Context, id string) (*kilonova.ContestInvitation, *StatusError)
func (*BaseAPI) ContestInvitations ¶
func (s *BaseAPI) ContestInvitations(ctx context.Context, contestID int) ([]*kilonova.ContestInvitation, *StatusError)
func (*BaseAPI) ContestLeaderboard ¶
func (s *BaseAPI) ContestLeaderboard(ctx context.Context, contest *kilonova.Contest, freezeTime *time.Time, filter kilonova.UserFilter) (*kilonova.ContestLeaderboard, *StatusError)
func (*BaseAPI) ContestMaxScore ¶
func (*BaseAPI) ContestProblem ¶
func (*BaseAPI) ContestProblems ¶
func (s *BaseAPI) ContestProblems(ctx context.Context, contest *kilonova.Contest, lookingUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)
NOTE: This function is assumed to be used only for the looking user. As such, freeze times are bypassed and the current scores are shown.
func (*BaseAPI) ContestQuestion ¶
func (s *BaseAPI) ContestQuestion(ctx context.Context, id int) (*kilonova.ContestQuestion, *StatusError)
func (*BaseAPI) ContestQuestions ¶
func (s *BaseAPI) ContestQuestions(ctx context.Context, contestID int) ([]*kilonova.ContestQuestion, *StatusError)
func (*BaseAPI) ContestRegistration ¶
func (s *BaseAPI) ContestRegistration(ctx context.Context, contestID, userID int) (*kilonova.ContestRegistration, *StatusError)
func (*BaseAPI) ContestRegistrationCount ¶
func (*BaseAPI) ContestRegistrations ¶
func (s *BaseAPI) ContestRegistrations(ctx context.Context, contestID int, fuzzyName *string, inviteID *string, limit, offset int) ([]*kilonova.ContestRegistration, *StatusError)
func (*BaseAPI) ContestUserQuestions ¶
func (s *BaseAPI) ContestUserQuestions(ctx context.Context, contestID, userID int) ([]*kilonova.ContestQuestion, *StatusError)
func (*BaseAPI) Contests ¶
func (s *BaseAPI) Contests(ctx context.Context, filter kilonova.ContestFilter) ([]*kilonova.Contest, *StatusError)
func (*BaseAPI) CountBlogPosts ¶
func (s *BaseAPI) CountBlogPosts(ctx context.Context, filter kilonova.BlogPostFilter) (int, *StatusError)
func (*BaseAPI) CountSessions ¶ added in v0.25.0
func (s *BaseAPI) CountSessions(ctx context.Context, filter *SessionFilter) (int, *StatusError)
func (*BaseAPI) CountUsers ¶
func (s *BaseAPI) CountUsers(ctx context.Context, filter kilonova.UserFilter) (int, *StatusError)
func (*BaseAPI) CreateBlogPost ¶
func (*BaseAPI) CreateBlogPostAttachment ¶
func (s *BaseAPI) CreateBlogPostAttachment(ctx context.Context, att *kilonova.Attachment, postID int, r io.Reader, authorID *int) *StatusError
func (*BaseAPI) CreateContest ¶
func (s *BaseAPI) CreateContest(ctx context.Context, name string, cType kilonova.ContestType, author *UserBrief) (int, *StatusError)
func (*BaseAPI) CreateContestAnnouncement ¶
func (*BaseAPI) CreateContestInvitation ¶
func (*BaseAPI) CreateContestQuestion ¶
func (*BaseAPI) CreatePaste ¶
func (s *BaseAPI) CreatePaste(ctx context.Context, sub *kilonova.Submission, user *kilonova.UserBrief) (string, *StatusError)
func (*BaseAPI) CreateProblem ¶
func (s *BaseAPI) CreateProblem(ctx context.Context, title string, author *UserBrief, consoleInput bool) (*kilonova.Problem, *StatusError)
CreateProblem is the simple way of creating a new problem. Just provide a title, an author and the type of input. The other stuff will be automatically set for sensible defaults.
func (*BaseAPI) CreateProblemAttachment ¶
func (s *BaseAPI) CreateProblemAttachment(ctx context.Context, att *kilonova.Attachment, problemID int, r io.Reader, authorID *int) *StatusError
func (*BaseAPI) CreateProblemList ¶
func (s *BaseAPI) CreateProblemList(ctx context.Context, pblist *kilonova.ProblemList) *StatusError
func (*BaseAPI) CreateSession ¶
func (*BaseAPI) CreateSubTask ¶
func (*BaseAPI) CreateSubmission ¶
func (s *BaseAPI) CreateSubmission(ctx context.Context, author *UserFull, problem *kilonova.Problem, code []byte, lang eval.Language, contestID *int, bypassSubCount bool) (int, *StatusError)
CreateSubmission produces a new submission and also creates the necessary subtests
func (*BaseAPI) CreateTest ¶
func (*BaseAPI) DelAttachmentRenders ¶
func (*BaseAPI) DeleteBlogPost ¶
func (*BaseAPI) DeleteBlogPostAtts ¶
func (*BaseAPI) DeleteContest ¶
func (*BaseAPI) DeleteContestAnnouncement ¶
func (s *BaseAPI) DeleteContestAnnouncement(ctx context.Context, announcementID int) *StatusError
func (*BaseAPI) DeletePaste ¶
func (s *BaseAPI) DeletePaste(ctx context.Context, id string) *StatusError
func (*BaseAPI) DeleteProblem ¶
func (*BaseAPI) DeleteProblemAtts ¶
func (*BaseAPI) DeleteProblemList ¶
func (s *BaseAPI) DeleteProblemList(ctx context.Context, id int) *StatusError
func (*BaseAPI) DeleteSubTask ¶
func (s *BaseAPI) DeleteSubTask(ctx context.Context, subtaskID int) *StatusError
func (*BaseAPI) DeleteSubTasks ¶
func (s *BaseAPI) DeleteSubTasks(ctx context.Context, problemID int) *StatusError
func (*BaseAPI) DeleteSubmission ¶
func (s *BaseAPI) DeleteSubmission(ctx context.Context, subID int) *StatusError
func (*BaseAPI) DeleteTest ¶
func (s *BaseAPI) DeleteTest(ctx context.Context, id int) *StatusError
Please note that this function does not properly ensure that subtasks would be cleaned up afterwards. This is left as an exercise to the caller
func (*BaseAPI) DeleteTests ¶
func (s *BaseAPI) DeleteTests(ctx context.Context, problemID int) *StatusError
func (*BaseAPI) DeleteUser ¶
func (*BaseAPI) EvictionLogger ¶ added in v0.25.0
func (*BaseAPI) ExtendSession ¶
func (*BaseAPI) FinalizePasswordReset ¶
func (*BaseAPI) FormatDescName ¶ added in v0.25.0
func (*BaseAPI) FullProblemList ¶
func (s *BaseAPI) FullProblemList(ctx context.Context, listID int, user *kilonova.UserBrief, lookingUser *kilonova.UserBrief) (*FullProblemList, *StatusError)
FullProblemList returns an entire problem list DAG. The operation will probably be slow. Note that recursion to a "higher" level is automatically stripped
func (*BaseAPI) FullSubmission ¶
func (s *BaseAPI) FullSubmission(ctx context.Context, subid int) (*FullSubmission, *StatusError)
FullSubmission gets the submission regardless of if there is a user watching or not
func (*BaseAPI) GenerateUser ¶
func (s *BaseAPI) GenerateUser(ctx context.Context, uname, pwd, lang string, theme kilonova.PreferredTheme, displayName *string, email *string, bio string) (*kilonova.UserFull, *StatusError)
TODO: displayName probably doesn't have to be *string, can be just string, but this was implemented quickly
func (*BaseAPI) GetAttachmentRender ¶
func (*BaseAPI) GetAuditLogs ¶
func (*BaseAPI) GetAvatar ¶
func (s *BaseAPI) GetAvatar(email string, size int, maxLastMod time.Time) (io.ReadSeekCloser, time.Time, bool, error)
GetAvatar wraps DataStore's GetAvatar if manager.GetAvatar errors out or is not valid, it fetches the gravatar from the web
func (*BaseAPI) GetLogCount ¶
func (s *BaseAPI) GetLogCount(ctx context.Context) (int, *StatusError)
func (*BaseAPI) GetPwdResetRequestUser ¶
func (*BaseAPI) GetRequestInfo ¶ added in v0.25.0
func (*BaseAPI) GetSession ¶
Please note that, when unauthed, GetSession will return a session with UserID set to -1
func (*BaseAPI) GetVerificationUser ¶
func (*BaseAPI) IsBlogPostEditor ¶
func (*BaseAPI) IsBlogPostVisible ¶
NOTE: This must be in sync with the visible_posts PSQL function TODO: Refactor into method of *kilonova.BlogPost
func (*BaseAPI) IsContestEditor ¶
TODO: Refactor into method of *kilonova.Contest
func (*BaseAPI) IsContestTester ¶
Tester = Testers + Editors + Admins TODO: Refactor into method of *kilonova.Contest
func (*BaseAPI) IsContestVisible ¶
func (*BaseAPI) IsPasteEditor ¶
TODO: Refactor into method of *kilonova.SubmissionPaste
func (*BaseAPI) IsProblemEditor ¶
func (*BaseAPI) IsProblemFullyVisible ¶
Full visibility is currently used for:
- problem statistics;
- submission code visibility;
- tag visibility;
- ability to add problems to contests;
- problem archive availability (however, some stuff like private attachments or tests depend on further privileges).
func (*BaseAPI) IsProblemVisible ¶
func (*BaseAPI) IsSubmissionEditor ¶
TODO: Refactor into method of *kilonova.Submission
func (*BaseAPI) KickUserFromContest ¶
func (s *BaseAPI) KickUserFromContest(ctx context.Context, contestID, userID int) *StatusError
func (*BaseAPI) LastSubmissionTime ¶ added in v0.25.0
func (s *BaseAPI) LastSubmissionTime(ctx context.Context, filter kilonova.SubmissionFilter) (*time.Time, *StatusError)
func (*BaseAPI) LogSystemAction ¶
func (*BaseAPI) LogToDiscord ¶
func (*BaseAPI) LogUserAction ¶
func (*BaseAPI) LogVerbose ¶
func (*BaseAPI) MOSSSubmissions ¶ added in v0.25.0
func (s *BaseAPI) MOSSSubmissions(ctx context.Context, contestID int) ([]*kilonova.MOSSSubmission, *StatusError)
func (*BaseAPI) MailerEnabled ¶
func (*BaseAPI) MaxScoreSubID ¶
func (*BaseAPI) MaximumScoreSubTaskTests ¶
func (*BaseAPI) MaximumScoreSubTasks ¶
func (s *BaseAPI) MaximumScoreSubTasks(ctx context.Context, problemID, userID int, contestID *int) ([]*kilonova.SubmissionSubTask, *StatusError)
func (*BaseAPI) MergeTags ¶
original - the OG that will remain after the merge toReplace - the one that will be replaced
func (*BaseAPI) MustSolveCaptcha ¶ added in v0.25.0
func (*BaseAPI) NewCaptchaID ¶ added in v0.25.0
func (*BaseAPI) NumSolvedFromPblist ¶
func (*BaseAPI) NumSolvedFromPblists ¶
func (*BaseAPI) PblistChildrenLists ¶
func (s *BaseAPI) PblistChildrenLists(ctx context.Context, problemListID int) ([]*kilonova.ProblemList, *StatusError)
func (*BaseAPI) PblistParentLists ¶
func (s *BaseAPI) PblistParentLists(ctx context.Context, problemListID int) ([]*kilonova.ProblemList, *StatusError)
func (*BaseAPI) ProblemAttByName ¶
func (s *BaseAPI) ProblemAttByName(ctx context.Context, problemID int, name string) (*kilonova.Attachment, *StatusError)
func (*BaseAPI) ProblemAttDataByName ¶
func (*BaseAPI) ProblemAttachment ¶
func (s *BaseAPI) ProblemAttachment(ctx context.Context, problemID, attachmentID int) (*kilonova.Attachment, *StatusError)
func (*BaseAPI) ProblemAttachments ¶
func (s *BaseAPI) ProblemAttachments(ctx context.Context, problemID int) ([]*kilonova.Attachment, *StatusError)
func (*BaseAPI) ProblemChecklist ¶
func (s *BaseAPI) ProblemChecklist(ctx context.Context, pbid int) (*kilonova.ProblemChecklist, *StatusError)
func (*BaseAPI) ProblemDescVariants ¶
func (s *BaseAPI) ProblemDescVariants(ctx context.Context, problemID int, getPrivate bool) ([]*kilonova.StatementVariant, *StatusError)
func (*BaseAPI) ProblemEditors ¶
func (*BaseAPI) ProblemList ¶
func (s *BaseAPI) ProblemList(ctx context.Context, id int) (*kilonova.ProblemList, *StatusError)
func (*BaseAPI) ProblemListByName ¶
func (s *BaseAPI) ProblemListByName(ctx context.Context, name string) (*kilonova.ProblemList, *StatusError)
func (*BaseAPI) ProblemListProblems ¶
func (s *BaseAPI) ProblemListProblems(ctx context.Context, ids []int, lookingUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)
Returns a list of problems in the slice's order
func (*BaseAPI) ProblemLists ¶
func (s *BaseAPI) ProblemLists(ctx context.Context, filter kilonova.ProblemListFilter) ([]*kilonova.ProblemList, *StatusError)
func (*BaseAPI) ProblemParentLists ¶
func (s *BaseAPI) ProblemParentLists(ctx context.Context, problemID int, showHidable bool) ([]*kilonova.ProblemList, *StatusError)
func (*BaseAPI) ProblemRunningContests ¶
func (*BaseAPI) ProblemSettings ¶
func (s *BaseAPI) ProblemSettings(ctx context.Context, problemID int) (*kilonova.ProblemEvalSettings, *StatusError)
func (*BaseAPI) ProblemStatistics ¶
func (s *BaseAPI) ProblemStatistics(ctx context.Context, problem *kilonova.Problem, lookingUser *UserBrief) (*ProblemStatistics, *StatusError)
func (*BaseAPI) ProblemTags ¶
func (*BaseAPI) ProblemViewers ¶
func (*BaseAPI) Problems ¶
func (s *BaseAPI) Problems(ctx context.Context, filter kilonova.ProblemFilter) ([]*kilonova.Problem, *StatusError)
When editing Problems, please edit ScoredProblems as well
func (*BaseAPI) PurgeTestData ¶
func (*BaseAPI) RawSubmission ¶
func (s *BaseAPI) RawSubmission(ctx context.Context, id int) (*kilonova.Submission, *StatusError)
Remember to do proper authorization when using this
func (*BaseAPI) RawSubmissionCode ¶ added in v0.25.0
func (*BaseAPI) RawSubmissions ¶
func (s *BaseAPI) RawSubmissions(ctx context.Context, filter kilonova.SubmissionFilter) ([]*kilonova.Submission, *StatusError)
Should only ever be used for grader stuff
func (*BaseAPI) RegisterContestUser ¶
func (*BaseAPI) RegisterGrader ¶
func (s *BaseAPI) RegisterGrader(gr interface{ Wake() })
func (*BaseAPI) RelevantTags ¶
func (*BaseAPI) RemainingSubmissionCount ¶
func (s *BaseAPI) RemainingSubmissionCount(ctx context.Context, contest *kilonova.Contest, problem *kilonova.Problem, user *kilonova.UserBrief) (int, *StatusError)
TODO: Either use in multiple places or remove
func (*BaseAPI) RemoveSession ¶
func (s *BaseAPI) RemoveSession(ctx context.Context, sid string) *StatusError
func (*BaseAPI) RemoveUserSessions ¶ added in v0.25.0
func (s *BaseAPI) RemoveUserSessions(ctx context.Context, uid int) *StatusError
func (*BaseAPI) RenderMarkdown ¶
func (s *BaseAPI) RenderMarkdown(src []byte, ctx *kilonova.RenderContext) ([]byte, *StatusError)
func (*BaseAPI) RenderedBlogPostDesc ¶
func (*BaseAPI) RenderedProblemDesc ¶
func (*BaseAPI) ResetProblemSubmissions ¶
func (*BaseAPI) ResetSubmission ¶
func (s *BaseAPI) ResetSubmission(ctx context.Context, id int) *StatusError
func (*BaseAPI) ResetWaitingSubmissions ¶
func (s *BaseAPI) ResetWaitingSubmissions(ctx context.Context) *StatusError
func (*BaseAPI) SaveAttachmentRender ¶
func (*BaseAPI) SaveAvatar ¶
SaveAvatar wraps DataStore's SaveAvatar if r is nil, it fetches the gravatar from the web
func (*BaseAPI) SaveTestOutput ¶
func (*BaseAPI) ScoredProblems ¶
func (s *BaseAPI) ScoredProblems(ctx context.Context, filter kilonova.ProblemFilter, scoreUser *kilonova.UserBrief, editorUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)
func (*BaseAPI) SearchProblems ¶
func (s *BaseAPI) SearchProblems(ctx context.Context, filter kilonova.ProblemFilter, scoreUser *kilonova.UserBrief, editorUser *kilonova.UserBrief) ([]*FullProblem, int, *StatusError)
SearchProblems is like the functions above but returns more detailed results for problems
func (*BaseAPI) SendMail ¶ added in v0.25.0
func (s *BaseAPI) SendMail(msg *kilonova.MailerMessage) *StatusError
func (*BaseAPI) SendPasswordResetEmail ¶
func (s *BaseAPI) SendPasswordResetEmail(ctx context.Context, userID int, name, email string) *StatusError
SendPasswordResetEmail sends a password reset email to the user. Please provide a good context.
func (*BaseAPI) SendVerificationEmail ¶
func (s *BaseAPI) SendVerificationEmail(ctx context.Context, userID int, name, email string) *StatusError
SendVerificationEmail updates the user metadata with an unverified email status and sends an email with the hard-coded template to the desired user. Please provide a good context.
NOTE: I think the user update breaks some single responsibility principle or something, but I think most places this could be used also does this, so meh.
If `email` is different than the user's email, the email address is also updated.
func (*BaseAPI) SessionDevices ¶ added in v0.25.0
func (s *BaseAPI) SessionDevices(ctx context.Context, sid string) ([]*SessionDevice, *StatusError)
func (*BaseAPI) SessionUser ¶
func (s *BaseAPI) SessionUser(ctx context.Context, sid string, r *http.Request) (*kilonova.UserFull, *StatusError)
Cached function Should be called only in session initialization
func (*BaseAPI) Sessions ¶ added in v0.25.0
func (s *BaseAPI) Sessions(ctx context.Context, filter *SessionFilter) ([]*Session, *StatusError)
func (*BaseAPI) SetForceUsernameChange ¶
func (*BaseAPI) SetProposer ¶
func (*BaseAPI) SetUserLockout ¶
func (*BaseAPI) SolvedProblems
deprecated
func (s *BaseAPI) SolvedProblems(ctx context.Context, user *kilonova.UserBrief, lookingUser *kilonova.UserBrief) ([]*kilonova.ScoredProblem, *StatusError)
Deprecated: TODO: Remove
func (*BaseAPI) StartContestRegistration ¶
func (*BaseAPI) StripContestAccess ¶
func (*BaseAPI) StripProblemAccess ¶
func (*BaseAPI) SubTasksByTest ¶
func (*BaseAPI) Submission ¶
func (s *BaseAPI) Submission(ctx context.Context, subid int, lookingUser *UserBrief) (*FullSubmission, *StatusError)
func (*BaseAPI) SubmissionCode ¶ added in v0.25.0
func (*BaseAPI) SubmissionPaste ¶
func (s *BaseAPI) SubmissionPaste(ctx context.Context, id string) (*kilonova.SubmissionPaste, *StatusError)
func (*BaseAPI) SubmissionSubTasks ¶
func (s *BaseAPI) SubmissionSubTasks(ctx context.Context, subID int) ([]*kilonova.SubmissionSubTask, *StatusError)
func (*BaseAPI) Submissions ¶
func (s *BaseAPI) Submissions(ctx context.Context, filter kilonova.SubmissionFilter, look bool, lookingUser *UserBrief) (*Submissions, *StatusError)
func (*BaseAPI) SubtestReader ¶
func (s *BaseAPI) SubtestReader(subtest int) (io.ReadCloser, error)
func (*BaseAPI) TagByLooseName ¶
func (*BaseAPI) TagsByType ¶
func (*BaseAPI) TestInput ¶
func (s *BaseAPI) TestInput(testID int) (io.ReadCloser, error)
NOTE: If changing filename format, make sure to also change when directly accessing
func (*BaseAPI) TestOutput ¶
func (s *BaseAPI) TestOutput(testID int) (io.ReadCloser, error)
func (*BaseAPI) ToggleDeepPbListProblems ¶
func (s *BaseAPI) ToggleDeepPbListProblems(ctx context.Context, list *kilonova.ProblemList, deep bool, upd kilonova.ProblemUpdate) *kilonova.StatusError
func (*BaseAPI) UpdateAttachment ¶
func (s *BaseAPI) UpdateAttachment(ctx context.Context, aid int, upd *kilonova.AttachmentUpdate) *StatusError
func (*BaseAPI) UpdateAttachmentData ¶
func (*BaseAPI) UpdateBlogPost ¶
func (s *BaseAPI) UpdateBlogPost(ctx context.Context, id int, upd kilonova.BlogPostUpdate) *StatusError
func (*BaseAPI) UpdateConfig ¶
func (s *BaseAPI) UpdateConfig(ctx context.Context, upd ConfigUpdate) *StatusError
func (*BaseAPI) UpdateContest ¶
func (s *BaseAPI) UpdateContest(ctx context.Context, id int, upd kilonova.ContestUpdate) *kilonova.StatusError
func (*BaseAPI) UpdateContestAnnouncement ¶
func (*BaseAPI) UpdateContestInvitation ¶
func (*BaseAPI) UpdateContestProblems ¶
func (*BaseAPI) UpdateProblem ¶
func (s *BaseAPI) UpdateProblem(ctx context.Context, id int, args kilonova.ProblemUpdate, updater *kilonova.UserBrief) *StatusError
`updater` is an optional parameter, specifying the author of the change. It handles the visibility change option. Visibility is the only parameter that can not be updated by a mere problem editor, it requires admin permissions! Please note that, if updater is not specified, the function won't attempt to ensure correct permissions for visibility.
func (*BaseAPI) UpdateProblemList ¶
func (s *BaseAPI) UpdateProblemList(ctx context.Context, id int, upd kilonova.ProblemListUpdate) *StatusError
func (*BaseAPI) UpdateProblemListProblems ¶
func (*BaseAPI) UpdateProblemListSublists ¶
func (*BaseAPI) UpdateProblemTags ¶
func (*BaseAPI) UpdateSubTask ¶
func (s *BaseAPI) UpdateSubTask(ctx context.Context, id int, upd kilonova.SubTaskUpdate) *StatusError
func (*BaseAPI) UpdateSubTaskTests ¶
func (*BaseAPI) UpdateSubTest ¶
func (s *BaseAPI) UpdateSubTest(ctx context.Context, id int, upd kilonova.SubTestUpdate) *StatusError
func (*BaseAPI) UpdateSubmission ¶
func (s *BaseAPI) UpdateSubmission(ctx context.Context, id int, status kilonova.SubmissionUpdate) *StatusError
func (*BaseAPI) UpdateSubmissionSubtaskPercentage ¶
func (*BaseAPI) UpdateTagName ¶
func (*BaseAPI) UpdateTagType ¶
func (*BaseAPI) UpdateTest ¶
func (s *BaseAPI) UpdateTest(ctx context.Context, testID int, upd kilonova.TestUpdate) *StatusError
func (*BaseAPI) UpdateUser ¶
func (s *BaseAPI) UpdateUser(ctx context.Context, userID int, upd kilonova.UserUpdate) *StatusError
func (*BaseAPI) UpdateUserPassword ¶
func (*BaseAPI) UpdateUsername ¶
func (s *BaseAPI) UpdateUsername(ctx context.Context, userID int, newName string, checkUsed bool, fromAdmin bool) *StatusError
fromAdmin also should include the forced username changes
func (*BaseAPI) UserBlogPosts ¶
func (*BaseAPI) UserBriefByName ¶
func (*BaseAPI) UserContestFreezeTime ¶
func (s *BaseAPI) UserContestFreezeTime(user *kilonova.UserBrief, contest *kilonova.Contest, showFrozen bool) *time.Time
The leaderboards are not frozen if:
- No freeze time is set
- Current moment is before freeze time
- User is contest editor
Otherwise, leaderboard should be frozen Also, in case the editor wants to see the frozen leaderboard, an option is provided
func (*BaseAPI) UserFullByEmail ¶
func (*BaseAPI) UserFullByName ¶
func (*BaseAPI) UserSessions ¶
func (*BaseAPI) UsernameChangeHistory ¶
func (s *BaseAPI) UsernameChangeHistory(ctx context.Context, userID int) ([]*kilonova.UsernameChange, *StatusError)
func (*BaseAPI) UsersBrief ¶
func (s *BaseAPI) UsersBrief(ctx context.Context, filter kilonova.UserFilter) ([]*UserBrief, *StatusError)
func (*BaseAPI) VerifyUserPassword ¶
func (*BaseAPI) VisibleFutureContests ¶
func (*BaseAPI) VisibleRunningContests ¶
func (*BaseAPI) WakeGrader ¶
func (s *BaseAPI) WakeGrader()
type ConfigUpdate ¶
type FullProblem ¶
type FullProblemList ¶
type FullProblemList struct { kilonova.ProblemList Problems []*kilonova.ScoredProblem `json:"problems"` SubLists []*FullProblemList `json:"problem_lists"` SolvedCount int `json:"solved_count"` DepthLevel int `json:"depth_level"` Root bool `json:"root"` }
type FullSubmission ¶
type FullSubmission = kilonova.FullSubmission
type ProblemStatistics ¶
type ProblemStatistics struct { NumSolved int `json:"num_solved"` NumAttempted int `json:"num_attempted"` SizeLeaderboard *Submissions `json:"size_leaderboard"` MemoryLeaderboard *Submissions `json:"memory_leaderboard"` TimeLeaderboard *Submissions `json:"time_leaderboard"` }
type SessionDevice ¶ added in v0.25.0
type SessionFilter ¶ added in v0.25.0
type SessionFilter = db.SessionFilter
type StatusError ¶
type StatusError = kilonova.StatusError
func WrapError ¶
func WrapError(err error, text string) *StatusError
type Submissions ¶
Source Files ¶
- admin.go
- attachment.go
- auth.go
- base.go
- blogpost.go
- captcha.go
- config.go
- contest.go
- contest_qna.go
- contest_registrations.go
- datastore.go
- donations.go
- filters.go
- forgot_pwd.go
- markdown.go
- pblist.go
- problem.go
- session.go
- status.go
- submission.go
- subtask.go
- subtest.go
- tags.go
- test.go
- user.go
- verification.go