code stringlengths 1 1.05M | repo_name stringlengths 6 83 | path stringlengths 3 242 | language stringclasses 222
values | license stringclasses 20
values | size int64 1 1.05M |
|---|---|---|---|---|---|
package config
import (
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
"path/filepath"
)
var HomeDirPath, _ = homedir.Dir()
const configDirName = ".crawlab"
const configName = "config.json"
func GetConfigPath() string {
if viper.GetString("metadata") != "" {
MetadataPath := viper.GetString("metad... | 2302_79757062/crawlab | core/config/base.go | Go | bsd-3-clause | 442 |
package config
import (
"bytes"
"github.com/apex/log"
"github.com/crawlab-team/crawlab/trace"
"github.com/fsnotify/fsnotify"
"github.com/spf13/viper"
"strings"
)
func init() {
// config instance
c := Config{Name: ""}
// init config file
if err := c.Init(); err != nil {
log.Warn("unable to init config")
... | 2302_79757062/crawlab | core/config/config.go | Go | bsd-3-clause | 1,759 |
package config
var DefaultConfigYaml = `
info:
version: v0.6.3
edition: global.edition.community
mongo:
host: localhost
port: 27017
db: crawlab_test
username: ""
password: ""
authSource: "admin"
server:
host: 0.0.0.0
port: 8000
spider:
fs: "/spiders"
workspace: "/workspace"
repo: "/repo"
task... | 2302_79757062/crawlab | core/config/default_config.go | Go | bsd-3-clause | 650 |
package config
import (
"github.com/crawlab-team/crawlab/core/interfaces"
)
type PathService struct {
cfgPath string
}
func (svc *PathService) GetConfigPath() (path string) {
return svc.cfgPath
}
func (svc *PathService) SetConfigPath(path string) {
svc.cfgPath = path
}
func NewConfigPathService() (svc interfac... | 2302_79757062/crawlab | core/config/path.go | Go | bsd-3-clause | 413 |
package config
import "strings"
const Version = "v0.6.3"
func GetVersion() (v string) {
if strings.HasPrefix(Version, "v") {
return Version
}
return "v" + Version
}
| 2302_79757062/crawlab | core/config/version.go | Go | bsd-3-clause | 173 |
package constants
const (
ActionTypeVisit = "visit"
ActionTypeInstallDep = "install_dep"
ActionTypeInstallLang = "install_lang"
ActionTypeViewDisclaimer = "view_disclaimer"
)
| 2302_79757062/crawlab | core/constants/action.go | Go | bsd-3-clause | 196 |
package constants
const (
AnchorStartStage = "START_STAGE"
AnchorStartUrl = "START_URL"
AnchorItems = "ITEMS"
AnchorParsers = "PARSERS"
)
| 2302_79757062/crawlab | core/constants/anchor.go | Go | bsd-3-clause | 153 |
package constants
const (
OwnerTypeAll = "all"
OwnerTypeMe = "me"
OwnerTypePublic = "public"
)
| 2302_79757062/crawlab | core/constants/auth.go | Go | bsd-3-clause | 106 |
package constants
const (
CacheColName = "cache"
CacheColKey = "k"
CacheColValue = "v"
CacheColTime = "t"
)
| 2302_79757062/crawlab | core/constants/cache.go | Go | bsd-3-clause | 117 |
package constants
const (
ChannelAllNode = "nodes:public"
ChannelWorkerNode = "nodes:"
ChannelMasterNode = "nodes:master"
)
| 2302_79757062/crawlab | core/constants/channels.go | Go | bsd-3-clause | 130 |
package constants
const (
ASCENDING = "asc"
DESCENDING = "dsc"
)
| 2302_79757062/crawlab | core/constants/common.go | Go | bsd-3-clause | 69 |
package constants
const (
EngineScrapy = "scrapy"
EngineColly = "colly"
)
| 2302_79757062/crawlab | core/constants/config_spider.go | Go | bsd-3-clause | 78 |
package constants
const (
DataCollectionKey = "_col"
)
| 2302_79757062/crawlab | core/constants/data_collection.go | Go | bsd-3-clause | 57 |
package constants
const (
DataFieldTypeGeneral = "general"
DataFieldTypeNumeric = "numeric"
DataFieldTypeDate = "date"
DataFieldTypeCurrency = "currency"
DataFieldTypeUrl = "url"
DataFieldTypeImage = "image"
DataFieldTypeAudio = "audio"
DataFieldTypeVideo = "video"
)
| 2302_79757062/crawlab | core/constants/data_field.go | Go | bsd-3-clause | 297 |
package constants
const (
ColJob = "jobs"
)
| 2302_79757062/crawlab | core/constants/database.go | Go | bsd-3-clause | 46 |
package constants
| 2302_79757062/crawlab | core/constants/delegate.go | Go | bsd-3-clause | 18 |
package constants
const (
DataSourceTypeMongo = "mongo"
DataSourceTypeMysql = "mysql"
DataSourceTypePostgresql = "postgresql"
DataSourceTypeMssql = "mssql"
DataSourceTypeSqlite = "sqlite"
DataSourceTypeCockroachdb = "cockroachdb"
DataSourceTypeElasticSearch = "elasticsearch"
... | 2302_79757062/crawlab | core/constants/ds.go | Go | bsd-3-clause | 733 |
package constants
const (
DefaultEncryptServerKey = "0123456789abcdef"
)
| 2302_79757062/crawlab | core/constants/encrypt.go | Go | bsd-3-clause | 75 |
package constants
import (
"errors"
)
var (
//ErrorMongoError = e.NewSystemOPError(1001, "system error:[mongo]%s", http.StatusInternalServerError)
//ErrorUserNotFound = e.NewBusinessError(10001, "user not found.", http.StatusUnauthorized)
//ErrorUsernameOrPasswordInvalid = e.NewBusines... | 2302_79757062/crawlab | core/constants/errors.go | Go | bsd-3-clause | 1,365 |
package constants
const (
GrpcEventServiceTypeRegister = "register"
GrpcEventServiceTypeSend = "send"
)
| 2302_79757062/crawlab | core/constants/event.go | Go | bsd-3-clause | 111 |
package constants
const (
ExportTypeCsv = "csv"
ExportTypeJson = "json"
)
| 2302_79757062/crawlab | core/constants/export.go | Go | bsd-3-clause | 78 |
package constants
const EmptyFileData = " "
const FsKeepFileName = ".gitkeep"
| 2302_79757062/crawlab | core/constants/file.go | Go | bsd-3-clause | 80 |
package constants
const (
DefaultFilerAuthKey = "Crawlab2021!"
)
| 2302_79757062/crawlab | core/constants/filer.go | Go | bsd-3-clause | 67 |
package constants
const (
FilterQueryFieldConditions = "conditions"
FilterQueryFieldAll = "all"
)
const (
FilterObjectTypeString = "string"
FilterObjectTypeNumber = "number"
FilterObjectTypeBoolean = "boolean"
)
const (
FilterOpNotSet = "ns"
FilterOpContains = "c"
FilterOpNotContai... | 2302_79757062/crawlab | core/constants/filter.go | Go | bsd-3-clause | 668 |
package constants
const (
GitAuthTypeHttp = "http"
GitAuthTypeSsh = "ssh"
)
const (
GitRemoteNameUpstream = "upstream"
GitRemoteNameOrigin = "origin"
)
const (
GitBranchMaster = "master"
GitBranchMain = "main"
)
| 2302_79757062/crawlab | core/constants/git.go | Go | bsd-3-clause | 226 |
package constants
const (
DefaultGrpcServerHost = ""
DefaultGrpcServerPort = "9666"
DefaultGrpcClientRemoteHost = "localhost"
DefaultGrpcClientRemotePort = DefaultGrpcServerPort
DefaultGrpcAuthKey = "Crawlab2021!"
)
const (
GrpcHeaderAuthorization = "authorization"
)
const (
GrpcSubscribe... | 2302_79757062/crawlab | core/constants/grpc.go | Go | bsd-3-clause | 340 |
package constants
const (
HttpResponseStatusOk = "ok"
HttpResponseMessageSuccess = "success"
HttpResponseMessageError = "error"
)
const (
HttpContentTypeApplicationJson = "application/json"
)
| 2302_79757062/crawlab | core/constants/http.go | Go | bsd-3-clause | 206 |
package constants
const (
ErrorRegexPattern = "(?:[ :,.]|^)((?:error|exception|traceback)s?)(?:[ :,.]|$)"
)
| 2302_79757062/crawlab | core/constants/log.go | Go | bsd-3-clause | 110 |
package constants
const (
MsgTypeGetLog = "get-log"
MsgTypeGetSystemInfo = "get-sys-info"
MsgTypeCancelTask = "cancel-task"
MsgTypeRemoveLog = "remove-log"
MsgTypeRemoveSpider = "remove-spider"
)
| 2302_79757062/crawlab | core/constants/message.go | Go | bsd-3-clause | 217 |
package constants
const (
NodeStatusUnregistered = "u"
NodeStatusRegistered = "r"
NodeStatusOnline = "on"
NodeStatusOffline = "off"
)
| 2302_79757062/crawlab | core/constants/node.go | Go | bsd-3-clause | 152 |
package constants
const (
NotificationTriggerTaskFinish = "task_finish"
NotificationTriggerTaskError = "task_error"
NotificationTriggerTaskEmptyResults = "task_empty_results"
NotificationTriggerTaskNever = "task_never"
)
| 2302_79757062/crawlab | core/constants/notification.go | Go | bsd-3-clause | 246 |
package constants
var PaginationDefaultPage = 1
var PaginationDefaultSize = 10
| 2302_79757062/crawlab | core/constants/pagination.go | Go | bsd-3-clause | 80 |
package constants
const (
RegisterTypeMac = "mac"
RegisterTypeIp = "ip"
RegisterTypeHostname = "hostname"
RegisterTypeCustomName = "customName"
)
| 2302_79757062/crawlab | core/constants/register.go | Go | bsd-3-clause | 168 |
package constants
const (
HashKey = "_h"
)
const (
DedupTypeIgnore = "ignore"
DedupTypeOverwrite = "overwrite"
)
| 2302_79757062/crawlab | core/constants/results.go | Go | bsd-3-clause | 121 |
package constants
const (
RpcInstallLang = "install_lang"
RpcInstallDep = "install_dep"
RpcUninstallDep = "uninstall_dep"
RpcGetInstalledDepList = "get_installed_dep_list"
RpcGetLang = "get_lang"
RpcCancelTask = "cancel_task"
RpcGetSystemInfoService = "get_syst... | 2302_79757062/crawlab | core/constants/rpc.go | Go | bsd-3-clause | 374 |
package constants
const (
ScheduleStatusStop = "stopped"
ScheduleStatusRunning = "running"
ScheduleStatusError = "error"
ScheduleStatusErrorNotFoundNode = "Not Found Node"
ScheduleStatusErrorNotFoundSpider = "Not Found Spider"
)
| 2302_79757062/crawlab | core/constants/schedule.go | Go | bsd-3-clause | 243 |
package constants
const ScrapyProtectedStageNames = ""
const ScrapyProtectedFieldNames = "_id,task_id,ts"
| 2302_79757062/crawlab | core/constants/scrapy.go | Go | bsd-3-clause | 108 |
package constants
const (
SignalQuit = iota
)
| 2302_79757062/crawlab | core/constants/signal.go | Go | bsd-3-clause | 48 |
package constants
const (
SortQueryField = "sort"
)
| 2302_79757062/crawlab | core/constants/sort.go | Go | bsd-3-clause | 54 |
package constants
const (
Windows = "windows"
Linux = "linux"
Darwin = "darwin"
)
const (
Python = "python"
Nodejs = "node"
Java = "java"
)
const (
InstallStatusNotInstalled = "not-installed"
InstallStatusInstalling = "installing"
InstallStatusInstallingOther = "installing-other"
InstallStatus... | 2302_79757062/crawlab | core/constants/system.go | Go | bsd-3-clause | 424 |
package constants
const (
TaskStatusPending = "pending"
TaskStatusRunning = "running"
TaskStatusFinished = "finished"
TaskStatusError = "error"
TaskStatusCancelled = "cancelled"
TaskStatusAbnormal = "abnormal"
)
const (
RunTypeAllNodes = "all-nodes"
RunTypeRandom = "random"
RunTypeSelec... | 2302_79757062/crawlab | core/constants/task.go | Go | bsd-3-clause | 661 |
package constants
const (
RoleAdmin = "admin"
RoleNormal = "normal"
)
const (
DefaultAdminUsername = "admin"
DefaultAdminPassword = "admin"
)
const (
UserContextKey = "user"
)
| 2302_79757062/crawlab | core/constants/user.go | Go | bsd-3-clause | 185 |
package constants
const (
String = "string"
Number = "number"
Boolean = "boolean"
Array = "array"
Object = "object"
)
| 2302_79757062/crawlab | core/constants/variable.go | Go | bsd-3-clause | 129 |
package container
import (
"go.uber.org/dig"
)
var c = dig.New()
func GetContainer() *dig.Container {
return c
}
| 2302_79757062/crawlab | core/container/container.go | Go | bsd-3-clause | 118 |
package controllers
import "github.com/gin-gonic/gin"
const (
ControllerIdNode = iota << 1
ControllerIdProject
ControllerIdSpider
ControllerIdTask
ControllerIdJob
ControllerIdSchedule
ControllerIdUser
ControllerIdSetting
ControllerIdToken
ControllerIdVariable
ControllerIdTag
ControllerIdLogin
ControllerI... | 2302_79757062/crawlab | core/controllers/base.go | Go | bsd-3-clause | 1,227 |
package controllers
import (
"errors"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/db/mongo"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
mongo2 "go.mongodb.... | 2302_79757062/crawlab | core/controllers/base_v2.go | Go | bsd-3-clause | 4,825 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/gin-gonic/gin"
)
type BinderInterface interface {
Bind(c *gin.Context) (res interfaces.Model, err error)
BindList(c *gin.Context) (res []interfaces.Model, err error)
BindBatch... | 2302_79757062/crawlab | core/controllers/binder.go | Go | bsd-3-clause | 540 |
package controllers
import (
"encoding/json"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/gin-gonic/gin"
)
func NewJsonBinder(id ControllerId) (b *Jso... | 2302_79757062/crawlab | core/controllers/binder_json.go | Go | bsd-3-clause | 6,022 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/db/mongo"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson/primitive"
mongo2 "go.mong... | 2302_79757062/crawlab | core/controllers/data_collection.go | Go | bsd-3-clause | 2,456 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/ds"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
interfaces2 "github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/crawlab-team/craw... | 2302_79757062/crawlab | core/controllers/data_source.go | Go | bsd-3-clause | 3,823 |
package controllers
func NewActionControllerDelegate(id ControllerId, actions []Action) (d *ActionControllerDelegate) {
return &ActionControllerDelegate{
id: id,
actions: actions,
}
}
type ActionControllerDelegate struct {
id ControllerId
actions []Action
}
func (ctr *ActionControllerDelegate) Acti... | 2302_79757062/crawlab | core/controllers/delegate_action.go | Go | bsd-3-clause | 369 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
delegate2 "github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson/primitive"
mongo2 "go.mongodb.org/mongo-driver/mongo"
)
func ... | 2302_79757062/crawlab | core/controllers/delegate_basic.go | Go | bsd-3-clause | 2,369 |
package controllers
import (
"github.com/apex/log"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/crawlab-team/crawlab/db/mongo"
"github.com/crawlab-te... | 2302_79757062/crawlab | core/controllers/delegate_list.go | Go | bsd-3-clause | 4,943 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/interfaces"
)
func NewListPostActionControllerDelegate(id ControllerId, svc interfaces.ModelBaseService, actions []Action) (d *ListActionControllerDelegate) {
return &ListActionControllerDelegate{
NewListControllerDelegate(id, svc),
NewActionCon... | 2302_79757062/crawlab | core/controllers/delegate_list_action.go | Go | bsd-3-clause | 435 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/utils"
"github.com/crawlab-team/crawlab/trace"
"github.com/gin-gonic/gin"
"net/http"
)
func getDemoActions() []Action {
ctx := newDemoContext()
return []Action{
{
Method: http.MethodGet,
Path: "/import",
HandlerFunc: ctx.i... | 2302_79757062/crawlab | core/controllers/demo.go | Go | bsd-3-clause | 1,339 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/service"
)
var EnvironmentController *environmentController
var EnvironmentActions []Action
type environmentController struct {
ListActionC... | 2302_79757062/crawlab | core/controllers/environment.go | Go | bsd-3-clause | 1,439 |
package controllers
import (
"errors"
"fmt"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/export"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/gin-gonic/gin"
"net/http"
)
var ExportController ActionController
func getExportActions() []Action {
ctx := ... | 2302_79757062/crawlab | core/controllers/export.go | Go | bsd-3-clause | 3,091 |
package controllers
import (
"errors"
"fmt"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/export"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/gin-gonic/gin"
)
func PostExport(c *gin.Context) {
exportType := c.Param("type")
exportTarget := c.Query("tar... | 2302_79757062/crawlab | core/controllers/export_v2.go | Go | bsd-3-clause | 2,331 |
package controllers
import (
"bufio"
"fmt"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/gin-gonic/gin"
"github.com/imroc/req"
"github.com/spf13/viper"
"net/http"
"strings"
)
var FilerController ActionController
func getFilerActions() []Action {
filerCtx := newFilerContext()
return []Action{
... | 2302_79757062/crawlab | core/controllers/filer.go | Go | bsd-3-clause | 2,585 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/db/mongo"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
mongo2 "go.mongodb.org/mongo-driver/mongo"
"net/http"
)
var FilterController ActionController
func getFilterActions() []Action {
c... | 2302_79757062/crawlab | core/controllers/filter.go | Go | bsd-3-clause | 1,864 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/db/mongo"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
mongo2 "go.mongodb.org/mongo-driver/mongo"
)
func GetFilterColFieldOptions(c *gin.Context) {
colName := c.Param("col")
value := c.P... | 2302_79757062/crawlab | core/controllers/filter_v2.go | Go | bsd-3-clause | 1,273 |
package controllers
var GitController ListController
| 2302_79757062/crawlab | core/controllers/git.go | Go | bsd-3-clause | 54 |
package controllers
type Response[T any] struct {
Status string `json:"status"`
Message string `json:"message"`
Data T `json:"data"`
Error string `json:"error"`
}
type ListResponse[T any] struct {
Status string `json:"status"`
Message string `json:"message"`
Total int `json:"total"`
Data [... | 2302_79757062/crawlab | core/controllers/http.go | Go | bsd-3-clause | 373 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/service"
)
func InitControllers() (err error) {
modelSvc, err := service.GetService()
if err != nil {
return err
}
NodeController = newNodeController()
ProjectController = newProjectCo... | 2302_79757062/crawlab | core/controllers/init.go | Go | bsd-3-clause | 2,190 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/gin-gonic/gin"
"net/http... | 2302_79757062/crawlab | core/controllers/login.go | Go | bsd-3-clause | 1,493 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/user"
"github.com/gin-gonic/gin"
)
func PostLogin(c *gin.Context) {
var payload struct {
Username string `json:"username"`
Password string `json:"p... | 2302_79757062/crawlab | core/controllers/login_v2.go | Go | bsd-3-clause | 882 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-tea... | 2302_79757062/crawlab | core/controllers/node.go | Go | bsd-3-clause | 1,982 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/notification"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson/primitive"
"net/http"
)
var NotificationController ActionController
func getNotificationActions() []Action {
ctx := newNotificationContext()
return []Action{
{
Meth... | 2302_79757062/crawlab | core/controllers/notification.go | Go | bsd-3-clause | 3,599 |
package controllers
var PermissionController ListController
| 2302_79757062/crawlab | core/controllers/permission.go | Go | bsd-3-clause | 61 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mo... | 2302_79757062/crawlab | core/controllers/project.go | Go | bsd-3-clause | 2,129 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/result"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/crawlab-team/crawlab/db/generic"
"github.com/gin-gonic/gin"
"go.mongodb.o... | 2302_79757062/crawlab | core/controllers/result.go | Go | bsd-3-clause | 3,106 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/result"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/crawlab-team/crawlab/db/generic"
"github.com/gin-gonic/gin"
"go.mongodb.o... | 2302_79757062/crawlab | core/controllers/result_v2.go | Go | bsd-3-clause | 2,668 |
package controllers
var RoleController ListController
| 2302_79757062/crawlab | core/controllers/role.go | Go | bsd-3-clause | 55 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/middlewares"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/gin-gonic/gin"
"net/http"
)
type RouterGroups struct {
AuthGroup *gin.RouterGroup
AnonymousGroup *gin.RouterGroup
}
func NewRouterGroups(app *gin.Engine) (groups... | 2302_79757062/crawlab | core/controllers/router_v2.go | Go | bsd-3-clause | 10,025 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawla... | 2302_79757062/crawlab | core/controllers/schedule.go | Go | bsd-3-clause | 5,423 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/schedule"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson/primitive"
)
func Pos... | 2302_79757062/crawlab | core/controllers/schedule_v2.go | Go | bsd-3-clause | 2,840 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/gin-gonic/gin"
)
var SettingController *settingController
t... | 2302_79757062/crawlab | core/controllers/setting.go | Go | bsd-3-clause | 1,687 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
)
func GetSetting(c *gin.Context) {
// key
key := c.Param("id")
// setting
s, err := service.NewModelServiceV2[... | 2302_79757062/crawlab | core/controllers/setting_v2.go | Go | bsd-3-clause | 1,095 |
package controllers
import (
"bytes"
"fmt"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/core/errors"
fs2 "github.com/crawlab-team/crawlab/core/fs"
"github.com/crawlab-team/crawlab... | 2302_79757062/crawlab | core/controllers/spider.go | Go | bsd-3-clause | 29,005 |
package controllers
import (
"errors"
"fmt"
log2 "github.com/apex/log"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/core/fs"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/models"
... | 2302_79757062/crawlab | core/controllers/spider_v2.go | Go | bsd-3-clause | 28,079 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"net/http"
"time"
)
var StatsController ActionController
func getStatsActions() []Action {
statsCtx := newStatsContext()... | 2302_79757062/crawlab | core/controllers/stats.go | Go | bsd-3-clause | 1,776 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/stats"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"time"
)
var statsDefaultQuery = bson.M{
"create_ts": bson.M{
"$gte": time.Now().Add(-30 * 24 * time.Hour),
},
}
func GetStatsOverview(c *gin.Context) {
data, err := stats.... | 2302_79757062/crawlab | core/controllers/stats_v2.go | Go | bsd-3-clause | 903 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/utils"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
"net/http"
"path/filepath"
)
var SyncController ActionController
func getSyncActions() []Action {
var ctx = newSyncContext()
return []Action{
{
Method: http.MethodGet,
Pat... | 2302_79757062/crawlab | core/controllers/sync.go | Go | bsd-3-clause | 1,132 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/entity"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
"net/http"
)
func getSystemInfo(c *gin.Context) {
info := &entity.SystemInfo{
Edition: viper.GetString("info.edition"),
Version: viper.GetString("info.version"),
}
HandleSuccessWit... | 2302_79757062/crawlab | core/controllers/system_info.go | Go | bsd-3-clause | 535 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/entity"
"github.com/gin-gonic/gin"
"github.com/spf13/viper"
)
func GetSystemInfo(c *gin.Context) {
info := &entity.SystemInfo{
Edition: viper.GetString("info.edition"),
Version: viper.GetString("info.version"),
}
HandleSuccessWithData(c, inf... | 2302_79757062/crawlab | core/controllers/system_info_v2.go | Go | bsd-3-clause | 325 |
package controllers
var TagController ListController
| 2302_79757062/crawlab | core/controllers/tag.go | Go | bsd-3-clause | 54 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
delegate2 "github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/crawlab-team/... | 2302_79757062/crawlab | core/controllers/task.go | Go | bsd-3-clause | 11,200 |
package controllers
import (
"errors"
log2 "github.com/apex/log"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/res... | 2302_79757062/crawlab | core/controllers/task_v2.go | Go | bsd-3-clause | 9,813 |
package test
import (
"github.com/crawlab-team/crawlab/core/controllers"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/routes"
"github.com/crawlab-team/crawlab/trace"
"github.com/gavv/httpexpect/v2"
"github.com/gin-gonic/gin"
"github.com/stretchr/testify/require"
"... | 2302_79757062/crawlab | core/controllers/test/base.go | Go | bsd-3-clause | 2,079 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/delegate"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/gin-gonic/g... | 2302_79757062/crawlab | core/controllers/token.go | Go | bsd-3-clause | 2,020 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/user"
"github.com/gin-gonic/gin"
)
func PostToken(c *gin.Context) {
var t models.TokenV2
if err := c.ShouldBindJSON(&t); err != nil {
Ha... | 2302_79757062/crawlab | core/controllers/token_v2.go | Go | bsd-3-clause | 797 |
package controllers
import (
"encoding/json"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/container"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/interfaces"
delegate2 "github.com/crawl... | 2302_79757062/crawlab | core/controllers/user.go | Go | bsd-3-clause | 5,675 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/crawlab-team/crawlab/core/models/service"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson/primitive"
)
func PostUser(c *gin.Context) {
var payload struct {
Us... | 2302_79757062/crawlab | core/controllers/user_v2.go | Go | bsd-3-clause | 2,794 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/interfaces"
"github.com/crawlab-team/crawlab/core/models/models"
"github.com/gin-gonic/gin"
)
func GetUserFromContext(c *gin.Context) (u interfaces.User) {
value, ok := c.Get(constants.UserContextK... | 2302_79757062/crawlab | core/controllers/utils_context.go | Go | bsd-3-clause | 627 |
package controllers
import (
"encoding/json"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/core/errors"
"github.com/crawlab-team/crawlab/core/utils"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mo... | 2302_79757062/crawlab | core/controllers/utils_filter.go | Go | bsd-3-clause | 2,602 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/crawlab-team/crawlab/trace"
"github.com/gin-gonic/gin"
"net/http"
)
func handleError(statusCode int, c *gin.Context, err error, print bool) {
if print {
trace.PrintError(err)... | 2302_79757062/crawlab | core/controllers/utils_http.go | Go | bsd-3-clause | 1,951 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/gin-gonic/gin"
)
func GetDefaultPagination() (p *entity.Pagination) {
return &entity.Pagination{
Page: constants.PaginationDefaultPage,
Size: constants.PaginationDefaultSize,... | 2302_79757062/crawlab | core/controllers/utils_pagination.go | Go | bsd-3-clause | 700 |
package controllers
import (
"encoding/json"
"github.com/crawlab-team/crawlab/core/constants"
"github.com/crawlab-team/crawlab/core/entity"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson"
)
// GetSorts Get entity.Sort from gin.Context
func GetSorts(c *gin.Context) (sorts []entity.Sort, err error) {... | 2302_79757062/crawlab | core/controllers/utils_sort.go | Go | bsd-3-clause | 1,335 |
package controllers
import (
"github.com/crawlab-team/crawlab/core/config"
"github.com/gin-gonic/gin"
"net/http"
)
func GetVersion(c *gin.Context) {
HandleSuccessWithData(c, config.GetVersion())
}
func getVersionActions() []Action {
return []Action{
{
Method: http.MethodGet,
Path: "",
Han... | 2302_79757062/crawlab | core/controllers/version.go | Go | bsd-3-clause | 392 |
package data
const ColorsDataText = `[
{
"name": "Absolute Zero",
"hex": "#0048BA"
},
{
"name": "Acid Green",
"hex": "#B0BF1A"
},
{
"name": "Aero",
"hex": "#7CB9E8"
},
{
"name": "Aero Blue",
"hex": "#C9FFE5"
},
{
"name": "African Violet",
"hex": "#B284BE"
},
... | 2302_79757062/crawlab | core/data/colors.go | Go | bsd-3-clause | 75,246 |