linker

package
v0.0.217 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmailTemplateLinkerApproved                  notif.EmailTemplateName        = "linkerApprovedEmail"
	NotificationTemplateLinkerApproved           notif.NotificationTemplateName = "linker_approved"
	EmailTemplateAdminNotificationLinkerApproved notif.EmailTemplateName        = "adminNotificationLinkerApprovedEmail"

	EmailTemplateLinkerAdd                  notif.EmailTemplateName        = "linkerAddEmail"
	NotificationTemplateLinkerAdd           notif.NotificationTemplateName = "linker_add"
	EmailTemplateAdminNotificationLinkerAdd notif.EmailTemplateName        = "adminNotificationLinkerAddEmail"

	EmailTemplateLinkerDeleted        notif.EmailTemplateName        = "linkerDeletedEmail"
	NotificationTemplateLinkerDeleted notif.NotificationTemplateName = "linker_deleted"

	EmailTemplateLinkerRejected                  notif.EmailTemplateName        = "linkerRejectedEmail"
	NotificationTemplateLinkerRejected           notif.NotificationTemplateName = "linker_rejected"
	EmailTemplateAdminNotificationLinkerRejected notif.EmailTemplateName        = "adminNotificationLinkerRejectedEmail"
)
View Source
const (
	// TaskReply posts a reply to a thread or comment.
	TaskReply tasks.TaskString = "Reply"

	// TaskEditReply edits a comment or reply.
	TaskEditReply tasks.TaskString = "Edit Reply"

	// TaskCancel cancels the current operation and returns to the previous
	// page.
	TaskCancel tasks.TaskString = "Cancel"

	// TaskSuggest creates a suggestion in the linker.
	TaskSuggest tasks.TaskString = "Suggest"

	// TaskUpdate updates an existing item.
	TaskUpdate tasks.TaskString = "Update"

	// TaskRenameCategory renames a category.
	TaskRenameCategory tasks.TaskString = "Rename Category"

	// TaskDeleteCategory removes a category.
	TaskDeleteCategory tasks.TaskString = "Delete Category"

	// TaskCreateCategory creates a new category entry.
	TaskCreateCategory tasks.TaskString = "Create Category"

	// TaskAdd represents the "Add" action, commonly used when creating a new
	// record.
	TaskAdd tasks.TaskString = "Add"

	// TaskDelete removes an existing item.
	TaskDelete tasks.TaskString = "Delete"

	// TaskApprove approves an item in moderation queues.
	TaskApprove tasks.TaskString = "Approve"

	// TaskBulkApprove approves multiple queued items at once.
	TaskBulkApprove tasks.TaskString = "Bulk Approve"

	// TaskBulkDelete removes multiple queued items at once.
	TaskBulkDelete tasks.TaskString = "Bulk Delete"

	// TaskCategoryGrantCreate adds a new grant to a linker category.
	TaskCategoryGrantCreate tasks.TaskString = "Create grant"

	// TaskCategoryGrantDelete removes an existing linker category grant.
	TaskCategoryGrantDelete tasks.TaskString = "Delete grant"
)

The following constants define the allowed values of the "task" form field. Each HTML form includes a hidden or submit input named "task" whose value identifies the intended action. When routes are registered the constants are passed to gorillamuxlogic's HasTask so that only requests specifying the expected task reach a handler. Centralising these string values avoids typos between templates and route declarations.

View Source
const LinkerAdminAddPageTmpl tasks.Template = "domains/linker/adminAddPage.gohtml"
View Source
const LinkerAdminCategoriesPageTmpl tasks.Template = "domains/linker/linkerAdminCategoriesPage.gohtml"
View Source
const LinkerAdminCategoryEditPageTmpl tasks.Template = "domains/linker/linkerAdminCategoryEditPage.gohtml"
View Source
const LinkerAdminCategoryGrantsPageTmpl tasks.Template = "domains/linker/adminCategoryGrantsPage.gohtml"
View Source
const LinkerAdminCategoryPageTmpl tasks.Template = "domains/linker/linkerAdminCategoryPage.gohtml"
View Source
const LinkerAdminDashboardPageTmpl tasks.Template = "domains/linker/linkerAdminDashboardPage.gohtml"
View Source
const LinkerAdminLinkGrantsPageTmpl tasks.Template = "domains/linker/adminLinkGrantsPage.gohtml"
View Source
const LinkerAdminLinkPageTmpl tasks.Template = "domains/linker/adminLinkPage.gohtml"
View Source
const LinkerAdminLinkViewPageTmpl tasks.Template = "domains/linker/adminLinkViewPage.gohtml"
View Source
const LinkerAdminLinksPageTmpl tasks.Template = "domains/linker/linkerAdminLinksPage.gohtml"
View Source
const LinkerAdminQueuePageTmpl tasks.Template = "domains/linker/adminQueuePage.gohtml"
View Source
const LinkerCategoriesPageTmpl tasks.Template = "domains/linker/linkerCategoriesPage.gohtml"
View Source
const (
	LinkerCategoryPageTmpl tasks.Template = "domains/linker/categoryPage.gohtml"
)
View Source
const LinkerCommentsPageTmpl tasks.Template = "domains/linker/commentsPage.gohtml"
View Source
const (
	LinkerPageTmpl tasks.Template = "domains/linker/page.gohtml"
)
View Source
const LinkerShowPageTmpl tasks.Template = "domains/linker/showPage.gohtml"
View Source
const LinkerSuggestPageTmpl tasks.Template = "domains/linker/suggestPage.gohtml"
View Source
const LinkerTopicDescription = "THIS IS A HIDDEN FORUM FOR A LINKER TOPIC"

LinkerTopicDescription describes the hidden linker forum.

View Source
const LinkerTopicName = "A LINKER TOPIC"

LinkerTopicName is the default name for the hidden linker forum.

View Source
const LinkerUserPageTmpl tasks.Template = "domains/linker/linkerPage.gohtml"
View Source
const (
	// SectionWeight controls the order of the Linker section in navigation.
	SectionWeight = 50
)

Variables

View Source
var AdminAddTask = &addTask{TaskString: TaskAdd}
View Source
var AdminApproveTask = &approveTask{TaskString: TaskApprove}
View Source
var AdminBulkApproveTask = &bulkApproveTask{TaskString: TaskBulkApprove}
View Source
var AdminBulkDeleteTask = &bulkDeleteTask{TaskString: TaskBulkDelete}
View Source
var AdminCategoryGrantDeleteTask = &adminCategoryGrantDeleteTask{TaskString: TaskCategoryGrantDelete}
View Source
var AdminDeleteCategoryTask = &deleteCategoryTask{TaskString: TaskDeleteCategory}
View Source
var AdminDeleteTask = &deleteTask{TaskString: TaskDelete}
View Source
var AdminEditLinkTask = &editLinkTask{TaskString: TaskUpdate}
View Source
var AdminLinkGrantDeleteTask = &linkGrantDeleteTask{TaskString: TaskCategoryGrantDelete}
View Source
var CreateCategoryTask = &createCategoryTask{TaskString: TaskCreateCategory}
View Source
var RenameCategoryTask = &renameCategoryTask{TaskString: TaskRenameCategory}
View Source
var UpdateCategoryTask = &updateCategoryTask{TaskString: TaskUpdate}

Functions

func AdminAddPage

func AdminAddPage(w http.ResponseWriter, r *http.Request)

func AdminCategoriesPage

func AdminCategoriesPage(w http.ResponseWriter, r *http.Request)

func AdminCategoryEditPage

func AdminCategoryEditPage(w http.ResponseWriter, r *http.Request)

AdminCategoryEditPage renders the edit form for a linker category.

func AdminCategoryGrantsPage

func AdminCategoryGrantsPage(w http.ResponseWriter, r *http.Request)

AdminCategoryGrantsPage displays grants for a linker category.

func AdminCategoryPage

func AdminCategoryPage(w http.ResponseWriter, r *http.Request)

AdminCategoryPage shows a linker category with its links.

func AdminDashboardPage

func AdminDashboardPage(w http.ResponseWriter, r *http.Request)

AdminDashboardPage shows summary links for linker admin.

func AdminLinkGrantsPage

func AdminLinkGrantsPage(w http.ResponseWriter, r *http.Request)

AdminLinkGrantsPage displays grants for a linker item.

func AdminLinksPage

func AdminLinksPage(w http.ResponseWriter, r *http.Request)

AdminLinksPage lists all links grouped by category.

func AdminQueuePage

func AdminQueuePage(w http.ResponseWriter, r *http.Request)

func AdminQueueUpdateActionPage

func AdminQueueUpdateActionPage(w http.ResponseWriter, r *http.Request)

func AtomPage

func AtomPage(w http.ResponseWriter, r *http.Request)

func CategoriesPage

func CategoriesPage(w http.ResponseWriter, r *http.Request)

func CommentEditActionCancelPage

func CommentEditActionCancelPage(w http.ResponseWriter, r *http.Request)

CommentEditActionCancelPage aborts editing a comment.

func CommentsPage

func CommentsPage(w http.ResponseWriter, r *http.Request)

func CustomLinkerIndex

func CustomLinkerIndex(data *common.CoreData, r *http.Request)

func EnforceLinkViewAccess

func EnforceLinkViewAccess(next http.Handler) http.Handler

func EnforceLinkerCommentsAccess

func EnforceLinkerCommentsAccess(next http.Handler) http.Handler

func FetchPageTitle

func FetchPageTitle(ctx context.Context, targetURL string) string

FetchPageTitle returns the <title> contents of the page at the given URL. An empty string is returned if the title cannot be retrieved within the timeout.

func LinkerCategoryPage

func LinkerCategoryPage(w http.ResponseWriter, r *http.Request)

func LinkerPage

func LinkerPage(w http.ResponseWriter, r *http.Request)

func NewLinkerCategoryTask

func NewLinkerCategoryTask() tasks.Task

func NewLinkerTask

func NewLinkerTask() tasks.Task

func RedirectReplyError added in v0.0.214

func RedirectReplyError(w http.ResponseWriter, r *http.Request, msg, text string, languageID int)

func Register

func Register(reg *router.Registry)

Register registers the linker router module.

func RegisterAdminRoutes

func RegisterAdminRoutes(ar *mux.Router)

RegisterAdminRoutes attaches linker admin endpoints to ar.

func RegisterRoutes

func RegisterRoutes(r *mux.Router, _ *config.RuntimeConfig) []navpkg.RouterOptions

RegisterRoutes attaches the public linker endpoints to r.

func RegisterTasks

func RegisterTasks() []tasks.NamedTask

RegisterTasks returns linker related tasks.

func RssPage

func RssPage(w http.ResponseWriter, r *http.Request)

func ShowPage

func ShowPage(w http.ResponseWriter, r *http.Request)

func ShowReplyPage

func ShowReplyPage(w http.ResponseWriter, r *http.Request)

func SuggestPage

func SuggestPage(w http.ResponseWriter, r *http.Request)
func UserCanCreateLink(ctx context.Context, q db.Querier, categoryID sql.NullInt32, uid int32) (bool, error)

UserCanCreateLink reports whether uid may submit a link to the category.

func UserPage

func UserPage(w http.ResponseWriter, r *http.Request)

Types

type CategoryGrantCreateTask

type CategoryGrantCreateTask struct{ tasks.TaskString }

CategoryGrantCreateTask creates a new grant for a linker category.

func (CategoryGrantCreateTask) Action

type EditReplyTask

type EditReplyTask struct{ tasks.TaskString }

EditReplyTask posts an edited reply and refreshes thread metadata.

func (EditReplyTask) Action

type LinkGrantCreateTask

type LinkGrantCreateTask struct{ tasks.TaskString }

LinkGrantCreateTask creates a new grant for a link item.

func (LinkGrantCreateTask) Action

type SuggestTask

type SuggestTask struct{ tasks.TaskString }

func (SuggestTask) Action

Jump to

Keyboard shortcuts

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