Skip to content
This repository has been archived by the owner on Aug 24, 2020. It is now read-only.
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time
// Walkhub
// Copyright (C) 2015 Pronovix
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <>.
package walkhub
import (
type EmbedLog struct {
UUID string `dbtype:"uuid" dbdefault:"uuid_generate_v4()" json:"uuid"`
IPAddr string `json:"ip"`
Created time.Time `json:"created"`
Site string `json:"site"`
Mail string `json:"mail"`
func (el *EmbedLog) GetID() string {
return el.UUID
func (el *EmbedLog) Validate() error {
if el.Site == "" {
return errors.New("site is empty")
return nil
func embedlogService(ec *ab.EntityController) ab.Service {
res := ab.EntityResource(ec, &EmbedLog{}, ab.EntityResourceConfig{
DisableList: true,
DisableGet: true,
DisablePut: true,
DisableDelete: true,
BeforeCallback: func(r *http.Request, d ab.Resource) {
el := d.(*EmbedLog)
el.UUID = ""
el.Created = time.Now()
el.IPAddr = r.RemoteAddr
AfterCallback: func(r *http.Request, d ab.Resource) {
db := ab.GetDB(r)
el := d.(*EmbedLog)
DBLog(db, ec, "embedlog", fmt.Sprintf("%s (%s) has created an embed log on %s at %s", el.Mail, el.IPAddr, el.Site, el.Created.String()))
return res