Documentation ¶
Index ¶
- Variables
- func CheckAdminRole(rolesStr string) error
- func CreateUser(ctx context.Context, base *base.Base, claims *sso.Claims) (*ent.User, error)
- func GetClaims(code string) (*sso.Claims, error)
- func GetFavicon(siteUrl string) (string, error)
- func GetUserAgent(e echo.Context) (*sender.UserData, error)
- func SwitchPostingService(ctx context.Context, db *db.DB, u *ent.User, forms *sender.SendForm) error
- func UpdateUser(ctx context.Context, base *base.Base, claims *sso.Claims) (*ent.User, error)
- func ValidateMail(target string) error
- func ValidateURL(target string) error
- type BioResponse
- type Handler
- func (h *Handler) AllUsersHandler(e echo.Context) error
- func (h *Handler) BioHandler(e echo.Context) error
- func (h *Handler) CategoryHandler(e echo.Context) error
- func (h *Handler) ChangeSelect(e echo.Context) error
- func (h *Handler) ContactDefaultHandler(c echo.Context) error
- func (h *Handler) ContactDeleteHandler(e echo.Context) error
- func (h *Handler) ContactGetHandler(e echo.Context) error
- func (h *Handler) ContactHandler(e echo.Context) error
- func (h *Handler) ContactPreviewUserDataHandler(e echo.Context) error
- func (h *Handler) CreateBioHandler(e echo.Context) error
- func (h *Handler) CreateCategoryHandler(e echo.Context) error
- func (h *Handler) CreateContactDefaultHandler(c echo.Context) error
- func (h *Handler) CreateLinkHandler(e echo.Context) error
- func (h *Handler) CreateLocationHandler(e echo.Context) error
- func (h *Handler) CreateProductHandler(e echo.Context) error
- func (h *Handler) DeleteBioHandler(e echo.Context) error
- func (h *Handler) DeleteCategoryHandler(e echo.Context) error
- func (h *Handler) DeleteContactDefaultHandler(c echo.Context) error
- func (h *Handler) DeleteLinkHandler(e echo.Context) error
- func (h *Handler) DeleteLocationHandler(e echo.Context) error
- func (h *Handler) DeleteProductHandler(e echo.Context) error
- func (h *Handler) LinkHandler(e echo.Context) error
- func (h *Handler) LocationHandler(e echo.Context) error
- func (h *Handler) LoginHandler(c echo.Context) error
- func (h *Handler) LoginURLHandler(c echo.Context) error
- func (h *Handler) LogoutHandler(e echo.Context) error
- func (h *Handler) MeHandler(e echo.Context) error
- func (h *Handler) NoticeHandler(e echo.Context) error
- func (h *Handler) ProductHandler(e echo.Context) error
- func (h *Handler) PublicContactDefaultHandler(c echo.Context) error
- func (h *Handler) PublicProductsHandler(e echo.Context) error
- func (h *Handler) PublicProfileHandler(e echo.Context) error
- func (h *Handler) RootHandler(c echo.Context) error
- func (h *Handler) UpdateBioHandler(e echo.Context) error
- func (h *Handler) UpdateCategoryHandler(e echo.Context) error
- func (h *Handler) UpdateContactDefaultHandler(c echo.Context) error
- func (h *Handler) UpdateLinkHandler(e echo.Context) error
- func (h *Handler) UpdateLocationHandler(e echo.Context) error
- func (h *Handler) UpdateNoticeHandler(e echo.Context) error
- func (h *Handler) UpdateProductHandler(e echo.Context) error
- func (h *Handler) UpdateUserHandler(e echo.Context) error
- type LinkResponse
- type Public
- type PublicBioGraphy
- type PublicLink
- type PublicLinkCategory
- type PublicLocation
- type PublicProduct
- type PublicShortProduct
Constants ¶
This section is empty.
Variables ¶
var MailRegexp = regexp.MustCompile(
`[\w\-\._]+@[\w\-\._]+\.[A-Za-z]+`,
)
var UrlRegexp = regexp.MustCompile(
`https?://[\w/:%#\$&\?\(\)~\.=\+\-]+`,
)
Functions ¶
func CheckAdminRole ¶
Check exists `admin` role in CateiruSSO received claims.
func CreateUser ¶
Create New User from SSO Claims
func GetFavicon ¶
Search favicon
- HTML parse
- get `link[rel=icon]` elements
- GET `/favicon.ico`
- if not found in HTML
func GetUserAgent ¶
Get user data from User-Agent or Client Hints
If useable Client Hints, use it. Other, used User-Agent.
func SwitchPostingService ¶
func UpdateUser ¶
func ValidateMail ¶
func ValidateURL ¶
Types ¶
type BioResponse ¶
type Handler ¶
func (*Handler) AllUsersHandler ¶
Response all users in users db
func (*Handler) CategoryHandler ¶
Response all categories
func (*Handler) ChangeSelect ¶
func (*Handler) ContactDefaultHandler ¶
func (*Handler) ContactDeleteHandler ¶
func (*Handler) ContactGetHandler ¶
func (*Handler) ContactHandler ¶
Contact form API
func (*Handler) ContactPreviewUserDataHandler ¶
Preview UserData from User-Agent or UA-CH
func (*Handler) CreateBioHandler ¶
Set a new bio
require form is - is_public: boolean - location_id: uint32 - position: string - position_ja: string - join_date: type date - leave_date: Optional RFC3339 type date
func (*Handler) CreateCategoryHandler ¶
- name: string - name_ja: string - emoji: len 1 string
func (*Handler) CreateContactDefaultHandler ¶
func (*Handler) CreateLinkHandler ¶
Create a new Link
Require form data - name - name_ja - site_url - category_id
func (*Handler) CreateLocationHandler ¶
create a new location
- type: `univ` or `corp` - name: string - name_ja: string - address: string - address_ja: string
func (*Handler) CreateProductHandler ¶
Create a new product
form values: - name: string - name_ja: string - detail: string - detail_ja: string - site_url: string - github_url: Optional string - dev_time: RFC3339type date - thumbnail: Optional string
func (*Handler) DeleteBioHandler ¶
func (*Handler) DeleteCategoryHandler ¶
func (*Handler) DeleteContactDefaultHandler ¶
func (*Handler) DeleteLinkHandler ¶
func (*Handler) DeleteLocationHandler ¶
func (*Handler) DeleteProductHandler ¶
func (*Handler) LinkHandler ¶
Response all Links
func (*Handler) LocationHandler ¶
func (*Handler) LoginHandler ¶
Login from OIDC Require `?code=` param. - code param is Open ID Connect code.
func (*Handler) LoginURLHandler ¶
Redirect to CateiruSSO Login page.
func (*Handler) LogoutHandler ¶
Logout session no delete users.
func (*Handler) NoticeHandler ¶
func (*Handler) ProductHandler ¶
Response to all products of me.
func (*Handler) PublicContactDefaultHandler ¶
func (*Handler) PublicProductsHandler ¶
func (*Handler) PublicProfileHandler ¶
Response public profiles
func (*Handler) RootHandler ¶
func (*Handler) UpdateBioHandler ¶
Set a new bio
changeable form is - is_public: boolean - location_id: uint32 - position: string - position_ja: string - join_date: RFC3339 type date - leave_date: RFC3339 type date
func (*Handler) UpdateCategoryHandler ¶
- name: string - name_ja: string - emoji: len 1 string
func (*Handler) UpdateContactDefaultHandler ¶
func (*Handler) UpdateLinkHandler ¶
func (*Handler) UpdateLocationHandler ¶
Update location
- type: `univ` or `corp` - name: string - name_ja: string - address: string - address_ja: string
func (*Handler) UpdateNoticeHandler ¶
func (*Handler) UpdateProductHandler ¶
Update a product
changeable form values: - name: string - name_ja: string - detail: string - detail_ja: string - site_url: string - github_url: string - dev_time: RFC3339type date - thumbnail: string
func (*Handler) UpdateUserHandler ¶
Update user profiles
changeable profiles - family_name - given_name - family_name_ja - given_name_ja - birth_date - location - location_ja
type LinkResponse ¶
type Public ¶
type Public struct { // User data GivenName string `json:"given_name,omitempty"` FamilyName string `json:"family_name,omitempty"` GivenNameJa string `json:"given_name_ja,omitempty"` FamilyNameJa string `json:"family_name_ja,omitempty"` UserID string `json:"user_id,omitempty"` BirthDate time.Time `json:"birth_date,omitempty"` Location string `json:"location,omitempty"` LocationJa string `json:"location_ja,omitempty"` AvatarURL string `json:"avatar_url,omitempty"` Created time.Time `json:"created,omitempty"` Modified time.Time `json:"modified,omitempty"` Biographies []PublicBioGraphy `json:"biographies"` Products []PublicShortProduct `json:"products"` Links []PublicLinkCategory `json:"links"` }
type PublicBioGraphy ¶
type PublicLink ¶
type PublicLinkCategory ¶
type PublicLinkCategory struct { CategoryId uint32 `json:"category_id"` CategoryName string `json:"category_name,omitempty"` CategoryNameJa string `json:"category_name_ja,omitempty"` Emoji string `json:"emoji,omitempty"` Links []PublicLink `json:"links"` }
type PublicLocation ¶
type PublicProduct ¶
type PublicProduct struct { ID uint32 `json:"id,omitempty"` Name string `json:"name,omitempty"` NameJa string `json:"name_ja,omitempty"` Detail string `json:"detail,omitempty"` DetailJa string `json:"detail_ja,omitempty"` SiteURL string `json:"site_url,omitempty"` GithubURL string `json:"github_url,omitempty"` DevTime time.Time `json:"dev_time,omitempty"` Thumbnail string `json:"thumbnail,omitempty"` }
type PublicShortProduct ¶
type PublicShortProduct struct { ID uint32 `json:"id,omitempty"` Name string `json:"name,omitempty"` NameJa string `json:"name_ja,omitempty"` Detail string `json:"detail,omitempty"` DetailJa string `json:"detail_ja,omitempty"` DevTime time.Time `json:"dev_time,omitempty"` Thumbnail string `json:"thumbnail,omitempty"` GithubURL string `json:"github_url,omitempty"` SiteURL string `json:"site_url"` }