mirror of https://github.com/EasyDarwin/EasyDarwin
add missing www files
parent
02ee38a14c
commit
313aced59a
23
main.go
23
main.go
|
@ -9,8 +9,6 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-ini/ini"
|
||||
|
||||
"github.com/EasyDarwin/EasyDarwin/models"
|
||||
"github.com/EasyDarwin/EasyDarwin/routers"
|
||||
"github.com/EasyDarwin/EasyDarwin/rtsp"
|
||||
|
@ -131,7 +129,7 @@ func (p *program) Stop(s service.Service) (err error) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
configPath := flag.String("config", "", "configure file path")
|
||||
flag.StringVar(&utils.FlagVarConfFile, "config", "", "configure file path")
|
||||
flag.Parse()
|
||||
tail := flag.Args()
|
||||
log.SetPrefix("[EasyDarwin] ")
|
||||
|
@ -139,21 +137,7 @@ func main() {
|
|||
if utils.Debug {
|
||||
log.SetFlags(log.Lshortfile | log.LstdFlags)
|
||||
}
|
||||
var conf *ini.File
|
||||
var err error
|
||||
if len(*configPath) != 0 {
|
||||
log.Printf("use config file[%s]", *configPath)
|
||||
conf, err = utils.ConfByPath(*configPath)
|
||||
} else {
|
||||
conf = utils.Conf()
|
||||
err = nil
|
||||
}
|
||||
if err != nil {
|
||||
log.Print(err)
|
||||
log.Printf("EasyDarwin terminate due to config not found.")
|
||||
return
|
||||
}
|
||||
sec := conf.Section("service")
|
||||
sec := utils.Conf().Section("service")
|
||||
svcConfig := &service.Config{
|
||||
Name: sec.Key("name").MustString("EasyDarwin_Service"),
|
||||
DisplayName: sec.Key("display_name").MustString("EasyDarwin_Service"),
|
||||
|
@ -173,8 +157,7 @@ func main() {
|
|||
utils.PauseExit()
|
||||
}
|
||||
if len(tail) > 0 {
|
||||
cmd := tail[0]
|
||||
cmd = strings.ToLower(cmd)
|
||||
cmd := strings.ToLower(tail[0])
|
||||
if cmd == "install" || cmd == "stop" || cmd == "start" || cmd == "uninstall" {
|
||||
if cmd == "install" || cmd == "stop" {
|
||||
figure.NewFigure("EasyDarwin", "", false).Print()
|
||||
|
|
|
@ -24,26 +24,41 @@ func (p PageForm) String() string {
|
|||
func NewPageForm() *PageForm {
|
||||
return &PageForm{
|
||||
Start: 0,
|
||||
Limit: math.MaxUint32,
|
||||
Limit: math.MaxInt32,
|
||||
}
|
||||
}
|
||||
|
||||
type PageResult struct {
|
||||
Total int `json:"total"`
|
||||
Rows []interface{} `json:"rows"`
|
||||
Total int `json:"total"`
|
||||
Rows interface{} `json:"rows"`
|
||||
}
|
||||
|
||||
func NewPageResult(rows []interface{}) *PageResult {
|
||||
return &PageResult{
|
||||
Total: reflect.ValueOf(rows).Len(),
|
||||
Rows: rows,
|
||||
func NewPageResult(rows interface{}) *PageResult {
|
||||
v := reflect.ValueOf(rows)
|
||||
if v.Kind() == reflect.Slice {
|
||||
return &PageResult{
|
||||
Total: v.Len(),
|
||||
Rows: rows,
|
||||
}
|
||||
} else {
|
||||
return &PageResult{
|
||||
Total: 1,
|
||||
Rows: []interface{}{rows},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (pr *PageResult) Slice(start, limit int) *PageResult {
|
||||
if limit < 0 || start < 0 {
|
||||
return pr
|
||||
}
|
||||
if pr.Rows == nil {
|
||||
return pr
|
||||
}
|
||||
v := reflect.ValueOf(pr.Rows)
|
||||
if v.Kind() != reflect.Slice {
|
||||
return pr
|
||||
}
|
||||
_start := start
|
||||
if _start > pr.Total {
|
||||
_start = pr.Total
|
||||
|
@ -52,7 +67,12 @@ func (pr *PageResult) Slice(start, limit int) *PageResult {
|
|||
if _end > pr.Total {
|
||||
_end = pr.Total
|
||||
}
|
||||
pr.Rows = pr.Rows[_start:_end]
|
||||
size := _end - _start
|
||||
_rows := make([]interface{}, size)
|
||||
for i := 0; i < size; i++ {
|
||||
_rows[i] = v.Index(_start + i).Interface()
|
||||
}
|
||||
pr.Rows = _rows
|
||||
return pr
|
||||
}
|
||||
|
||||
|
@ -63,23 +83,33 @@ func (pr *PageResult) Sort(by, order string) *PageResult {
|
|||
if reflect.TypeOf(pr.Rows).Kind() != reflect.Slice {
|
||||
return pr
|
||||
}
|
||||
if reflect.ValueOf(pr.Rows).Len() == 0 {
|
||||
return pr
|
||||
}
|
||||
te := reflect.TypeOf(pr.Rows).Elem()
|
||||
for te.Kind() == reflect.Array || te.Kind() == reflect.Chan || te.Kind() == reflect.Map || te.Kind() == reflect.Ptr || te.Kind() == reflect.Slice {
|
||||
te = te.Elem()
|
||||
}
|
||||
if te.Kind() == reflect.Interface {
|
||||
va := reflect.ValueOf(pr.Rows).Index(0)
|
||||
for va.Kind() == reflect.Interface || va.Kind() == reflect.Ptr {
|
||||
va = va.Elem()
|
||||
}
|
||||
te = va.Type()
|
||||
}
|
||||
byIdx := -1
|
||||
if te.Kind() == reflect.Struct {
|
||||
for i := 0; i < te.NumField(); i++ {
|
||||
if strings.EqualFold(te.Field(i).Name, by) {
|
||||
// log.Printf("%v field name[%s] find field[%s], case insensitive", te, by, te.Field(i).Name)
|
||||
// log.Printf("%v field name[%s] find field[%s] index[%d], case insensitive", te, by, te.Field(i).Name, i)
|
||||
byIdx = i
|
||||
break
|
||||
}
|
||||
}
|
||||
if byIdx == -1 {
|
||||
log.Printf("%v field name[%s] not found, case insensitive", te, by)
|
||||
return pr
|
||||
}
|
||||
}
|
||||
if byIdx == -1 {
|
||||
log.Printf("%v field name[%s] not found, case insensitive", te, by)
|
||||
return pr
|
||||
}
|
||||
sort.Slice(pr.Rows, func(i, j int) (ret bool) {
|
||||
va := reflect.ValueOf(pr.Rows).Index(i)
|
||||
|
|
|
@ -2,7 +2,9 @@ package utils
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"regexp"
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
type StringArray string
|
||||
|
@ -25,3 +27,12 @@ func Ellipsis(text string, length int) string {
|
|||
}
|
||||
return text
|
||||
}
|
||||
|
||||
func HasChinese(str string) bool {
|
||||
for _, r := range str {
|
||||
if unicode.Is(unicode.Scripts["Han"], r) || (regexp.MustCompile("[\u3002\uff1b\uff0c\uff1a\u201c\u201d\uff08\uff09\u3001\uff1f\u300a\u300b]").MatchString(string(r))) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -97,7 +97,12 @@ func DataDir() string {
|
|||
return dir
|
||||
}
|
||||
|
||||
var FlagVarConfFile string
|
||||
|
||||
func ConfFile() string {
|
||||
if FlagVarConfFile != "" {
|
||||
return FlagVarConfFile
|
||||
}
|
||||
if Exist(ConfFileDev()) {
|
||||
return ConfFileDev()
|
||||
}
|
||||
|
@ -108,7 +113,12 @@ func ConfFileDev() string {
|
|||
return filepath.Join(CWD(), strings.ToLower(EXEName())+".dev.ini")
|
||||
}
|
||||
|
||||
var FlagVarDBFile string
|
||||
|
||||
func DBFile() string {
|
||||
if FlagVarDBFile != "" {
|
||||
return FlagVarDBFile
|
||||
}
|
||||
if Exist(DBFileDev()) {
|
||||
return DBFileDev()
|
||||
}
|
||||
|
@ -134,18 +144,6 @@ func Conf() *ini.File {
|
|||
return conf
|
||||
}
|
||||
|
||||
func ConfByPath(path string) (*ini.File, error) {
|
||||
if conf != nil {
|
||||
return conf, nil
|
||||
}
|
||||
if _conf, err := ini.InsensitiveLoad(path); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
conf = _conf
|
||||
}
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
func ReloadConf() *ini.File {
|
||||
if _conf, err := ini.InsensitiveLoad(ConfFile()); err != nil {
|
||||
_conf, _ = ini.LoadSources(ini.LoadOptions{Insensitive: true}, []byte(""))
|
||||
|
|
|
@ -249,10 +249,10 @@
|
|||
"revisionTime": "2018-09-07T02:33:35Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "kZqtvHnHz371MO9IKlPp4NhmsPY=",
|
||||
"checksumSHA1": "1+jDqOOmKfkxmqBhm1hp5a70Qx4=",
|
||||
"path": "github.com/penggy/EasyGoLib/utils",
|
||||
"revision": "765210cb48b73ef8494f250c77bd0f9926accf3c",
|
||||
"revisionTime": "2018-10-15T03:08:32Z"
|
||||
"revision": "06f9b72921eecd9499778c905788e7bbcff1a217",
|
||||
"revisionTime": "2018-11-29T14:20:46Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "SBuXxdLcdTlDcOvRYEpnP0zp810=",
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -19,7 +19,7 @@ define({
|
|||
"apidoc": "0.3.0",
|
||||
"generator": {
|
||||
"name": "apidoc",
|
||||
"time": "2018-11-24T14:05:41.551Z",
|
||||
"time": "2018-11-29T14:31:43.382Z",
|
||||
"url": "http://apidocjs.com",
|
||||
"version": "0.17.6"
|
||||
}
|
||||
|
|
|
@ -1 +1,26 @@
|
|||
{
"name": "EasyDarwin",
"title": "EasyDarwin API Reference",
"order": [
"stats",
"Pushers",
"Players",
"sys",
"Login",
"Logout",
"GetUserInfo",
"ModifyPassword",
"GetServerInfo"
],
"version": "8.1.0",
"description": "EasyDarwin Open Source Media Server",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-11-24T03:30:17.645Z",
"url": "http://apidocjs.com",
"version": "0.17.7"
}
}
|
||||
{
|
||||
"name": "EasyDarwin",
|
||||
"title": "EasyDarwin API Reference",
|
||||
"order": [
|
||||
"stats",
|
||||
"Pushers",
|
||||
"Players",
|
||||
"sys",
|
||||
"Login",
|
||||
"Logout",
|
||||
"GetUserInfo",
|
||||
"ModifyPassword",
|
||||
"GetServerInfo"
|
||||
],
|
||||
"version": "8.1.0",
|
||||
"description": "EasyDarwin Open Source Media Server",
|
||||
"sampleUrl": false,
|
||||
"defaultVersion": "0.0.0",
|
||||
"apidoc": "0.3.0",
|
||||
"generator": {
|
||||
"name": "apidoc",
|
||||
"time": "2018-11-29T14:31:43.382Z",
|
||||
"url": "http://apidocjs.com",
|
||||
"version": "0.17.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
define([
|
||||
'./locales/ca.js',
|
||||
'./locales/cs.js',
|
||||
'./locales/de.js',
|
||||
'./locales/es.js',
|
||||
'./locales/fr.js',
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -7,9 +7,9 @@
|
|||
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
|
||||
<script src="js/jquery-2.2.4.js"></script>
|
||||
<script src="js/easy-player-lib.min.js"></script>
|
||||
<link href="css/index.2dfe04ff.css" rel="stylesheet"></head>
|
||||
<link href="css/index.09a1f19a.css" rel="stylesheet"></head>
|
||||
<body class="skin-green sidebar-mini">
|
||||
<div id="app"></div>
|
||||
|
||||
<script type="text/javascript" src="js/index.2dfe04ff.js"></script></body>
|
||||
<script type="text/javascript" src="js/index.09a1f19a.js"></script></body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
webpackJsonp([4],{OjLt:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s=r("NYxO"),i=r("PJh5"),a=function(t){return t&&t.__esModule?t:{default:t}}(i);e.default={data:function(){return{timer:0,runningTime:""}},computed:n({},(0,s.mapState)(["serverInfo"])),mounted:function(){var t=this;this.timer=setInterval(function(){if(t.serverInfo&&t.serverInfo.StartUpTime){var e=(0,a.default)(t.serverInfo.StartUpTime,"YYYY-MM-DD HH:mm:ss"),r=(0,a.default)(),n=a.default.duration(r.diff(e));t.runningTime=parseInt(n.asDays())+" Days "+n.hours()+" Hours "+n.minutes()+" Mins "+n.seconds()+" Secs"}},1e3)},beforeDestroy:function(){this.timer&&(clearInterval(this.timer),this.timer=0)},methods:{}}},qCDb:function(t,e,r){"use strict";r.d(e,"a",function(){return n}),r.d(e,"b",function(){return s});var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"container-fluid no-padding"},[r("div",{staticClass:"col-lg-offset-2 col-lg-8 no-padding server-info"},[r("div",{staticClass:"box box-widget"},[t._m(0),t._v(" "),r("div",{staticClass:"box-body table-responsive no-padding"},[r("table",{staticClass:"table table-striped"},[r("tbody",[r("tr",[r("td",{staticStyle:{width:"20%"}},[t._v("硬件信息")]),t._v(" "),r("td",[r("span",{attrs:{id:"hardware-info"}},[t._v(t._s(t.serverInfo.Hardware))])])]),t._v(" "),r("tr",[r("td",[t._v("接口版本")]),t._v(" "),r("td",[r("span",{attrs:{id:"interface-info"}},[t._v(t._s(t.serverInfo.InterfaceVersion))])])]),t._v(" "),r("tr",[r("td",[t._v("运行时间")]),t._v(" "),r("td",[r("span",{attrs:{id:"running-time-info"}},[t._v(t._s(t.runningTime||t.serverInfo.RunningTime))])])]),t._v(" "),r("tr",[r("td",[t._v("软件信息")]),t._v(" "),r("td",[r("span",{attrs:{id:"software-info"}},[t._v(t._s(t.serverInfo.Server))])])])])])])])])])},s=[function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"box-header"},[r("h3",[r("i",{staticClass:"fa fa-support"}),t._v(" 版本信息")])])}]},sZXX:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=r("OjLt"),s=r.n(n);for(var i in n)"default"!==i&&function(t){r.d(e,t,function(){return n[t]})}(i);var a=r("qCDb"),o=r("XyMi"),d=Object(o.a)(s.a,a.a,a.b,!1,null,null,null);e.default=d.exports}});
|
|
@ -0,0 +1 @@
|
|||
webpackJsonp([3],{QYg8:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},a=s("PJh5"),i=(function(t){t&&t.__esModule}(a),s("NYxO"));e.default={data:function(){return{timer:0,memSettings:{area:!0,xAxisType:"time",yAxisType:["percent"],min:[0],max:[1]},cntSettings:{area:!0,xAxisType:"time",yAxisType:["normal"],min:[0],max:[100]}}},mounted:function(){var t=this;this.timer=setInterval(function(){t.getServerInfo()},2e3)},beforeDestroy:function(){this.timer&&(clearInterval(this.timer),this.timer=0)},computed:n({},(0,i.mapState)(["serverInfo"]),{cpuData:function(){return{columns:["time","使用"],rows:this.serverInfo?this.serverInfo.cpuData:[]}},memData:function(){return{columns:["time","使用"],rows:this.serverInfo?this.serverInfo.memData:[]}},pusherData:function(){return{columns:["time","总数"],rows:this.serverInfo?this.serverInfo.pusherData:[]}},playerData:function(){return{columns:["time","总数"],rows:this.serverInfo?this.serverInfo.playerData:[]}}}),methods:n({},(0,i.mapActions)(["getServerInfo"]))}},pmXR:function(t,e,s){"use strict";s.d(e,"a",function(){return n}),s.d(e,"b",function(){return a});var n=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"container-fluid no-padding"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-md-6"},[s("div",{staticClass:"panel"},[s("div",{staticClass:"panel-body"},[s("ve-line",{attrs:{data:t.cpuData,settings:t.memSettings,"legend-visible":!1,title:{text:"CPU使用",left:"center"}}})],1)])]),t._v(" "),s("div",{staticClass:"col-md-6"},[s("div",{staticClass:"panel"},[s("div",{staticClass:"panel-body"},[s("ve-line",{attrs:{data:t.memData,settings:t.memSettings,"legend-visible":!1,title:{text:"内存使用",left:"center"}}})],1)])]),t._v(" "),s("div",{staticClass:"col-md-6"},[s("div",{staticClass:"panel"},[s("div",{staticClass:"panel-body"},[s("ve-line",{attrs:{data:t.pusherData,settings:t.cntSettings,"legend-visible":!1,title:{text:"推流统计",left:"center"}}})],1)])]),t._v(" "),s("div",{staticClass:"col-md-6"},[s("div",{staticClass:"panel"},[s("div",{staticClass:"panel-body"},[s("ve-line",{attrs:{data:t.playerData,settings:t.cntSettings,"legend-visible":!1,title:{text:"拉流统计",left:"center"}}})],1)])])])])},a=[]},"w+5F":function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=s("QYg8"),a=s.n(n);for(var i in n)"default"!==i&&function(t){s.d(e,t,function(){return n[t]})}(i);var r=s("pmXR"),l=s("XyMi"),o=Object(l.a)(a.a,r.a,r.b,!1,null,null,null);e.default=o.exports}});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6,8 +6,8 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
|
||||
<script src="js/jquery-2.2.4.js"></script>
|
||||
<link href="css/login.9556aee7.css" rel="stylesheet"></head>
|
||||
<link href="css/login.cf365b39.css" rel="stylesheet"></head>
|
||||
<body class="hold-transition login-page">
|
||||
<div id="app"></div>
|
||||
<script type="text/javascript" src="js/login.9556aee7.js"></script></body>
|
||||
<script type="text/javascript" src="js/login.cf365b39.js"></script></body>
|
||||
</html>
|
Loading…
Reference in New Issue