Documentation
¶
Index ¶
- Constants
- Variables
- func Debugf(format string, args ...interface{})
- func Draw()
- func Infof(format string, args ...interface{})
- func Keybinds()
- func OpenChrome(openable Openable) error
- func Run() error
- func Setup(cfg *Config)
- func Warnf(format string, args ...interface{})
- func WatchUpgrade()
- type ActivitiesPageResponse
- type Activity
- type ActivityType
- type AuthInfo
- type AuthStatus
- type BasePageInfo
- type Category
- type Comment
- type Config
- type ConfigAttrSelectors
- type ContentPageResponse
- type Convert
- type DetailPost
- type IGeekHub
- type MePageResponse
- type MoleculesInfo
- type NewVersion
- type Openable
- type PostCommentArgs
- type PostPageResponse
- type PreviewPost
- type User
- type UserDetail
Constants ¶
View Source
const ( HomePage = "https://geekhub.com/" PostsURI = "posts" SecondHandsURI = "second_hands" AuctionsURI = "auctions" MoleculesURI = "molecules" GroupBuysURI = "group_buys" ActivitiesURI = "activities" PostCommentURI = "comments" GbitOrderURI = "gbit_orders" CheckinsURI = "checkins" SignURI = "checkins/start" )
View Source
const ( ReplyPost = iota GbitOrder GetMolecules //抢到分子 YourMoleculesFinish //分子结束 OrderComment //评价订单 Unknow //未识别的 )
View Source
const ( PostType postType = "Post" SecondHandType = "SecondHand" AuctionType = "Auction" MoleculeType = "Molecule" GroupBuyType = "GroupBuy" )
View Source
const DefaultAuthRefreshIntervel = 60 * time.Second
View Source
const DefaultSign = "\n\n 「来自 geekterm」"
View Source
const DefaultUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36"
View Source
const VersionFile = "https://raw.githubusercontent.com/rrylee/geekterm/master/version.txt"
Variables ¶
View Source
var ( InternetError = errors.New("Internet Error.") GoQueryError = errors.New("GoQuery error.") )
View Source
var Converter *converter
View Source
var ShutcutKeys = [][3]string{
{"上下左右", "正常移动", "左右可以切换不同的窗口"},
{"j k h l", "对应以上", ""},
{"i", "查看个人动态", ""},
{"o", "打开到浏览器", "选中帖子,打开帖子,在动态,打开动态"},
{"n", "上一页", "帖子列表,评论列表"},
{"m", "下一页", "帖子列表,评论列表"},
{"r", "回帖", "如果选中某条评论,会回复留言"},
{"R", "回帖", "直接回帖"},
{"M", "直接进入评论列表", ""},
{"q", "退出程序", ""},
{"enter", "各种确定操作", "加载帖子,提交评论"},
{"esc", "退出", "个人动态页使用"},
{"tab", "切换", "在评论弹窗切换选中区"},
}
View Source
var ShutcutTitles = []string{"键位", "功能", "备注"}
View Source
var Version = "beta0.4"
View Source
var VersionPublishOrder = []string{
"beta0.1",
"beta0.2",
"beta0.3",
"beta0.4",
}
Functions ¶
func OpenChrome ¶
func WatchUpgrade ¶
func WatchUpgrade()
Types ¶
type ActivitiesPageResponse ¶
type ActivitiesPageResponse struct {
*BasePageInfo
Activities []*Activity
}
type Activity ¶
type ActivityType ¶
type ActivityType int8
type BasePageInfo ¶
type BasePageInfo struct {
AuthInfo *AuthInfo
Status AuthStatus
}
type ConfigAttrSelectors ¶
type ConfigAttrSelectors struct {
PostList string
Post string
PostHref string
TextUser string //用户名(纯文字的)
PostCommentCount string
AuthStatus string //右上角登录状态
PostBody string
PostPageCommentCount string //post页面的评论数量标签
CommentList string
CommentContent string
PostPageAuthor string
PostPageTitle string
ActivityCount string
AuthUsername string
CommentAuthor string
CommentTime string
CommentFloor string
Activities string
ActivityTargetUri string
ActivityTargetTitle string
ActivityReplyContent string
ActivityBody string //整个动态中间内容区域
ActivityUser string
ActivityTime string
ActivityGetMoleculesLink string
ActivityYourMoleculesLink string
ReplyToken string
CommentParentUser string
CommentParentContent string
CommentCurPage string
CheckInButton string
MoleculeSeconds string
}
func GetDefaultConfigAttrSelectors ¶
func GetDefaultConfigAttrSelectors() *ConfigAttrSelectors
type ContentPageResponse ¶
type ContentPageResponse struct {
*BasePageInfo
Post *DetailPost
}
type DetailPost ¶
type DetailPost struct {
ID string
Title string
Content string
PostType postType
Uri string
Author *User
PublishTime string
PV string
CommentCount int64
CommentTotalPage int64
CurCommentPage int
Comments []*Comment
ExtraInfo interface{}
// contains filtered or unexported fields
}
func (DetailPost) GetUrl ¶
func (p DetailPost) GetUrl() string
type IGeekHub ¶
type IGeekHub interface {
GetMePage(userUri string) (*MePageResponse, error) //个人中心
GetHomePage(page int) (*PostPageResponse, error)
GetPostsPage(page int) (*PostPageResponse, error)
GetSecondHandsPage(page int) (*PostPageResponse, error)
GetAuctionsPage(page int) (*PostPageResponse, error)
GetMoleculesPage(page int) (*PostPageResponse, error)
GetGroupBuysPage(page int) (*PostPageResponse, error)
GetPostContent(pageUri string, page int) (*ContentPageResponse, error)
GetActivities(page int) (*ActivitiesPageResponse, error)
PostComment(arg *PostCommentArgs) error
GetSignStatus() (bool, string, error) //获取签到状态
CheckIn(token string) error //签到
}
var (
GeekHub IGeekHub
)
type MePageResponse ¶
type MePageResponse struct {
*BasePageInfo
}
type MoleculesInfo ¶
type NewVersion ¶
type NewVersion struct {
// contains filtered or unexported fields
}
func CheckNewVersion ¶
func CheckNewVersion() (hasNewVersion bool, newVersion *NewVersion, err error)
type PostCommentArgs ¶
type PostPageResponse ¶
type PostPageResponse struct {
*BasePageInfo
Posts []*PreviewPost
}
type PreviewPost ¶
type PreviewPost struct {
ID string
Title string
Uri string
Author *User
CommentCount int64
LatestReplyTime string
LatestReplyUser *User
}
func (PreviewPost) GetUrl ¶
func (p PreviewPost) GetUrl() string
type User ¶
type User struct {
Username string
PageUri string
UserDetail *UserDetail
}
type UserDetail ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
