server

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NjTweetID = "NjTID"
	SharedID  = "sharedID"
	SharedUsr = "shareUsr"
)
View Source
const (
	MaxImgInTweet  = 4
	MaxImgDataSize = 1 << 20
)
View Source
const (
	BuyRightsUrlKey = "tweet-info-from-outer-link"
)
View Source
const (
	MaxIntervalForPaymentStatus = 60
)
View Source
const (
	SessionNameSystem = "session-name-for-ninja"
)
View Source
const (
	Web3IDProfile = "Dessage-Web3-ID:"
)

Variables

This section is empty.

Functions

func InitConf

func InitConf(c *SysConf)

Types

type Geo

type Geo struct {
	PlaceID string `json:"place_id,omitempty"`
}

type HttpConf

type HttpConf struct {
	RefreshContent bool   `json:"refresh_content"`
	UseHttps       bool   `json:"use_https"`
	SSLCertFile    string `json:"ssl_cert_file"`
	SSLKeyFile     string `json:"ssl_key_file"`
	SessionKey     string `json:"session_key"`
	SessionMaxAge  int    `json:"session_max_age"`
	// contains filtered or unexported fields
}

func (*HttpConf) String

func (c *HttpConf) String() string

type LogicAction

type LogicAction struct {
	Action    func(w http.ResponseWriter, r *http.Request, token *database.NinjaUsrInfo)
	NeedToken bool
}

type MainService

type MainService struct {
	// contains filtered or unexported fields
}

func NewMainService

func NewMainService() *MainService

func (*MainService) Start

func (bh *MainService) Start()

type Media

type Media struct {
	MediaIDs      []string `json:"media_ids,omitempty"`
	TaggedUserIDs []string `json:"tagged_user_ids,omitempty"`
}

type OuterLinkParam added in v1.0.1

type OuterLinkParam struct {
	TweetID  string `json:"tweet_id,omitempty"`
	ShareID  string `json:"share_id,omitempty"`
	ShareUsr string `json:"share_usr,omitempty"`
}

func (*OuterLinkParam) Data added in v1.0.1

func (p *OuterLinkParam) Data() []byte

func (*OuterLinkParam) GetValidId added in v1.0.1

func (p *OuterLinkParam) GetValidId() string

type PageData added in v1.0.1

type PageData struct {
	NinjaUsrInfoJson template.JS
	TargetTweet      template.JS
	CSRFToken        string
	JSEnv            string
}

type Poll

type Poll struct {
	DurationMinutes int      `json:"duration_minutes,omitempty"`
	Options         []string `json:"options,omitempty"`
}

type Reply

type Reply struct {
	ExcludeReplyUserIDs []string `json:"exclude_reply_user_ids,omitempty"`
	InReplyToTweetID    string   `json:"in_reply_to_tweet_id,omitempty"`
}

type SessionManager

type SessionManager struct {
	// contains filtered or unexported fields
}

func SMInst

func SMInst() *SessionManager

func (*SessionManager) Del

func (*SessionManager) Get

func (sm *SessionManager) Get(key string, r *http.Request) (any, error)

func (*SessionManager) Set

func (sm *SessionManager) Set(r *http.Request, w http.ResponseWriter, key string, val any) error

type SignDataByEth

type SignDataByEth struct {
	Message   string `json:"message"`
	Signature string `json:"signature"`
	PayLoad   any    `json:"pay_load,omitempty"`
}

func (*SignDataByEth) ParseNinjaTweet

func (sp *SignDataByEth) ParseNinjaTweet() (*database.NinjaTweet, error)

func (*SignDataByEth) RawData

func (sp *SignDataByEth) RawData() string

type SignInObj

type SignInObj struct {
	EthAddr      string `json:"eth_addr"`
	SignTim      int64  `json:"sign_time"`
	ReferrerCode string `json:"referrer_code"`
	ReferrerID   string `json:"referrer_id"`
}

func (*SignInObj) String

func (so *SignInObj) String() string

type SysConf

type SysConf struct {
	LogLevel string `json:"log_level"`
	LogFile  string `json:"log_file"`
	UrlHome  string `json:"url_home"`
	HttpPort string `json:"http_port"`
	JSEnv    string `json:"js_env"`
	*HttpConf
	*TwitterConf
	*database.FileStoreConf

	*blockchain.BCConf
	// contains filtered or unexported fields
}

func (*SysConf) GetNjProtocolAd

func (c *SysConf) GetNjProtocolAd(NjTwID int64, slogan string) string

func (*SysConf) GetNjVoteAd added in v1.0.1

func (c *SysConf) GetNjVoteAd(NjTwID int64, web3Id, slogan string) string

func (*SysConf) String

func (c *SysConf) String() any

type TwAPIResponse

type TwAPIResponse struct {
	TwitterData *database.TWUserInfo `json:"data"`
	EthAddr     string               `json:"eth_addr"`
	SignUpAt    int64                `json:"sign_up_at"`
	CSRFToken   string
}

type TweetImgData added in v1.0.1

type TweetImgData struct {
	RawData   string `json:"raw_data"`
	Hash      string `json:"hash"`
	ThumbNail string `json:"thumb_nail"`
}

type TweetPostResult

type TweetPostResult struct {
	ID   string `json:"id"`
	Text string `json:"text"`
}

type TweetRequest

type TweetRequest struct {
	Text                  string `json:"text,omitempty"`
	DirectMessageDeepLink string `json:"direct_message_deep_link,omitempty"`
	ForSuperFollowersOnly bool   `json:"for_super_followers_only,omitempty"`
	Geo                   *Geo   `json:"geo,omitempty"`
	Media                 *Media `json:"media,omitempty"`
	Poll                  *Poll  `json:"poll,omitempty"`
	QuoteTweetID          string `json:"quote_tweet_id,omitempty"`
	Reply                 *Reply `json:"reply,omitempty"`
	ReplySettings         string `json:"reply_settings,omitempty"`
}

type TweetResponse

type TweetResponse struct {
	Data TweetPostResult `json:"data"`
}

type TwitterConf

type TwitterConf struct {
	ClientID       string `json:"client_id"`
	ClientSecret   string `json:"client_secret"`
	ConsumerKey    string `json:"consumer_key"`
	ConsumerSecret string `json:"consumer_secret"`
}

func (*TwitterConf) String

func (c *TwitterConf) String() string

type VerifiedTwitterUser

type VerifiedTwitterUser struct {
	ContributorsEnabled            bool   `json:"contributors_enabled"`
	CreatedAt                      string `json:"created_at"`
	DefaultProfile                 bool   `json:"default_profile"`
	DefaultProfileImage            bool   `json:"default_profile_image"`
	Description                    string `json:"description"`
	FavouritesCount                int    `json:"favourites_count"`
	FollowersCount                 int    `json:"followers_count"`
	FriendsCount                   int    `json:"friends_count"`
	GeoEnabled                     bool   `json:"geo_enabled"`
	ID                             int64  `json:"id"`
	IDStr                          string `json:"id_str"`
	IsTranslator                   bool   `json:"is_translator"`
	Lang                           string `json:"lang"`
	ListedCount                    int    `json:"listed_count"`
	Location                       string `json:"location"`
	Name                           string `json:"name"`
	ProfileBackgroundColor         string `json:"profile_background_color"`
	ProfileBackgroundImageUrl      string `json:"profile_background_image_url"`
	ProfileBackgroundImageUrlHttps string `json:"profile_background_image_url_https"`
	ProfileBackgroundTile          bool   `json:"profile_background_tile"`
	ProfileImageUrl                string `json:"profile_image_url"`
	ProfileImageUrlHttps           string `json:"profile_image_url_https"`
	ProfileLinkColor               string `json:"profile_link_color"`
	ProfileSidebarBorderColor      string `json:"profile_sidebar_border_color"`
	ProfileSidebarFillColor        string `json:"profile_sidebar_fill_color"`
	ProfileTextColor               string `json:"profile_text_color"`
	ProfileUseBackgroundImage      bool   `json:"profile_use_background_image"`
	Protected                      bool   `json:"protected"`
	ScreenName                     string `json:"screen_name"`
	ShowAllInlineMedia             bool   `json:"show_all_inline_media"`
	StatusesCount                  int    `json:"statuses_count"`
	TimeZone                       string `json:"time_zone"`
	URL                            string `json:"url"`
	UtcOffset                      int    `json:"utc_offset"`
	Verified                       bool   `json:"verified"`
}

type Web3BindingData

type Web3BindingData struct {
	EthAddr  string `json:"eth_addr"`
	TwID     string `json:"tw_id"`
	BindTime int64  `json:"bind_time"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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