mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 09:14:06 +08:00
add access
This commit is contained in:
parent
b133aa5ac4
commit
5c858eb440
@ -539,6 +539,15 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
|
case "access": // 查看用户
|
||||||
|
h := m.Cmdx("aaa.auth", "access", kit.Hashs(m.Option("remote_ip"), m.Option("username")))
|
||||||
|
m.Cmd("aaa.auth", h, "data",
|
||||||
|
"remote_ip", m.Option("remote_ip"),
|
||||||
|
"username", m.Option("username"),
|
||||||
|
)
|
||||||
|
m.Echo(h)
|
||||||
|
return
|
||||||
|
|
||||||
case "user": // 查看用户
|
case "user": // 查看用户
|
||||||
m.Log("fuck", "what %v", arg)
|
m.Log("fuck", "what %v", arg)
|
||||||
m.Cmdy("aaa.auth", sid, "ship", "username")
|
m.Cmdy("aaa.auth", sid, "ship", "username")
|
||||||
@ -766,8 +775,8 @@ var Index = &ctx.Context{Name: "aaa", Help: "认证中心",
|
|||||||
|
|
||||||
// 生成证书
|
// 生成证书
|
||||||
template := x509.Certificate{
|
template := x509.Certificate{
|
||||||
SerialNumber: big.NewInt(1),
|
SerialNumber: big.NewInt(1),
|
||||||
IsCA: true,
|
IsCA: true,
|
||||||
BasicConstraintsValid: true,
|
BasicConstraintsValid: true,
|
||||||
KeyUsage: x509.KeyUsageCertSign,
|
KeyUsage: x509.KeyUsageCertSign,
|
||||||
Subject: pkix.Name{CommonName: kit.Format(common)},
|
Subject: pkix.Name{CommonName: kit.Format(common)},
|
||||||
|
@ -92,6 +92,9 @@ func (web *WEB) Login(msg *ctx.Message, w http.ResponseWriter, r *http.Request)
|
|||||||
// if msg.Confs("skip_login", msg.Option("path")) {
|
// if msg.Confs("skip_login", msg.Option("path")) {
|
||||||
// return true
|
// return true
|
||||||
// }
|
// }
|
||||||
|
defer func() {
|
||||||
|
msg.Option("access", msg.Cmdx("aaa.sess", "access"))
|
||||||
|
}()
|
||||||
if msg.Confs("login", "cas") {
|
if msg.Confs("login", "cas") {
|
||||||
if !cas.IsAuthenticated(r) {
|
if !cas.IsAuthenticated(r) {
|
||||||
r.URL, _ = r.URL.Parse(r.Header.Get("index_url"))
|
r.URL, _ = r.URL.Parse(r.Header.Get("index_url"))
|
||||||
@ -656,54 +659,54 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
m.Put("option", "data", result).Cmdy("mdb.temp", "url", uri+uri_arg, "data", "data", m.Meta["temp"])
|
m.Put("option", "data", result).Cmdy("mdb.temp", "url", uri+uri_arg, "data", "data", m.Meta["temp"])
|
||||||
|
|
||||||
case parse == "html":
|
case parse == "html":
|
||||||
/*
|
/*
|
||||||
page, e := goquery.NewDocumentFromReader(res.Body)
|
page, e := goquery.NewDocumentFromReader(res.Body)
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
|
|
||||||
page.Find(kit.Select("html", m.Option("parse_chain"))).Each(func(n int, s *goquery.Selection) {
|
page.Find(kit.Select("html", m.Option("parse_chain"))).Each(func(n int, s *goquery.Selection) {
|
||||||
if m.Options("parse_select") {
|
if m.Options("parse_select") {
|
||||||
for i := 0; i < len(m.Meta["parse_select"])-2; i += 3 {
|
for i := 0; i < len(m.Meta["parse_select"])-2; i += 3 {
|
||||||
item := s.Find(m.Meta["parse_select"][i+1])
|
item := s.Find(m.Meta["parse_select"][i+1])
|
||||||
if m.Meta["parse_select"][i+1] == "" {
|
if m.Meta["parse_select"][i+1] == "" {
|
||||||
item = s
|
item = s
|
||||||
|
}
|
||||||
|
if v, ok := item.Attr(m.Meta["parse_select"][i+2]); ok {
|
||||||
|
m.Add("append", m.Meta["parse_select"][i], v)
|
||||||
|
m.Log("info", "item attr %v", v)
|
||||||
|
} else {
|
||||||
|
m.Add("append", m.Meta["parse_select"][i], strings.Replace(item.Text(), "\n", "", -1))
|
||||||
|
m.Log("info", "item text %v", item.Text())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if v, ok := item.Attr(m.Meta["parse_select"][i+2]); ok {
|
return
|
||||||
m.Add("append", m.Meta["parse_select"][i], v)
|
}
|
||||||
m.Log("info", "item attr %v", v)
|
|
||||||
} else {
|
s.Find("a").Each(func(n int, s *goquery.Selection) {
|
||||||
m.Add("append", m.Meta["parse_select"][i], strings.Replace(item.Text(), "\n", "", -1))
|
if attr, ok := s.Attr("href"); ok {
|
||||||
m.Log("info", "item text %v", item.Text())
|
s.SetAttr("href", proxy(m, attr))
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
return
|
s.Find("img").Each(func(n int, s *goquery.Selection) {
|
||||||
}
|
if attr, ok := s.Attr("src"); ok {
|
||||||
|
s.SetAttr("src", proxy(m, attr))
|
||||||
|
}
|
||||||
|
if attr, ok := s.Attr("r-lazyload"); ok {
|
||||||
|
s.SetAttr("src", proxy(m, attr))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
s.Find("script").Each(func(n int, s *goquery.Selection) {
|
||||||
|
if attr, ok := s.Attr("src"); ok {
|
||||||
|
s.SetAttr("src", proxy(m, attr))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
s.Find("a").Each(func(n int, s *goquery.Selection) {
|
if html, e := s.Html(); e == nil {
|
||||||
if attr, ok := s.Attr("href"); ok {
|
m.Add("append", "html", html)
|
||||||
s.SetAttr("href", proxy(m, attr))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
s.Find("img").Each(func(n int, s *goquery.Selection) {
|
|
||||||
if attr, ok := s.Attr("src"); ok {
|
|
||||||
s.SetAttr("src", proxy(m, attr))
|
|
||||||
}
|
|
||||||
if attr, ok := s.Attr("r-lazyload"); ok {
|
|
||||||
s.SetAttr("src", proxy(m, attr))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
s.Find("script").Each(func(n int, s *goquery.Selection) {
|
|
||||||
if attr, ok := s.Attr("src"); ok {
|
|
||||||
s.SetAttr("src", proxy(m, attr))
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
m.Table()
|
||||||
|
|
||||||
if html, e := s.Html(); e == nil {
|
*/
|
||||||
m.Add("append", "html", html)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
m.Table()
|
|
||||||
|
|
||||||
*/
|
|
||||||
default:
|
default:
|
||||||
if m.Options("save") {
|
if m.Options("save") {
|
||||||
f, e := os.Create(m.Option("save"))
|
f, e := os.Create(m.Option("save"))
|
||||||
|
@ -73,9 +73,9 @@ var Index = &ctx.Context{Name: "wiki", Help: "文档中心",
|
|||||||
which := m.Cmdx("nfs.path", path.Join(m.Confx("wiki_level"), m.Option("wiki_class"), m.Confx("wiki_favor", arg, 0)))
|
which := m.Cmdx("nfs.path", path.Join(m.Confx("wiki_level"), m.Option("wiki_class"), m.Confx("wiki_favor", arg, 0)))
|
||||||
|
|
||||||
if ls, e := ioutil.ReadFile(which); e == nil {
|
if ls, e := ioutil.ReadFile(which); e == nil {
|
||||||
m.Confi("wiki_visit", []string{which, m.Option("remote_ip")},
|
m.Conf("wiki_visit", []string{which, m.Option("access")},
|
||||||
m.Confi("wiki_visit", []string{which, m.Option("remote_ip")})+1)
|
m.Confi("wiki_visit", []string{which, m.Option("access")})+1)
|
||||||
m.Append("visit_count", m.Confi("wiki_visit", []string{which, m.Option("remote_ip")}))
|
m.Append("visit_count", m.Confi("wiki_visit", []string{which, m.Option("access")}))
|
||||||
m.Append("visit_total", len(m.Confm("wiki_visit", []string{which})))
|
m.Append("visit_total", len(m.Confm("wiki_visit", []string{which})))
|
||||||
|
|
||||||
buffer := bytes.NewBuffer([]byte{})
|
buffer := bytes.NewBuffer([]byte{})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user