2017-11-10 03:33:11 +00:00
package common
import (
"html/template"
2017-11-29 02:34:02 +00:00
"net/http"
2018-08-16 05:27:26 +00:00
"runtime"
2017-11-10 03:33:11 +00:00
"sync"
"time"
2018-11-01 06:43:56 +00:00
2019-08-14 10:39:04 +00:00
p "github.com/Azareal/Gosora/common/phrases"
2017-11-10 03:33:11 +00:00
)
2019-04-02 07:43:11 +00:00
/ * type HResource struct {
2019-03-21 22:59:41 +00:00
Name string
Hash string
2019-04-02 07:43:11 +00:00
} * /
2019-03-21 22:59:41 +00:00
2019-08-14 10:39:04 +00:00
// TODO: Allow resources in spots other than /s/ and possibly even external domains (e.g. CDNs)
2018-04-04 04:49:13 +00:00
// TODO: Preload Trumboyg on Cosora on the forum list
2018-04-22 12:33:56 +00:00
type Header struct {
2018-11-29 07:27:17 +00:00
Title string
//Title []byte // Experimenting with []byte for increased efficiency, let's avoid converting too many things to []byte, as it involves a lot of extra boilerplate
2019-02-28 07:28:17 +00:00
NoticeList [ ] string
2019-04-02 07:43:11 +00:00
Scripts [ ] string
PreScriptsAsync [ ] string
ScriptsAsync [ ] string
2018-06-24 13:49:29 +00:00
//Preload []string
2019-04-02 07:43:11 +00:00
Stylesheets [ ] string
2017-11-10 03:33:11 +00:00
Widgets PageWidgets
2017-11-11 04:06:16 +00:00
Site * site
2017-11-13 09:23:43 +00:00
Settings SettingMap
2017-12-01 02:04:29 +00:00
Themes map [ string ] * Theme // TODO: Use a slice containing every theme instead of the main map for speed?
Theme * Theme
2017-11-10 03:33:11 +00:00
//TemplateName string // TODO: Use this to move template calls to the router rather than duplicating them over and over and over?
2018-06-06 00:21:22 +00:00
CurrentUser User // TODO: Deprecate CurrentUser on the page structs and use a pointer here
2018-10-21 13:54:32 +00:00
Hooks * HookTable
2018-04-22 12:33:56 +00:00
Zone string
2019-01-21 12:27:59 +00:00
ZoneID int
ZoneData interface { }
2018-10-14 05:08:44 +00:00
Path string
2018-04-22 12:33:56 +00:00
MetaDesc string
2019-02-23 06:29:19 +00:00
//OGImage string
2019-02-28 07:28:17 +00:00
OGDesc string
GoogSiteVerify string
2019-04-09 07:21:00 +00:00
IsoCode string
2019-02-28 07:28:17 +00:00
LooseCSP bool
StartedAt time . Time
Elapsed1 string
Writer http . ResponseWriter
ExtData ExtData
2017-11-10 03:33:11 +00:00
}
2019-08-14 10:39:04 +00:00
func ( h * Header ) AddScript ( name string ) {
2019-08-20 08:44:37 +00:00
if name [ 0 ] == '/' && name [ 1 ] != '/' {
// TODO: Use a secondary static file map to avoid this concatenation?
file , ok := StaticFiles . Get ( "/s/" + name )
2019-03-21 22:59:41 +00:00
if ok {
2019-08-20 08:44:37 +00:00
name = file . OName
2019-03-21 22:59:41 +00:00
}
}
2019-08-20 08:44:37 +00:00
//log.Print("name:", name)
h . Scripts = append ( h . Scripts , name )
2018-04-04 04:49:13 +00:00
}
2019-08-14 10:39:04 +00:00
func ( h * Header ) AddPreScriptAsync ( name string ) {
2019-08-20 08:44:37 +00:00
if name [ 0 ] == '/' && name [ 1 ] != '/' {
file , ok := StaticFiles . Get ( "/s/" + name )
2019-03-21 22:59:41 +00:00
if ok {
2019-08-20 08:44:37 +00:00
name = file . OName
2019-03-21 22:59:41 +00:00
}
}
2019-08-20 08:44:37 +00:00
h . PreScriptsAsync = append ( h . PreScriptsAsync , name )
2019-03-21 22:59:41 +00:00
}
2019-08-14 10:39:04 +00:00
func ( h * Header ) AddScriptAsync ( name string ) {
2019-08-20 08:44:37 +00:00
if name [ 0 ] == '/' && name [ 1 ] != '/' {
file , ok := StaticFiles . Get ( "/s/" + name )
2019-03-21 22:59:41 +00:00
if ok {
2019-08-20 08:44:37 +00:00
name = file . OName
2019-03-21 22:59:41 +00:00
}
}
2019-08-20 08:44:37 +00:00
h . ScriptsAsync = append ( h . ScriptsAsync , name )
2019-02-28 07:28:17 +00:00
}
2019-08-14 10:39:04 +00:00
/ * func ( h * Header ) Preload ( name string ) {
h . Preload = append ( h . Preload , name )
2018-04-04 04:49:13 +00:00
} * /
2019-08-14 10:39:04 +00:00
func ( h * Header ) AddSheet ( name string ) {
2019-08-20 08:44:37 +00:00
if name [ 0 ] == '/' && name [ 1 ] != '/' {
file , ok := StaticFiles . Get ( "/s/" + name )
2019-03-24 07:23:38 +00:00
if ok {
2019-08-20 08:44:37 +00:00
name = file . OName
2019-03-24 07:23:38 +00:00
}
}
2019-08-20 08:44:37 +00:00
h . Stylesheets = append ( h . Stylesheets , name )
2018-04-04 04:49:13 +00:00
}
2019-08-14 10:39:04 +00:00
func ( h * Header ) AddNotice ( name string ) {
h . NoticeList = append ( h . NoticeList , p . GetNoticePhrase ( name ) )
2018-06-06 00:21:22 +00:00
}
2017-11-10 03:33:11 +00:00
// TODO: Add this to routes which don't use templates. E.g. Json APIs.
type HeaderLite struct {
2017-11-11 04:06:16 +00:00
Site * site
2017-11-10 03:33:11 +00:00
Settings SettingMap
2018-10-21 13:54:32 +00:00
Hooks * HookTable
2017-11-10 03:33:11 +00:00
ExtData ExtData
}
type PageWidgets struct {
LeftSidebar template . HTML
RightSidebar template . HTML
}
// TODO: Add a ExtDataHolder interface with methods for manipulating the contents?
// ? - Could we use a sync.Map instead?
type ExtData struct {
2017-11-11 04:06:16 +00:00
Items map [ string ] interface { } // Key: pluginname
2017-11-10 03:33:11 +00:00
sync . RWMutex
}
type Page struct {
2018-06-06 00:21:22 +00:00
* Header
ItemList [ ] interface { }
Something interface { }
}
type SimplePage struct {
* Header
}
type ErrorPage struct {
* Header
Message string
2017-11-10 03:33:11 +00:00
}
2018-04-22 12:33:56 +00:00
type Paginator struct {
PageList [ ] int
Page int
LastPage int
}
2018-06-06 00:21:22 +00:00
type CustomPagePage struct {
* Header
Page * CustomPage
}
2019-04-11 05:46:57 +00:00
type TopicCEditPost struct {
2019-04-17 01:57:31 +00:00
ID int
2019-04-11 05:46:57 +00:00
Source string
Ref string
}
2019-04-15 01:54:13 +00:00
type TopicCAttachItem struct {
ID int
ImgSrc string
Path string
FullPath string
}
2019-06-16 07:26:31 +00:00
type TopicCPollInput struct {
Index int
2019-06-16 23:36:31 +00:00
Place string
2019-06-16 07:26:31 +00:00
}
2019-04-11 05:46:57 +00:00
2017-11-10 03:33:11 +00:00
type TopicPage struct {
2018-05-27 09:36:35 +00:00
* Header
2019-05-17 08:40:41 +00:00
ItemList [ ] * ReplyUser
2018-05-27 09:36:35 +00:00
Topic TopicUser
2018-08-30 10:31:21 +00:00
Forum * Forum
2018-05-27 09:36:35 +00:00
Poll Poll
2018-12-17 04:58:55 +00:00
Paginator
2017-11-10 03:33:11 +00:00
}
2018-09-20 08:56:50 +00:00
type TopicListSort struct {
SortBy string // lastupdate, mostviewed, mostviewedtoday, mostviewedthisweek, mostviewedthismonth
Ascending bool
}
2018-04-22 12:33:56 +00:00
type TopicListPage struct {
* Header
2017-11-10 03:33:11 +00:00
TopicList [ ] * TopicsRow
ForumList [ ] Forum
DefaultForum int
2018-09-20 08:56:50 +00:00
Sort TopicListSort
2018-04-22 12:33:56 +00:00
Paginator
2017-11-10 03:33:11 +00:00
}
type ForumPage struct {
2018-05-27 09:36:35 +00:00
* Header
ItemList [ ] * TopicsRow
Forum * Forum
2018-04-22 12:33:56 +00:00
Paginator
2017-11-10 03:33:11 +00:00
}
type ForumsPage struct {
2018-06-01 05:02:29 +00:00
* Header
ItemList [ ] Forum
2017-11-10 03:33:11 +00:00
}
type ProfilePage struct {
2018-06-01 05:02:29 +00:00
* Header
2019-05-17 08:40:41 +00:00
ItemList [ ] * ReplyUser
2017-11-10 03:33:11 +00:00
ProfileOwner User
2018-10-08 05:34:25 +00:00
CurrentScore int
NextScore int
2017-11-10 03:33:11 +00:00
}
type CreateTopicPage struct {
2018-06-01 05:02:29 +00:00
* Header
ItemList [ ] Forum
FID int
2017-11-10 03:33:11 +00:00
}
type IPSearchPage struct {
2018-06-01 05:02:29 +00:00
* Header
ItemList map [ int ] * User
IP string
2017-11-10 03:33:11 +00:00
}
2018-12-17 04:58:55 +00:00
type Account struct {
* Header
HTMLID string
TmplName string
Inner nobreak
}
2018-05-27 09:36:35 +00:00
type EmailListPage struct {
2018-06-01 05:02:29 +00:00
* Header
2018-12-17 04:58:55 +00:00
ItemList [ ] Email
}
type AccountLoginsPage struct {
* Header
ItemList [ ] LoginLogItem
Paginator
2018-05-27 09:36:35 +00:00
}
2018-06-17 07:28:18 +00:00
type AccountDashPage struct {
* Header
2018-10-08 05:34:25 +00:00
MFASetup bool
CurrentScore int
NextScore int
NextLevel int
2018-10-14 05:08:44 +00:00
Percentage int
2018-06-17 07:28:18 +00:00
}
2018-10-10 07:33:51 +00:00
type LevelListItem struct {
Level int
Score int
Status string
Percentage int // 0 to 200 to fit with the CSS logic
}
type LevelListPage struct {
* Header
Levels [ ] LevelListItem
}
2019-03-11 08:47:45 +00:00
type ResetPage struct {
* Header
UID int
Token string
MFA bool
}
2019-07-26 23:29:42 +00:00
type ConvoListPage struct {
* Header
2019-08-28 06:47:54 +00:00
Convos [ ] * ConversationExtra
2019-07-26 23:29:42 +00:00
Paginator
}
2019-08-14 10:39:04 +00:00
type ConvoViewRow struct {
* ConversationPost
User * User
ClassName string
2019-08-20 22:32:10 +00:00
ContentLines int
CanModify bool
2019-08-14 10:39:04 +00:00
}
2019-07-26 23:29:42 +00:00
type ConvoViewPage struct {
* Header
2019-08-14 10:39:04 +00:00
Convo * Conversation
Posts [ ] ConvoViewRow
2019-08-21 01:31:13 +00:00
Users [ ] * User
2019-07-26 23:29:42 +00:00
Paginator
}
type ConvoCreatePage struct {
* Header
RecpName string
}
2019-04-29 01:28:55 +00:00
/* WIP for dyntmpl */
type Panel struct {
* BasePanelPage
2019-05-13 09:17:44 +00:00
HTMLID string
2019-04-29 06:11:26 +00:00
ClassNames string
2019-05-13 09:17:44 +00:00
TmplName string
Inner nobreak
2019-04-29 01:28:55 +00:00
}
2019-04-29 06:11:26 +00:00
type PanelAnalytics struct {
* BasePanelPage
FormAction string
2019-05-13 09:17:44 +00:00
TmplName string
Inner nobreak
2019-04-29 06:11:26 +00:00
}
2019-05-13 09:17:44 +00:00
type PanelAnalyticsStd struct {
2019-04-29 06:11:26 +00:00
Graph PanelTimeGraph
ViewItems [ ] PanelAnalyticsItem
TimeRange string
Unit string
TimeType string
}
2019-05-13 09:17:44 +00:00
type PanelAnalyticsStdUnit struct {
2019-05-01 06:59:51 +00:00
Graph PanelTimeGraph
ViewItems [ ] PanelAnalyticsItemUnit
TimeRange string
Unit string
TimeType string
}
2019-05-19 01:01:11 +00:00
type PanelAnalyticsActiveMemory struct {
Graph PanelTimeGraph
ViewItems [ ] PanelAnalyticsItemUnit
TimeRange string
Unit string
TimeType string
MemType int
}
2019-04-29 01:28:55 +00:00
2017-11-10 03:33:11 +00:00
type PanelStats struct {
Users int
Groups int
Forums int
2018-06-06 00:21:22 +00:00
Pages int
2017-11-10 03:33:11 +00:00
Settings int
WordFilters int
Themes int
Reports int
}
2018-06-06 00:21:22 +00:00
type BasePanelPage struct {
* Header
Stats PanelStats
Zone string
ReportForumID int
}
2017-11-10 03:33:11 +00:00
type PanelPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
ItemList [ ] interface { }
Something interface { }
2017-11-10 03:33:11 +00:00
}
type GridElement struct {
ID string
2019-05-13 09:17:44 +00:00
Href string
2017-11-10 03:33:11 +00:00
Body string
Order int // For future use
Class string
Background string
TextColour string
Note string
}
2019-06-03 05:26:27 +00:00
type DashGrids struct {
Grid1 [ ] GridElement
Grid2 [ ] GridElement
}
2017-11-10 03:33:11 +00:00
type PanelDashboardPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2019-06-03 05:26:27 +00:00
Grids DashGrids
2017-11-10 03:33:11 +00:00
}
2018-05-27 09:36:35 +00:00
type PanelSetting struct {
* Setting
FriendlyName string
}
type PanelSettingPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2018-05-27 09:36:35 +00:00
ItemList [ ] OptionLabel
Setting * PanelSetting
}
2018-06-06 00:21:22 +00:00
type PanelCustomPagesPage struct {
* BasePanelPage
ItemList [ ] * CustomPage
Paginator
}
type PanelCustomPageEditPage struct {
* BasePanelPage
Page * CustomPage
}
2019-02-23 06:29:19 +00:00
/ * type PanelTimeGraph struct {
2018-01-03 07:46:18 +00:00
Series [ ] int64 // The counts on the left
Labels [ ] int64 // unixtimes for the bottom, gets converted into 1:00, 2:00, etc. with JS
2019-02-23 06:29:19 +00:00
} * /
type PanelTimeGraph struct {
Series [ ] [ ] int64 // The counts on the left
Labels [ ] int64 // unixtimes for the bottom, gets converted into 1:00, 2:00, etc. with JS
Legends [ ] string
2018-01-03 07:46:18 +00:00
}
2018-01-08 08:53:51 +00:00
type PanelAnalyticsItem struct {
Time int64
Count int64
}
2019-05-01 06:59:51 +00:00
type PanelAnalyticsItemUnit struct {
Time int64
Count int64
2019-05-13 09:17:44 +00:00
Unit string
2019-05-01 06:59:51 +00:00
}
2018-01-08 08:53:51 +00:00
2018-01-03 07:46:18 +00:00
type PanelAnalyticsPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2019-02-23 06:29:19 +00:00
Graph PanelTimeGraph
ViewItems [ ] PanelAnalyticsItem
TimeRange string
2019-02-24 01:29:06 +00:00
Unit string
TimeType string
2018-01-03 07:46:18 +00:00
}
2018-01-04 10:23:33 +00:00
type PanelAnalyticsRoutesItem struct {
Route string
Count int
}
type PanelAnalyticsRoutesPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
ItemList [ ] PanelAnalyticsRoutesItem
2019-02-24 01:29:06 +00:00
Graph PanelTimeGraph
2018-06-06 00:21:22 +00:00
TimeRange string
2018-01-05 22:47:13 +00:00
}
2018-01-09 07:39:29 +00:00
2019-02-24 01:29:06 +00:00
// TODO: Rename the fields as this structure is being used in a generic way now
2018-01-09 07:39:29 +00:00
type PanelAnalyticsAgentsItem struct {
2018-02-04 08:15:20 +00:00
Agent string
FriendlyAgent string
Count int
2018-01-09 07:39:29 +00:00
}
type PanelAnalyticsAgentsPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
ItemList [ ] PanelAnalyticsAgentsItem
TimeRange string
2018-01-09 07:39:29 +00:00
}
2018-01-05 22:47:13 +00:00
2019-05-18 00:33:35 +00:00
type PanelAnalyticsReferrersPage struct {
* BasePanelPage
ItemList [ ] PanelAnalyticsAgentsItem
TimeRange string
ShowSpam bool
}
2018-01-05 22:47:13 +00:00
type PanelAnalyticsRoutePage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2019-02-23 06:29:19 +00:00
Route string
Graph PanelTimeGraph
ViewItems [ ] PanelAnalyticsItem
TimeRange string
2018-01-04 10:23:33 +00:00
}
2018-01-10 03:32:48 +00:00
type PanelAnalyticsAgentPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2018-02-15 13:15:27 +00:00
Agent string
2018-02-04 08:15:20 +00:00
FriendlyAgent string
2019-02-23 06:29:19 +00:00
Graph PanelTimeGraph
2018-02-15 13:15:27 +00:00
TimeRange string
2018-01-10 03:32:48 +00:00
}
2019-02-23 06:29:19 +00:00
type PanelAnalyticsDuoPage struct {
* BasePanelPage
ItemList [ ] PanelAnalyticsAgentsItem
Graph PanelTimeGraph
TimeRange string
}
2017-11-10 03:33:11 +00:00
type PanelThemesPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2017-12-01 02:04:29 +00:00
PrimaryThemes [ ] * Theme
VariantThemes [ ] * Theme
2017-11-10 03:33:11 +00:00
}
2018-05-11 05:41:51 +00:00
type PanelMenuListItem struct {
2018-05-15 05:59:52 +00:00
Name string
2018-05-11 05:41:51 +00:00
ID int
ItemCount int
}
type PanelMenuListPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2018-05-11 05:41:51 +00:00
ItemList [ ] PanelMenuListItem
}
2019-01-21 12:27:59 +00:00
type PanelWidgetListPage struct {
* BasePanelPage
Docks map [ string ] [ ] WidgetEdit
BlankWidget WidgetEdit
}
2018-05-11 05:41:51 +00:00
type PanelMenuPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2018-05-13 06:56:59 +00:00
MenuID int
2018-05-11 05:41:51 +00:00
ItemList [ ] MenuItem
}
type PanelMenuItemPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
Item MenuItem
2018-05-11 05:41:51 +00:00
}
2017-11-10 03:33:11 +00:00
type PanelUserPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2018-05-27 09:36:35 +00:00
ItemList [ ] * User
2018-04-22 12:33:56 +00:00
Paginator
2017-11-10 03:33:11 +00:00
}
type PanelGroupPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
ItemList [ ] GroupAdmin
2018-04-22 12:33:56 +00:00
Paginator
2017-11-10 03:33:11 +00:00
}
type PanelEditGroupPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2017-11-10 03:33:11 +00:00
ID int
Name string
Tag string
Rank string
DisableRank bool
}
type GroupForumPermPreset struct {
2018-11-29 07:27:17 +00:00
Group * Group
Preset string
DefaultPreset bool
2017-11-10 03:33:11 +00:00
}
type PanelEditForumPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
ID int
Name string
Desc string
Active bool
Preset string
Groups [ ] GroupForumPermPreset
2017-11-10 03:33:11 +00:00
}
type NameLangToggle struct {
Name string
LangStr string
Toggle bool
}
2018-01-10 03:32:48 +00:00
type PanelEditForumGroupPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
ForumID int
GroupID int
Name string
Desc string
Active bool
Preset string
Perms [ ] NameLangToggle
2018-01-10 03:32:48 +00:00
}
2017-11-10 03:33:11 +00:00
type PanelEditGroupPermsPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
2017-11-10 03:33:11 +00:00
ID int
Name string
LocalPerms [ ] NameLangToggle
GlobalPerms [ ] NameLangToggle
}
2017-11-11 04:06:16 +00:00
type BackupItem struct {
2017-11-10 03:33:11 +00:00
SQLURL string
// TODO: Add an easier to parse format here for Gosora to be able to more easily reimport portions of the dump and to strip unnecessary data (e.g. table defs and parsed post data)
Timestamp time . Time
}
type PanelBackupPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
Backups [ ] BackupItem
2017-11-10 03:33:11 +00:00
}
2018-05-16 10:46:14 +00:00
type PageLogItem struct {
2017-11-10 03:33:11 +00:00
Action template . HTML
IPAddress string
DoneAt string
}
type PanelLogsPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
Logs [ ] PageLogItem
2018-05-16 10:46:14 +00:00
Paginator
}
type PageRegLogItem struct {
RegLogItem
ParsedReason string
}
type PanelRegLogsPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
Logs [ ] PageRegLogItem
2018-04-22 12:33:56 +00:00
Paginator
2017-11-10 03:33:11 +00:00
}
2019-06-01 12:31:48 +00:00
type DebugPageCache struct {
Topics int
Users int
Replies int
TCap int
UCap int
RCap int
TopicListThaw bool
}
type DebugPageDatabase struct {
Topics int
Users int
Replies int
ProfileReplies int
ActivityStream int
2019-06-03 00:35:25 +00:00
Likes int
Attachments int
Polls int
2019-06-05 01:46:45 +00:00
LoginLogs int
RegLogs int
ModLogs int
AdminLogs int
2019-06-03 00:35:25 +00:00
Views int
ViewsAgents int
ViewsForums int
ViewsLangs int
ViewsReferrers int
ViewsSystems int
2019-06-03 05:26:27 +00:00
PostChunks int
TopicChunks int
2019-06-01 12:31:48 +00:00
}
type DebugPageDisk struct {
Static int
Attachments int
Avatars int
Logs int
Backups int
2019-06-16 06:30:58 +00:00
Git int
2019-06-01 12:31:48 +00:00
}
2017-11-10 03:33:11 +00:00
type PanelDebugPage struct {
2018-06-06 00:21:22 +00:00
* BasePanelPage
GoVersion string
DBVersion string
Uptime string
2018-08-16 05:27:26 +00:00
2018-06-06 00:21:22 +00:00
OpenConns int
DBAdapter string
2018-08-16 05:27:26 +00:00
Goroutines int
CPUs int
MemStats runtime . MemStats
2019-05-13 09:17:44 +00:00
2019-06-01 12:31:48 +00:00
Cache DebugPageCache
Database DebugPageDatabase
Disk DebugPageDisk
2017-11-10 03:33:11 +00:00
}
type PageSimple struct {
Title string
Something interface { }
}
type AreYouSure struct {
URL string
Message string
}
// TODO: Write a test for this
2018-06-06 00:21:22 +00:00
func DefaultHeader ( w http . ResponseWriter , user User ) * Header {
return & Header { Site : Site , Theme : Themes [ fallbackTheme ] , CurrentUser : user , Writer : w }
2017-11-10 03:33:11 +00:00
}
2019-01-21 12:27:59 +00:00
func SimpleDefaultHeader ( w http . ResponseWriter ) * Header {
return & Header { Site : Site , Theme : Themes [ fallbackTheme ] , CurrentUser : GuestUser , Writer : w }
}