├── .gitignore ├── static ├── js │ ├── custom.js │ └── twitter-bootstrap-hover-dropdown.min.js ├── bower │ ├── jquery │ │ ├── src │ │ │ ├── outro.js │ │ │ ├── selector.js │ │ │ ├── var │ │ │ │ ├── arr.js │ │ │ │ ├── rnotwhite.js │ │ │ │ ├── strundefined.js │ │ │ │ ├── push.js │ │ │ │ ├── slice.js │ │ │ │ ├── class2type.js │ │ │ │ ├── concat.js │ │ │ │ ├── indexOf.js │ │ │ │ ├── pnum.js │ │ │ │ ├── toString.js │ │ │ │ ├── hasOwn.js │ │ │ │ └── support.js │ │ │ ├── ajax │ │ │ │ ├── var │ │ │ │ │ ├── rquery.js │ │ │ │ │ └── nonce.js │ │ │ │ ├── parseJSON.js │ │ │ │ ├── parseXML.js │ │ │ │ ├── script.js │ │ │ │ └── load.js │ │ │ ├── css │ │ │ │ ├── var │ │ │ │ │ ├── rmargin.js │ │ │ │ │ ├── cssExpand.js │ │ │ │ │ ├── rnumnonpx.js │ │ │ │ │ ├── isHidden.js │ │ │ │ │ └── getStyles.js │ │ │ │ ├── hiddenVisibleSelectors.js │ │ │ │ ├── addGetHookIf.js │ │ │ │ ├── swap.js │ │ │ │ └── curCSS.js │ │ │ ├── data │ │ │ │ ├── var │ │ │ │ │ ├── data_priv.js │ │ │ │ │ └── data_user.js │ │ │ │ └── accepts.js │ │ │ ├── manipulation │ │ │ │ ├── var │ │ │ │ │ └── rcheckableType.js │ │ │ │ ├── _evalUrl.js │ │ │ │ └── support.js │ │ │ ├── core │ │ │ │ ├── var │ │ │ │ │ └── rsingleTag.js │ │ │ │ ├── parseHTML.js │ │ │ │ └── access.js │ │ │ ├── traversing │ │ │ │ └── var │ │ │ │ │ └── rneedsContext.js │ │ │ ├── event │ │ │ │ ├── support.js │ │ │ │ ├── ajax.js │ │ │ │ └── alias.js │ │ │ ├── attributes.js │ │ │ ├── deprecated.js │ │ │ ├── effects │ │ │ │ └── animatedSelector.js │ │ │ ├── selector-sizzle.js │ │ │ ├── queue │ │ │ │ └── delay.js │ │ │ ├── jquery.js │ │ │ ├── exports │ │ │ │ ├── global.js │ │ │ │ └── amd.js │ │ │ ├── attributes │ │ │ │ └── support.js │ │ │ ├── intro.js │ │ │ ├── wrap.js │ │ │ └── dimensions.js │ │ ├── bower.json │ │ ├── .bower.json │ │ └── MIT-LICENSE.txt │ ├── fontawesome │ │ ├── less │ │ │ ├── extras.less │ │ │ ├── fixed-width.less │ │ │ ├── bordered-pulled.less │ │ │ ├── larger.less │ │ │ ├── core.less │ │ │ ├── list.less │ │ │ ├── font-awesome.less │ │ │ ├── stacked.less │ │ │ ├── rotated-flipped.less │ │ │ ├── spinning.less │ │ │ ├── path.less │ │ │ └── mixins.less │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── scss │ │ │ ├── _fixed-width.scss │ │ │ ├── _bordered-pulled.scss │ │ │ ├── _larger.scss │ │ │ ├── _core.scss │ │ │ ├── _list.scss │ │ │ ├── font-awesome.scss │ │ │ ├── _stacked.scss │ │ │ ├── _spinning.scss │ │ │ ├── _path.scss │ │ │ ├── _rotated-flipped.scss │ │ │ ├── _mixins.scss │ │ │ └── _extras.scss │ │ ├── .gitignore │ │ ├── bower.json │ │ ├── .npmignore │ │ └── .bower.json │ └── bootstrap │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ │ ├── Gemfile │ │ ├── dist │ │ ├── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ │ └── npm.js │ │ ├── grunt │ │ ├── .jshintrc │ │ ├── bs-commonjs-generator.js │ │ ├── bs-raw-files-generator.js │ │ ├── configBridge.json │ │ ├── bs-glyphicons-data-generator.js │ │ └── sauce_browsers.yml │ │ ├── less │ │ ├── mixins │ │ │ ├── center-block.less │ │ │ ├── size.less │ │ │ ├── opacity.less │ │ │ ├── text-emphasis.less │ │ │ ├── text-overflow.less │ │ │ ├── background-variant.less │ │ │ ├── labels.less │ │ │ ├── resize.less │ │ │ ├── progress-bar.less │ │ │ ├── reset-filter.less │ │ │ ├── nav-divider.less │ │ │ ├── alerts.less │ │ │ ├── tab-focus.less │ │ │ ├── nav-vertical-align.less │ │ │ ├── responsive-visibility.less │ │ │ ├── border-radius.less │ │ │ ├── reset-text.less │ │ │ ├── pagination.less │ │ │ ├── panels.less │ │ │ ├── hide-text.less │ │ │ ├── list-group.less │ │ │ ├── clearfix.less │ │ │ ├── table-row.less │ │ │ ├── image.less │ │ │ └── buttons.less │ │ ├── .csslintrc │ │ ├── wells.less │ │ ├── breadcrumbs.less │ │ ├── responsive-embed.less │ │ ├── component-animations.less │ │ ├── close.less │ │ ├── thumbnails.less │ │ ├── utilities.less │ │ ├── pager.less │ │ ├── media.less │ │ ├── mixins.less │ │ ├── labels.less │ │ ├── jumbotron.less │ │ ├── badges.less │ │ ├── bootstrap.less │ │ ├── code.less │ │ ├── grid.less │ │ └── alerts.less │ │ ├── js │ │ └── .jshintrc │ │ ├── CHANGELOG.md │ │ ├── nuget │ │ ├── MyGet.ps1 │ │ ├── bootstrap.nuspec │ │ └── bootstrap.less.nuspec │ │ ├── bower.json │ │ ├── package.js │ │ ├── .bower.json │ │ ├── LICENSE │ │ ├── ISSUE_TEMPLATE.md │ │ └── Gemfile.lock ├── images │ ├── nothumb.png │ ├── cloud-storage-01.jpg │ ├── clusters-arch1.png │ ├── clusters-arch2.png │ ├── clusters-arch3.png │ ├── clusters-architecture.png │ ├── horizontal-scaling-03.jpg │ ├── cloud-storage-backup-02.jpg │ ├── clusters-architecture2.png │ └── clusters-architecture3.png └── css │ └── custom.css ├── pkg ├── app │ ├── admin │ │ ├── README.md │ │ ├── view │ │ │ ├── common │ │ │ │ ├── foot.tpl │ │ │ │ ├── head.tpl │ │ │ │ ├── error.tpl │ │ │ │ ├── paginator.tpl │ │ │ │ ├── base.tpl │ │ │ │ ├── paginator2.tpl │ │ │ │ └── alert.tpl │ │ │ └── index │ │ │ │ ├── links.tpl │ │ │ │ └── index.tpl │ │ ├── apihandler │ │ │ ├── index.go │ │ │ ├── errorcode.go │ │ │ ├── fs.go │ │ │ └── captcha.go │ │ └── handler │ │ │ ├── index.go │ │ │ ├── errorcode.go │ │ │ ├── fs.go │ │ │ └── captcha.go │ ├── customer │ │ ├── README.md │ │ ├── view │ │ │ ├── upload │ │ │ │ └── index.tpl │ │ │ ├── common │ │ │ │ ├── foot.tpl │ │ │ │ ├── head.tpl │ │ │ │ ├── error.tpl │ │ │ │ ├── paginator.tpl │ │ │ │ ├── paginator2.tpl │ │ │ │ └── alert.tpl │ │ │ ├── index │ │ │ │ └── links.tpl │ │ │ └── order │ │ │ │ └── mockpay.tpl │ │ ├── apihandler │ │ │ ├── index.go │ │ │ ├── myprofile.go │ │ │ ├── fs.go │ │ │ ├── errorcode.go │ │ │ └── captcha.go │ │ └── handler │ │ │ ├── index.go │ │ │ ├── myprofile.go │ │ │ ├── fs.go │ │ │ ├── errorcode.go │ │ │ └── captcha.go │ └── nodestorage │ │ ├── README.md │ │ ├── httpworker │ │ ├── DEPRECATED │ │ ├── ioc.go │ │ └── clusterhelper.go │ │ ├── grpcpingable │ │ └── pb │ │ │ ├── genproto.sh │ │ │ └── pingablepb │ │ │ └── pingable.proto │ │ ├── model │ │ └── storagemodel │ │ │ └── diskspace_test.go │ │ ├── pingableif │ │ └── if.go │ │ └── clusterworker │ │ ├── clusterhelper.go │ │ └── ioc.go ├── envinit │ ├── db_darwin.go │ └── db_linux.go ├── utils │ ├── md5.go │ ├── filehash │ │ ├── filesha1_test.go │ │ └── filesha1.go │ ├── jsonTime_test.go │ ├── other.go │ ├── randomstr.go │ ├── time.go │ ├── jsonTime.go │ └── syncmap.go ├── common │ └── constcode.go ├── dao │ ├── base │ │ ├── consts.go │ │ └── postgre.md │ ├── oper_log.go │ ├── role.go │ └── user_level.go └── log │ ├── log.go │ └── trace.go ├── flexdrive.db ├── deploy ├── codegen │ ├── flexdriveWordTpl │ │ ├── config │ │ └── struct.go.tpl │ ├── flexdrivetpl │ │ ├── config │ │ └── struct.go.tpl │ └── flexdrivecode │ │ ├── role.go │ │ ├── user_level.go │ │ ├── oper_log.go │ │ ├── share.go │ │ ├── node.go │ │ ├── manager.go │ │ ├── order.go │ │ ├── file_index.go │ │ ├── user_file.go │ │ └── user.go ├── deploy.sh ├── Dockerfile └── README.md ├── open127.0.0.2formac.sh ├── rebuild.sh ├── .github └── workflows │ └── go.yml ├── runcluster-mysql.sh ├── runcluster.sh ├── govscode.sh ├── LICENSE └── README.zhCN.md /.gitignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | -------------------------------------------------------------------------------- /static/js/custom.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pkg/app/admin/README.md: -------------------------------------------------------------------------------- 1 | 此文件夹为管理后台应用 -------------------------------------------------------------------------------- /pkg/app/customer/README.md: -------------------------------------------------------------------------------- 1 | 此文件夹为管理后台应用 -------------------------------------------------------------------------------- /pkg/app/customer/view/upload/index.tpl: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/bower/jquery/src/outro.js: -------------------------------------------------------------------------------- 1 | })); 2 | -------------------------------------------------------------------------------- /static/bower/jquery/src/selector.js: -------------------------------------------------------------------------------- 1 | define([ "./selector-sizzle" ]); 2 | -------------------------------------------------------------------------------- /flexdrive.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/flexdrive.db -------------------------------------------------------------------------------- /static/bower/jquery/src/var/arr.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return []; 3 | }); 4 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/extras.less: -------------------------------------------------------------------------------- 1 | // Extras 2 | // -------------------------- 3 | -------------------------------------------------------------------------------- /static/bower/jquery/src/ajax/var/rquery.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/\?/); 3 | }); 4 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/rnotwhite.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/\S+/g); 3 | }); 4 | -------------------------------------------------------------------------------- /pkg/app/admin/view/common/foot.tpl: -------------------------------------------------------------------------------- 1 | {{define "common/foot.tpl"}} 2 | 3 | 4 | 5 | {{end}} -------------------------------------------------------------------------------- /static/bower/jquery/src/css/var/rmargin.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/^margin/); 3 | }); 4 | -------------------------------------------------------------------------------- /static/images/nothumb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/nothumb.png -------------------------------------------------------------------------------- /pkg/app/customer/view/common/foot.tpl: -------------------------------------------------------------------------------- 1 | {{define "common/foot.tpl"}} 2 | 3 | 4 | 5 | {{end}} -------------------------------------------------------------------------------- /pkg/app/nodestorage/README.md: -------------------------------------------------------------------------------- 1 | ## 说明 2 | 次文件夹为存储节点服务 3 | - 包含节点间通信的gRPC服务端 4 | - 包含节点当前节点存储管理 5 | - 负责注册为集群 -------------------------------------------------------------------------------- /static/bower/jquery/src/var/strundefined.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return typeof undefined; 3 | }); 4 | -------------------------------------------------------------------------------- /pkg/envinit/db_darwin.go: -------------------------------------------------------------------------------- 1 | package envinit 2 | 3 | import ( 4 | _ "github.com/mattn/go-sqlite3" 5 | ) 6 | -------------------------------------------------------------------------------- /pkg/envinit/db_linux.go: -------------------------------------------------------------------------------- 1 | package envinit 2 | 3 | import ( 4 | _ "github.com/mattn/go-sqlite3" 5 | ) 6 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/push.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.push; 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/slice.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.slice; 5 | }); 6 | -------------------------------------------------------------------------------- /static/images/cloud-storage-01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/cloud-storage-01.jpg -------------------------------------------------------------------------------- /static/images/clusters-arch1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/clusters-arch1.png -------------------------------------------------------------------------------- /static/images/clusters-arch2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/clusters-arch2.png -------------------------------------------------------------------------------- /static/images/clusters-arch3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/clusters-arch3.png -------------------------------------------------------------------------------- /static/bower/jquery/src/var/class2type.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | // [[Class]] -> type pairs 3 | return {}; 4 | }); 5 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/concat.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.concat; 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/indexOf.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./arr" 3 | ], function( arr ) { 4 | return arr.indexOf; 5 | }); 6 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/httpworker/DEPRECATED: -------------------------------------------------------------------------------- 1 | this package is deprecated. 2 | use grpcpingable,httppingable,clusterworker instead. -------------------------------------------------------------------------------- /static/bower/jquery/src/css/var/cssExpand.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return [ "Top", "Right", "Bottom", "Left" ]; 3 | }); 4 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/pnum.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 3 | }); 4 | -------------------------------------------------------------------------------- /static/images/clusters-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/clusters-architecture.png -------------------------------------------------------------------------------- /static/images/horizontal-scaling-03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/horizontal-scaling-03.jpg -------------------------------------------------------------------------------- /static/bower/jquery/src/data/var/data_priv.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../Data" 3 | ], function( Data ) { 4 | return new Data(); 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/jquery/src/data/var/data_user.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../Data" 3 | ], function( Data ) { 4 | return new Data(); 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/jquery/src/manipulation/var/rcheckableType.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return (/^(?:checkbox|radio)$/i); 3 | }); 4 | -------------------------------------------------------------------------------- /static/images/cloud-storage-backup-02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/cloud-storage-backup-02.jpg -------------------------------------------------------------------------------- /static/images/clusters-architecture2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/clusters-architecture2.png -------------------------------------------------------------------------------- /static/images/clusters-architecture3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/images/clusters-architecture3.png -------------------------------------------------------------------------------- /deploy/codegen/flexdriveWordTpl/config: -------------------------------------------------------------------------------- 1 | lang=go 2 | genJson=0 3 | prefix= 4 | ignoreColumnsJSON= 5 | created= 6 | updated= 7 | deleted= 8 | -------------------------------------------------------------------------------- /static/bower/jquery/src/ajax/var/nonce.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../core" 3 | ], function( jQuery ) { 4 | return jQuery.now(); 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/fontawesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/fontawesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /static/bower/jquery/src/var/toString.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./class2type" 3 | ], function( class2type ) { 4 | return class2type.toString; 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/jquery/src/core/var/rsingleTag.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | // Match a standalone tag 3 | return (/^<(\w+)\s*\/?>(?:<\/\1>|)$/); 4 | }); 5 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/hasOwn.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./class2type" 3 | ], function( class2type ) { 4 | return class2type.hasOwnProperty; 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/jquery/src/var/support.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | // All support tests are defined in their respective modules. 3 | return {}; 4 | }); 5 | -------------------------------------------------------------------------------- /deploy/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | go build cmd/node/main.go 3 | 4 | docker build 5 | # todo get docker image id 6 | #docker run $dockerImageId 7 | 8 | 9 | -------------------------------------------------------------------------------- /static/bower/fontawesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/fontawesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /static/bower/fontawesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/fontawesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /static/bower/fontawesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/fontawesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /deploy/codegen/flexdrivetpl/config: -------------------------------------------------------------------------------- 1 | lang=go 2 | genJson=0 3 | prefix= 4 | ignoreColumnsJSON= 5 | created=created,Created 6 | updated=updated,Updated 7 | deleted= 8 | -------------------------------------------------------------------------------- /static/bower/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/bower/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /static/bower/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /static/bower/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /static/bower/jquery/src/css/var/rnumnonpx.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../var/pnum" 3 | ], function( pnum ) { 4 | return new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 5 | }); 6 | -------------------------------------------------------------------------------- /static/bower/bootstrap/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | group :development, :test do 4 | gem 'jekyll', '~> 3.6.3' 5 | gem 'jekyll-sitemap', '~> 0.11.0' 6 | end 7 | -------------------------------------------------------------------------------- /static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /pkg/app/nodestorage/grpcpingable/pb/genproto.sh: -------------------------------------------------------------------------------- 1 | # 将proto生成go代码 2 | # 请前提安装好2个工具: protoc 和 protoc-gen-go 3 | protoc -I pingablepb/ pingablepb/pingable.proto --go_out=plugins=grpc:pingablepb -------------------------------------------------------------------------------- /static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uxff/flexdrive/HEAD/static/bower/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /static/bower/bootstrap/grunt/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends" : "../js/.jshintrc", 3 | "asi" : false, 4 | "browser" : false, 5 | "es3" : false, 6 | "node" : true 7 | } 8 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/fixed-width.less: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .@{fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_fixed-width.scss: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .#{$fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /static/bower/jquery/src/traversing/var/rneedsContext.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../core", 3 | "../../selector" 4 | ], function( jQuery ) { 5 | return jQuery.expr.match.needsContext; 6 | }); 7 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/model/storagemodel/diskspace_test.go: -------------------------------------------------------------------------------- 1 | package storagemodel 2 | 3 | // func TestDiskspace(t *testing.T) { 4 | // ds := DiskStatus("/") 5 | // t.Errorf("ds=+v", ds) 6 | // } 7 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/center-block.less: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | .center-block() { 4 | display: block; 5 | margin-left: auto; 6 | margin-right: auto; 7 | } 8 | -------------------------------------------------------------------------------- /static/bower/jquery/src/event/support.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../var/support" 3 | ], function( support ) { 4 | 5 | support.focusinBubbles = "onfocusin" in window; 6 | 7 | return support; 8 | 9 | }); 10 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/size.less: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | .size(@width; @height) { 4 | width: @width; 5 | height: @height; 6 | } 7 | 8 | .square(@size) { 9 | .size(@size; @size); 10 | } 11 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/opacity.less: -------------------------------------------------------------------------------- 1 | // Opacity 2 | 3 | .opacity(@opacity) { 4 | opacity: @opacity; 5 | // IE8 filter 6 | @opacity-ie: (@opacity * 100); 7 | filter: ~"alpha(opacity=@{opacity-ie})"; 8 | } 9 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/text-emphasis.less: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | .text-emphasis-variant(@color) { 4 | color: @color; 5 | a&:hover, 6 | a&:focus { 7 | color: darken(@color, 10%); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/text-overflow.less: -------------------------------------------------------------------------------- 1 | // Text overflow 2 | // Requires inline-block or block for proper styling 3 | 4 | .text-overflow() { 5 | overflow: hidden; 6 | text-overflow: ellipsis; 7 | white-space: nowrap; 8 | } 9 | -------------------------------------------------------------------------------- /pkg/utils/md5.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | ) 7 | 8 | func Md5(str string) string { 9 | enc := md5.New() 10 | enc.Write([]byte(str)) 11 | return hex.EncodeToString(enc.Sum(nil)) 12 | } 13 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/background-variant.less: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | .bg-variant(@color) { 4 | background-color: @color; 5 | a&:hover, 6 | a&:focus { 7 | background-color: darken(@color, 10%); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /pkg/common/constcode.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | // 数据库和redis命名空间 4 | const ( 5 | //DBDefautDrive = "mysql" 6 | DBSqliteDrive = "sqlite3" 7 | DBMysqlDrive = "mysql" 8 | RedisDrive = "redis_drive" 9 | ) 10 | 11 | var DBDefautDrive = DBMysqlDrive 12 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/labels.less: -------------------------------------------------------------------------------- 1 | // Labels 2 | 3 | .label-variant(@color) { 4 | background-color: @color; 5 | 6 | &[href] { 7 | &:hover, 8 | &:focus { 9 | background-color: darken(@color, 10%); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/resize.less: -------------------------------------------------------------------------------- 1 | // Resize anything 2 | 3 | .resizable(@direction) { 4 | resize: @direction; // Options: horizontal, vertical, both 5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible` 6 | } 7 | -------------------------------------------------------------------------------- /static/bower/jquery/src/attributes.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "./attributes/attr", 4 | "./attributes/prop", 5 | "./attributes/classes", 6 | "./attributes/val" 7 | ], function( jQuery ) { 8 | 9 | // Return jQuery for attributes-only inclusion 10 | return jQuery; 11 | }); 12 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/progress-bar.less: -------------------------------------------------------------------------------- 1 | // Progress bars 2 | 3 | .progress-bar-variant(@color) { 4 | background-color: @color; 5 | 6 | // Deprecated parent class requirement as of v3.2.0 7 | .progress-striped & { 8 | #gradient > .striped(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /static/bower/jquery/src/deprecated.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "./traversing" 4 | ], function( jQuery ) { 5 | 6 | // The number of elements contained in the matched element set 7 | jQuery.fn.size = function() { 8 | return this.length; 9 | }; 10 | 11 | jQuery.fn.andSelf = jQuery.fn.addBack; 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/reset-filter.less: -------------------------------------------------------------------------------- 1 | // Reset filters for IE 2 | // 3 | // When you need to remove a gradient background, do not forget to use this to reset 4 | // the IE filter for IE9 and below. 5 | 6 | .reset-filter() { 7 | filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); 8 | } 9 | -------------------------------------------------------------------------------- /static/bower/jquery/src/ajax/parseJSON.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Support: Android 2.3 6 | // Workaround failure to string-cast null input 7 | jQuery.parseJSON = function( data ) { 8 | return JSON.parse( data + "" ); 9 | }; 10 | 11 | return jQuery.parseJSON; 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /pkg/app/admin/apihandler/index.go: -------------------------------------------------------------------------------- 1 | package apihandler 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | func Index(c *gin.Context) { 10 | hostName, _ := os.Hostname() 11 | JsonOk(c, gin.H{ 12 | "hostname": hostName, 13 | "info": "this is flexdrive admin api server", 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /pkg/app/customer/apihandler/index.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "os" 5 | 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | func Index(c *gin.Context) { 10 | hostName, _ := os.Hostname() 11 | JsonOk(c, gin.H{ 12 | "hostname": hostName, 13 | "info": "this is flexdrive customer api server", 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/nav-divider.less: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | .nav-divider(@color: #e5e5e5) { 6 | height: 1px; 7 | margin: ((@line-height-computed / 2) - 1) 0; 8 | overflow: hidden; 9 | background-color: @color; 10 | } 11 | -------------------------------------------------------------------------------- /static/bower/jquery/src/effects/animatedSelector.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../selector", 4 | "../effects" 5 | ], function( jQuery ) { 6 | 7 | jQuery.expr.filters.animated = function( elem ) { 8 | return jQuery.grep(jQuery.timers, function( fn ) { 9 | return elem === fn.elem; 10 | }).length; 11 | }; 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /pkg/utils/filehash/filesha1_test.go: -------------------------------------------------------------------------------- 1 | package filehash 2 | 3 | import ( 4 | "testing" 5 | ) 6 | 7 | func TestSha1Enc(t *testing.T) { 8 | 9 | file := "/usr/local/gopath/src/github.com/uxff/flexdrive/main" 10 | hash, err := CalcSha1(file) 11 | 12 | if err != nil { 13 | t.Errorf("hash, err := %v, %v", hash, err) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /deploy/codegen/flexdriveWordTpl/struct.go.tpl: -------------------------------------------------------------------------------- 1 | package wordcode 2 | 3 | 4 | {{range .Tables}} 5 | {{$table := .}} 6 | var table_{{.Name}} = ` 7 | {{.Name}} 8 | 字段名 类型 长度 备注 外键 9 | {{range .ColumnsSeq}}{{$col := $table.GetColumn .}}{{Mapper $col.Name}} {{Type $col}} {{$col.Length}} {{$col.Comment}} 10 | {{end}} 11 | ` 12 | 13 | {{end}} 14 | -------------------------------------------------------------------------------- /pkg/app/admin/handler/index.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | func Index(c *gin.Context) { 10 | c.HTML(http.StatusOK, "index/index.tpl", gin.H{ 11 | "LoginInfo": getLoginInfo(c), 12 | "IsLogin": isLoginIn(c), 13 | "info": "this is flexdrive admin web server", 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/alerts.less: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | .alert-variant(@background; @border; @text-color) { 4 | background-color: @background; 5 | border-color: @border; 6 | color: @text-color; 7 | 8 | hr { 9 | border-top-color: darken(@border, 5%); 10 | } 11 | .alert-link { 12 | color: darken(@text-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /pkg/app/customer/handler/index.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/gin-gonic/gin" 7 | ) 8 | 9 | func Index(c *gin.Context) { 10 | c.HTML(http.StatusOK, "index/index.tpl", gin.H{ 11 | "LoginInfo": getLoginInfo(c), 12 | "IsLogin": isLoginIn(c), 13 | "info": "this is flexdrive customer web server", 14 | }) 15 | } 16 | -------------------------------------------------------------------------------- /static/bower/jquery/src/manipulation/_evalUrl.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../ajax" 3 | ], function( jQuery ) { 4 | 5 | jQuery._evalUrl = function( url ) { 6 | return jQuery.ajax({ 7 | url: url, 8 | type: "GET", 9 | dataType: "script", 10 | async: false, 11 | global: false, 12 | "throws": true 13 | }); 14 | }; 15 | 16 | return jQuery._evalUrl; 17 | 18 | }); 19 | -------------------------------------------------------------------------------- /static/bower/bootstrap/js/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi" : true, 3 | "browser" : true, 4 | "eqeqeq" : false, 5 | "eqnull" : true, 6 | "es3" : true, 7 | "expr" : true, 8 | "jquery" : true, 9 | "latedef" : true, 10 | "laxbreak" : true, 11 | "nonbsp" : true, 12 | "strict" : true, 13 | "undef" : true, 14 | "unused" : true 15 | } 16 | -------------------------------------------------------------------------------- /static/bower/jquery/src/selector-sizzle.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "sizzle" 4 | ], function( jQuery, Sizzle ) { 5 | 6 | jQuery.find = Sizzle; 7 | jQuery.expr = Sizzle.selectors; 8 | jQuery.expr[":"] = jQuery.expr.pseudos; 9 | jQuery.unique = Sizzle.uniqueSort; 10 | jQuery.text = Sizzle.getText; 11 | jQuery.isXMLDoc = Sizzle.isXML; 12 | jQuery.contains = Sizzle.contains; 13 | 14 | }); 15 | -------------------------------------------------------------------------------- /open127.0.0.2formac.sh: -------------------------------------------------------------------------------- 1 | #sudo ifconfig lo0 alias 127.0.0.2 netmask 0xFFFFFFFF 2 | sudo ifconfig lo0 alias 127.0.0.3 netmask 0xFFFFFFFF 3 | sudo ifconfig lo0 alias 127.0.0.4 netmask 0xFFFFFFFF 4 | sudo ifconfig lo0 alias 127.0.0.5 netmask 0xFFFFFFFF 5 | sudo ifconfig lo0 alias 127.0.0.6 netmask 0xFFFFFFFF 6 | sudo ifconfig lo0 alias 127.0.0.7 netmask 0xFFFFFFFF 7 | sudo ifconfig lo0 alias 127.0.0.8 netmask 0xFFFFFFFF 8 | 9 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/httpworker/ioc.go: -------------------------------------------------------------------------------- 1 | package httpworker 2 | 3 | // 依赖翻转的可操作接口说明 4 | 5 | // type PingableHandler interface { 6 | // OnRegistered(w *Worker) 7 | // //MsgTo(jsonableData interface{}) 8 | // OnMsg(fromId, data string) 9 | // } 10 | 11 | // todo ? 12 | // type MetaNode interface { 13 | // GetMeta(metaKey string) interface{} 14 | // SetMeta(metaKey string, metaValue interface{}) 15 | // } 16 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/tab-focus.less: -------------------------------------------------------------------------------- 1 | // WebKit-style focus 2 | 3 | .tab-focus() { 4 | // WebKit-specific. Other browsers will keep their default outline style. 5 | // (Initially tried to also force default via `outline: initial`, 6 | // but that seems to erroneously remove the outline in Firefox altogether.) 7 | outline: 5px auto -webkit-focus-ring-color; 8 | outline-offset: -2px; 9 | } 10 | -------------------------------------------------------------------------------- /static/bower/jquery/src/event/ajax.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../event" 4 | ], function( jQuery ) { 5 | 6 | // Attach a bunch of functions for handling common AJAX events 7 | jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { 8 | jQuery.fn[ type ] = function( fn ) { 9 | return this.on( type, fn ); 10 | }; 11 | }); 12 | 13 | }); 14 | -------------------------------------------------------------------------------- /pkg/dao/base/consts.go: -------------------------------------------------------------------------------- 1 | package base 2 | 3 | // 行数据的状态 4 | const ( 5 | StatusNormal = 1 6 | StatusInactive = 2 7 | StatusDeleted = 99 8 | ) 9 | 10 | const ( 11 | // 小于10的mid是超级管理 不可删除 12 | MaxSuperMid = 10 13 | // 小于10的roleid是超级管理角色 不可删除 14 | MaxSuperRoleId = 10 15 | ) 16 | 17 | var StatusMap = map[int]string{ 18 | StatusNormal: "正常", 19 | StatusInactive: "不活跃", 20 | StatusDeleted: "已删除", 21 | } 22 | -------------------------------------------------------------------------------- /pkg/utils/jsonTime_test.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "encoding/json" 5 | "testing" 6 | "time" 7 | ) 8 | 9 | type TTT struct { 10 | CreateAt JsonTime 11 | StdTime time.Time 12 | } 13 | 14 | func TestJsonTime_IsEmptyTime(t *testing.T) { 15 | a := &TTT{CreateAt: JsonTime{}} 16 | 17 | b, err := json.Marshal(a) 18 | if err != nil { 19 | t.Error(err) 20 | return 21 | } 22 | 23 | t.Logf("%s", b) 24 | } 25 | -------------------------------------------------------------------------------- /rebuild.sh: -------------------------------------------------------------------------------- 1 | ps aux | grep flexdrive | grep -v grep 2 | echo kill ` ps x | grep flexdrive | grep -v grep | awk '{print $1}'` 3 | kill ` ps x | grep flexdrive | grep -v grep | awk '{print $1}'` 4 | ps aux | grep flexdrive | grep -v grep 5 | 6 | git pull 7 | go build -o flexdrive cmd/node/main.go 8 | sh ./runcluster-mysql.sh 9 | #sleep 1 10 | #execute below in windows will cause flexdrive terminate. do not run below. 11 | #tail -f 1.log 12 | -------------------------------------------------------------------------------- /deploy/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | RUN apk --no-cache add ca-certificates 3 | 4 | #RUN git clone git@github.com:uxff/flexdrive.git 5 | #RUN cd flexdrive 6 | #RUN go build -o flexdrive cmd/node/main.go 7 | 8 | ADD flexdrive / 9 | ADD pkg/app/admin/view /pkg/app/admin/view 10 | ADD pkg/app/customer/view /pkg/app/customer/view 11 | ADD static / 12 | 13 | ADD /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 14 | 15 | CMD ["/flexdrive"] 16 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/bordered-pulled.less: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em @fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .pull-right { float: right; } 11 | .pull-left { float: left; } 12 | 13 | .@{fa-css-prefix} { 14 | &.pull-left { margin-right: .3em; } 15 | &.pull-right { margin-left: .3em; } 16 | } 17 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/nav-vertical-align.less: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | .navbar-vertical-align(@element-height) { 7 | margin-top: ((@navbar-height - @element-height) / 2); 8 | margin-bottom: ((@navbar-height - @element-height) / 2); 9 | } 10 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_bordered-pulled.scss: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em $fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .pull-right { float: right; } 11 | .pull-left { float: left; } 12 | 13 | .#{$fa-css-prefix} { 14 | &.pull-left { margin-right: .3em; } 15 | &.pull-right { margin-left: .3em; } 16 | } 17 | -------------------------------------------------------------------------------- /static/bower/jquery/src/css/var/isHidden.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../../core", 3 | "../../selector" 4 | // css is assumed 5 | ], function( jQuery ) { 6 | 7 | return function( elem, el ) { 8 | // isHidden might be called from jQuery#filter function; 9 | // in that case, element will be second argument 10 | elem = el || elem; 11 | return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); 12 | }; 13 | }); 14 | -------------------------------------------------------------------------------- /deploy/README.md: -------------------------------------------------------------------------------- 1 | 2 | the dir `flexdrivecode` is generated by xorm tools. 3 | 4 | u can execute this below: 5 | ``` 6 | go get github.com/go-xorm/cmd/xorm 7 | $GOPATH/src/github.com/go-xorm/cmd/xorm/xorm reverse mysql "user1:yourpass@tcp(127.0.0.1:3306)/flexdrive" flexdrivetpl/ flexdrivecode/ 8 | ``` 9 | 10 | before you execute it, u must make sure the tables are already created in the db. 11 | after you executed that, u might mv codes to the dao dir. 12 | 13 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/larger.less: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .@{fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .@{fa-css-prefix}-2x { font-size: 2em; } 11 | .@{fa-css-prefix}-3x { font-size: 3em; } 12 | .@{fa-css-prefix}-4x { font-size: 4em; } 13 | .@{fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /static/bower/bootstrap/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Bootstrap uses [GitHub's Releases feature](https://github.com/blog/1547-release-your-software) for its changelogs. 2 | 3 | See [the Releases section of our GitHub project](https://github.com/twbs/bootstrap/releases) for changelogs for each release version of Bootstrap. 4 | 5 | Release announcement posts on [the official Bootstrap blog](http://blog.getbootstrap.com) contain summaries of the most noteworthy changes made in each release. 6 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_larger.scss: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .#{$fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .#{$fa-css-prefix}-2x { font-size: 2em; } 11 | .#{$fa-css-prefix}-3x { font-size: 3em; } 12 | .#{$fa-css-prefix}-4x { font-size: 4em; } 13 | .#{$fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/responsive-visibility.less: -------------------------------------------------------------------------------- 1 | // Responsive utilities 2 | 3 | // 4 | // More easily include all the states for responsive-utilities.less. 5 | .responsive-visibility() { 6 | display: block !important; 7 | table& { display: table !important; } 8 | tr& { display: table-row !important; } 9 | th&, 10 | td& { display: table-cell !important; } 11 | } 12 | 13 | .responsive-invisibility() { 14 | display: none !important; 15 | } 16 | -------------------------------------------------------------------------------- /static/bower/fontawesome/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | *.db 4 | *.db.old 5 | *.swp 6 | *.db-journal 7 | 8 | .coverage 9 | .DS_Store 10 | .installed.cfg 11 | _gh_pages/* 12 | 13 | .idea/* 14 | .svn/* 15 | src/website/static/* 16 | src/website/media/* 17 | 18 | bin 19 | cfcache 20 | develop-eggs 21 | dist 22 | downloads 23 | eggs 24 | parts 25 | tmp 26 | .sass-cache 27 | node_modules 28 | 29 | src/website/settingslocal.py 30 | stunnel.log 31 | 32 | .ruby-version 33 | -------------------------------------------------------------------------------- /pkg/utils/other.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "fmt" 5 | ) 6 | 7 | func SizeToHuman(space int64) string { 8 | if space < 1024 { 9 | return fmt.Sprintf("%d kB", space) 10 | } 11 | if space < 1024*1024 { 12 | return fmt.Sprintf("%.01f MB", float32(space)/1024) 13 | } 14 | if space < 1024*1024*1024 { 15 | return fmt.Sprintf("%.01f GB", float32(space)/1024/1024) 16 | } 17 | return fmt.Sprintf("%.02f TB", float32(space)/1024/1024/1024) 18 | } 19 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/core.less: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/list.less: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: @fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .@{fa-css-prefix}-li { 11 | position: absolute; 12 | left: -@fa-li-width; 13 | width: @fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.@{fa-css-prefix}-lg { 17 | left: (-@fa-li-width + (4em / 14)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /static/bower/jquery/src/css/hiddenVisibleSelectors.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../selector" 4 | ], function( jQuery ) { 5 | 6 | jQuery.expr.filters.hidden = function( elem ) { 7 | // Support: Opera <= 12.12 8 | // Opera reports offsetWidths and offsetHeights less than zero on some elements 9 | return elem.offsetWidth <= 0 && elem.offsetHeight <= 0; 10 | }; 11 | jQuery.expr.filters.visible = function( elem ) { 12 | return !jQuery.expr.filters.hidden( elem ); 13 | }; 14 | 15 | }); 16 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_core.scss: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_list.scss: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: $fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .#{$fa-css-prefix}-li { 11 | position: absolute; 12 | left: -$fa-li-width; 13 | width: $fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.#{$fa-css-prefix}-lg { 17 | left: -$fa-li-width + (4em / 14); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /static/bower/jquery/src/css/var/getStyles.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | return function( elem ) { 3 | // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 4 | // IE throws on elements created in popups 5 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6 | if ( elem.ownerDocument.defaultView.opener ) { 7 | return elem.ownerDocument.defaultView.getComputedStyle( elem, null ); 8 | } 9 | 10 | return window.getComputedStyle( elem, null ); 11 | }; 12 | }); 13 | -------------------------------------------------------------------------------- /static/bower/jquery/src/data/accepts.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | /** 6 | * Determines whether an object can have data 7 | */ 8 | jQuery.acceptData = function( owner ) { 9 | // Accepts only: 10 | // - Node 11 | // - Node.ELEMENT_NODE 12 | // - Node.DOCUMENT_NODE 13 | // - Object 14 | // - Any 15 | /* jshint -W018 */ 16 | return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 17 | }; 18 | 19 | return jQuery.acceptData; 20 | }); 21 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/font-awesome.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables"; 7 | @import "mixins"; 8 | @import "path"; 9 | @import "core"; 10 | @import "larger"; 11 | @import "fixed-width"; 12 | @import "list"; 13 | @import "bordered-pulled"; 14 | @import "spinning"; 15 | @import "rotated-flipped"; 16 | @import "stacked"; 17 | @import "icons"; 18 | -------------------------------------------------------------------------------- /static/bower/bootstrap/nuget/MyGet.ps1: -------------------------------------------------------------------------------- 1 | $nuget = $env:NuGet 2 | 3 | # parse the version number out of package.json 4 | $bsversion = ((Get-Content $env:SourcesPath\package.json) -join "`n" | ConvertFrom-Json).version 5 | 6 | # create packages 7 | & $nuget pack "nuget\bootstrap.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath $env:SourcesPath -Version $bsversion 8 | & $nuget pack "nuget\bootstrap.less.nuspec" -Verbosity detailed -NonInteractive -NoPackageAnalysis -BasePath $env:SourcesPath -Version $bsversion 9 | -------------------------------------------------------------------------------- /static/bower/fontawesome/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "font-awesome", 3 | "description": "Font Awesome", 4 | "version": "4.2.0", 5 | "keywords": [], 6 | "homepage": "http://fontawesome.io", 7 | "dependencies": {}, 8 | "devDependencies": {}, 9 | "license": ["OFL-1.1", "MIT", "CC-BY-3.0"], 10 | "main": [ 11 | "./css/font-awesome.css", 12 | "./fonts/*" 13 | ], 14 | "ignore": [ 15 | "*/.*", 16 | "*.json", 17 | "src", 18 | "*.yml", 19 | "Gemfile", 20 | "Gemfile.lock", 21 | "*.md" 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /static/bower/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /static/bower/bootstrap/less/.csslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "adjoining-classes": false, 3 | "box-sizing": false, 4 | "box-model": false, 5 | "compatible-vendor-prefixes": false, 6 | "floats": false, 7 | "font-sizes": false, 8 | "gradients": false, 9 | "important": false, 10 | "known-properties": false, 11 | "outline-none": false, 12 | "qualified-headings": false, 13 | "regex-selectors": false, 14 | "shorthand": false, 15 | "text-indent": false, 16 | "unique-headings": false, 17 | "universal-selector": false, 18 | "unqualified-attributes": false 19 | } 20 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/font-awesome.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables.less"; 7 | @import "mixins.less"; 8 | @import "path.less"; 9 | @import "core.less"; 10 | @import "larger.less"; 11 | @import "fixed-width.less"; 12 | @import "list.less"; 13 | @import "bordered-pulled.less"; 14 | @import "spinning.less"; 15 | @import "rotated-flipped.less"; 16 | @import "stacked.less"; 17 | @import "icons.less"; 18 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/border-radius.less: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | .border-top-radius(@radius) { 4 | border-top-right-radius: @radius; 5 | border-top-left-radius: @radius; 6 | } 7 | .border-right-radius(@radius) { 8 | border-bottom-right-radius: @radius; 9 | border-top-right-radius: @radius; 10 | } 11 | .border-bottom-radius(@radius) { 12 | border-bottom-right-radius: @radius; 13 | border-bottom-left-radius: @radius; 14 | } 15 | .border-left-radius(@radius) { 16 | border-bottom-left-radius: @radius; 17 | border-top-left-radius: @radius; 18 | } 19 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/reset-text.less: -------------------------------------------------------------------------------- 1 | .reset-text() { 2 | font-family: @font-family-base; 3 | // We deliberately do NOT reset font-size. 4 | font-style: normal; 5 | font-weight: normal; 6 | letter-spacing: normal; 7 | line-break: auto; 8 | line-height: @line-height-base; 9 | text-align: left; // Fallback for where `start` is not supported 10 | text-align: start; 11 | text-decoration: none; 12 | text-shadow: none; 13 | text-transform: none; 14 | white-space: normal; 15 | word-break: normal; 16 | word-spacing: normal; 17 | word-wrap: normal; 18 | } 19 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/stacked.less: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .@{fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .@{fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .@{fa-css-prefix}-inverse { color: @fa-inverse; } 21 | -------------------------------------------------------------------------------- /static/bower/jquery/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "2.1.4", 4 | "main": "dist/jquery.js", 5 | "license": "MIT", 6 | "ignore": [ 7 | "**/.*", 8 | "build", 9 | "dist/cdn", 10 | "speed", 11 | "test", 12 | "*.md", 13 | "AUTHORS.txt", 14 | "Gruntfile.js", 15 | "package.json" 16 | ], 17 | "devDependencies": { 18 | "sizzle": "2.1.1-jquery.2.1.2", 19 | "requirejs": "2.1.10", 20 | "qunit": "1.14.0", 21 | "sinon": "1.8.1" 22 | }, 23 | "keywords": [ 24 | "jquery", 25 | "javascript", 26 | "library" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_stacked.scss: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .#{$fa-css-prefix}-stack-1x, .#{$fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .#{$fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .#{$fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .#{$fa-css-prefix}-inverse { color: $fa-inverse; } 21 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/pagination.less: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) { 4 | > li { 5 | > a, 6 | > span { 7 | padding: @padding-vertical @padding-horizontal; 8 | font-size: @font-size; 9 | line-height: @line-height; 10 | } 11 | &:first-child { 12 | > a, 13 | > span { 14 | .border-left-radius(@border-radius); 15 | } 16 | } 17 | &:last-child { 18 | > a, 19 | > span { 20 | .border-right-radius(@border-radius); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /static/bower/jquery/src/css/addGetHookIf.js: -------------------------------------------------------------------------------- 1 | define(function() { 2 | 3 | function addGetHookIf( conditionFn, hookFn ) { 4 | // Define the hook, we'll check on the first run if it's really needed. 5 | return { 6 | get: function() { 7 | if ( conditionFn() ) { 8 | // Hook not needed (or it's not possible to use it due 9 | // to missing dependency), remove it. 10 | delete this.get; 11 | return; 12 | } 13 | 14 | // Hook needed; redefine it so that the support test is not executed again. 15 | return (this.get = hookFn).apply( this, arguments ); 16 | } 17 | }; 18 | } 19 | 20 | return addGetHookIf; 21 | 22 | }); 23 | -------------------------------------------------------------------------------- /static/bower/jquery/src/ajax/parseXML.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Cross-browser xml parsing 6 | jQuery.parseXML = function( data ) { 7 | var xml, tmp; 8 | if ( !data || typeof data !== "string" ) { 9 | return null; 10 | } 11 | 12 | // Support: IE9 13 | try { 14 | tmp = new DOMParser(); 15 | xml = tmp.parseFromString( data, "text/xml" ); 16 | } catch ( e ) { 17 | xml = undefined; 18 | } 19 | 20 | if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 21 | jQuery.error( "Invalid XML: " + data ); 22 | } 23 | return xml; 24 | }; 25 | 26 | return jQuery.parseXML; 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /static/bower/fontawesome/.npmignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | *.db 4 | *.db.old 5 | *.swp 6 | *.db-journal 7 | 8 | .coverage 9 | .DS_Store 10 | .installed.cfg 11 | _gh_pages/* 12 | 13 | .idea/* 14 | .svn/* 15 | src/website/static/* 16 | src/website/media/* 17 | 18 | bin 19 | cfcache 20 | develop-eggs 21 | dist 22 | downloads 23 | eggs 24 | parts 25 | tmp 26 | .sass-cache 27 | node_modules 28 | 29 | src/website/settingslocal.py 30 | stunnel.log 31 | 32 | .ruby-version 33 | 34 | # don't need these in the npm package. 35 | src/ 36 | _config.yml 37 | bower.json 38 | component.json 39 | composer.json 40 | CONTRIBUTING.md 41 | Gemfile 42 | Gemfile.lock 43 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/panels.less: -------------------------------------------------------------------------------- 1 | // Panels 2 | 3 | .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) { 4 | border-color: @border; 5 | 6 | & > .panel-heading { 7 | color: @heading-text-color; 8 | background-color: @heading-bg-color; 9 | border-color: @heading-border; 10 | 11 | + .panel-collapse > .panel-body { 12 | border-top-color: @border; 13 | } 14 | .badge { 15 | color: @heading-bg-color; 16 | background-color: @heading-text-color; 17 | } 18 | } 19 | & > .panel-footer { 20 | + .panel-collapse > .panel-body { 21 | border-bottom-color: @border; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/wells.less: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: @well-bg; 12 | border: 1px solid @well-border; 13 | border-radius: @border-radius-base; 14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-lg { 23 | padding: 24px; 24 | border-radius: @border-radius-large; 25 | } 26 | .well-sm { 27 | padding: 9px; 28 | border-radius: @border-radius-small; 29 | } 30 | -------------------------------------------------------------------------------- /static/bower/jquery/src/queue/delay.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../queue", 4 | "../effects" // Delay is optional because of this dependency 5 | ], function( jQuery ) { 6 | 7 | // Based off of the plugin by Clint Helfers, with permission. 8 | // http://blindsignals.com/index.php/2009/07/jquery-delay/ 9 | jQuery.fn.delay = function( time, type ) { 10 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 11 | type = type || "fx"; 12 | 13 | return this.queue( type, function( next, hooks ) { 14 | var timeout = setTimeout( next, time ); 15 | hooks.stop = function() { 16 | clearTimeout( timeout ); 17 | }; 18 | }); 19 | }; 20 | 21 | return jQuery.fn.delay; 22 | }); 23 | -------------------------------------------------------------------------------- /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a golang project 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go 3 | 4 | name: Go 5 | 6 | on: 7 | push: 8 | branches: [ "master" ] 9 | pull_request: 10 | branches: [ "master" ] 11 | 12 | jobs: 13 | 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Set up Go 20 | uses: actions/setup-go@v4 21 | with: 22 | go-version: '1.23' 23 | 24 | - name: Build 25 | run: go build -v cmd/node/main.go 26 | 27 | - name: Test 28 | run: echo should run go test -v ./... 29 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/hide-text.less: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | // 3 | // Heads up! v3 launched with only `.hide-text()`, but per our pattern for 4 | // mixins being reused as classes with the same name, this doesn't hold up. As 5 | // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. 6 | // 7 | // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 8 | 9 | // Deprecated as of v3.0.1 (has been removed in v4) 10 | .hide-text() { 11 | font: ~"0/0" a; 12 | color: transparent; 13 | text-shadow: none; 14 | background-color: transparent; 15 | border: 0; 16 | } 17 | 18 | // New mixin to use as of v3.0.1 19 | .text-hide() { 20 | .hide-text(); 21 | } 22 | -------------------------------------------------------------------------------- /static/bower/jquery/src/css/swap.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // A method for quickly swapping in/out CSS properties to get correct calculations. 6 | jQuery.swap = function( elem, options, callback, args ) { 7 | var ret, name, 8 | old = {}; 9 | 10 | // Remember the old values, and insert the new ones 11 | for ( name in options ) { 12 | old[ name ] = elem.style[ name ]; 13 | elem.style[ name ] = options[ name ]; 14 | } 15 | 16 | ret = callback.apply( elem, args || [] ); 17 | 18 | // Revert the old values 19 | for ( name in options ) { 20 | elem.style[ name ] = old[ name ]; 21 | } 22 | 23 | return ret; 24 | }; 25 | 26 | return jQuery.swap; 27 | 28 | }); 29 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/list-group.less: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | .list-group-item-variant(@state; @background; @color) { 4 | .list-group-item-@{state} { 5 | color: @color; 6 | background-color: @background; 7 | 8 | a&, 9 | button& { 10 | color: @color; 11 | 12 | .list-group-item-heading { 13 | color: inherit; 14 | } 15 | 16 | &:hover, 17 | &:focus { 18 | color: @color; 19 | background-color: darken(@background, 5%); 20 | } 21 | &.active, 22 | &.active:hover, 23 | &.active:focus { 24 | color: #fff; 25 | background-color: @color; 26 | border-color: @color; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /runcluster-mysql.sh: -------------------------------------------------------------------------------- 1 | export DATADSN='mysql://flexdrive:flexdrive@tcp(127.0.0.1:13306)/flexdrive?charset=utf8mb4&parseTime=True&loc=Local' 2 | export CLUSTERMEMBERS=127.0.0.1:10013,127.0.0.1:10023,127.0.0.1:10033 3 | export STORAGEDIR=./data/ 4 | export CLUSTERID=mydrive1 5 | SERVEAPI=0.0.0.0:10010 SERVEADMIN=0.0.0.0:10011 SERVECUSTOMER=0.0.0.0:10012 SERVECLUSTER=127.0.0.1:10013 ./flexdrive > 1.log 2>&1 & 6 | SERVEAPI=0.0.0.0:10020 SERVEADMIN=0.0.0.0:10021 SERVECUSTOMER=0.0.0.0:10022 SERVECLUSTER=127.0.0.1:10023 ./flexdrive > 2.log 2>&1 & 7 | SERVEAPI=0.0.0.0:10030 SERVEADMIN=0.0.0.0:10031 SERVECUSTOMER=0.0.0.0:10032 SERVECLUSTER=127.0.0.1:10033 ./flexdrive > 3.log 2>&1 & 8 | 9 | echo cluster started 10 | ps aux | grep flexdrive 11 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/clearfix.less: -------------------------------------------------------------------------------- 1 | // Clearfix 2 | // 3 | // For modern browsers 4 | // 1. The space content is one way to avoid an Opera bug when the 5 | // contenteditable attribute is included anywhere else in the document. 6 | // Otherwise it causes space to appear at the top and bottom of elements 7 | // that are clearfixed. 8 | // 2. The use of `table` rather than `block` is only necessary if using 9 | // `:before` to contain the top-margins of child elements. 10 | // 11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/ 12 | 13 | .clearfix() { 14 | &:before, 15 | &:after { 16 | content: " "; // 1 17 | display: table; // 2 18 | } 19 | &:after { 20 | clear: both; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/breadcrumbs.less: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal; 8 | margin-bottom: @line-height-computed; 9 | list-style: none; 10 | background-color: @breadcrumb-bg; 11 | border-radius: @border-radius-base; 12 | 13 | > li { 14 | display: inline-block; 15 | 16 | + li:before { 17 | content: "@{breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space 18 | padding: 0 5px; 19 | color: @breadcrumb-color; 20 | } 21 | } 22 | 23 | > .active { 24 | color: @breadcrumb-active-color; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/responsive-embed.less: -------------------------------------------------------------------------------- 1 | // Embeds responsive 2 | // 3 | // Credit: Nicolas Gallagher and SUIT CSS. 4 | 5 | .embed-responsive { 6 | position: relative; 7 | display: block; 8 | height: 0; 9 | padding: 0; 10 | overflow: hidden; 11 | 12 | .embed-responsive-item, 13 | iframe, 14 | embed, 15 | object, 16 | video { 17 | position: absolute; 18 | top: 0; 19 | left: 0; 20 | bottom: 0; 21 | height: 100%; 22 | width: 100%; 23 | border: 0; 24 | } 25 | } 26 | 27 | // Modifier class for 16:9 aspect ratio 28 | .embed-responsive-16by9 { 29 | padding-bottom: 56.25%; 30 | } 31 | 32 | // Modifier class for 4:3 aspect ratio 33 | .embed-responsive-4by3 { 34 | padding-bottom: 75%; 35 | } 36 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/rotated-flipped.less: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); } 5 | .@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); } 6 | .@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); } 7 | 8 | .@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); } 9 | .@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .@{fa-css-prefix}-rotate-90, 15 | :root .@{fa-css-prefix}-rotate-180, 16 | :root .@{fa-css-prefix}-rotate-270, 17 | :root .@{fa-css-prefix}-flip-horizontal, 18 | :root .@{fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/spinning.less: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .@{fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | @-webkit-keyframes fa-spin { 10 | 0% { 11 | -webkit-transform: rotate(0deg); 12 | transform: rotate(0deg); 13 | } 14 | 100% { 15 | -webkit-transform: rotate(359deg); 16 | transform: rotate(359deg); 17 | } 18 | } 19 | 20 | @keyframes fa-spin { 21 | 0% { 22 | -webkit-transform: rotate(0deg); 23 | transform: rotate(0deg); 24 | } 25 | 100% { 26 | -webkit-transform: rotate(359deg); 27 | transform: rotate(359deg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_spinning.scss: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .#{$fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | @-webkit-keyframes fa-spin { 10 | 0% { 11 | -webkit-transform: rotate(0deg); 12 | transform: rotate(0deg); 13 | } 14 | 100% { 15 | -webkit-transform: rotate(359deg); 16 | transform: rotate(359deg); 17 | } 18 | } 19 | 20 | @keyframes fa-spin { 21 | 0% { 22 | -webkit-transform: rotate(0deg); 23 | transform: rotate(0deg); 24 | } 25 | 100% { 26 | -webkit-transform: rotate(359deg); 27 | transform: rotate(359deg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /static/bower/jquery/src/jquery.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "./core", 3 | "./selector", 4 | "./traversing", 5 | "./callbacks", 6 | "./deferred", 7 | "./core/ready", 8 | "./data", 9 | "./queue", 10 | "./queue/delay", 11 | "./attributes", 12 | "./event", 13 | "./event/alias", 14 | "./manipulation", 15 | "./manipulation/_evalUrl", 16 | "./wrap", 17 | "./css", 18 | "./css/hiddenVisibleSelectors", 19 | "./serialize", 20 | "./ajax", 21 | "./ajax/xhr", 22 | "./ajax/script", 23 | "./ajax/jsonp", 24 | "./ajax/load", 25 | "./event/ajax", 26 | "./effects", 27 | "./effects/animatedSelector", 28 | "./offset", 29 | "./dimensions", 30 | "./deprecated", 31 | "./exports/amd", 32 | "./exports/global" 33 | ], function( jQuery ) { 34 | 35 | return jQuery; 36 | 37 | }); 38 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/path.less: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}'); 7 | src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'), 8 | url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'), 9 | url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'), 10 | url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg'); 11 | // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 12 | font-weight: normal; 13 | font-style: normal; 14 | } 15 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_path.scss: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}'); 7 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), 8 | url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'), 9 | url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'), 10 | url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg'); 11 | //src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 12 | font-weight: normal; 13 | font-style: normal; 14 | } 15 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_rotated-flipped.scss: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); } 5 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); } 6 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); } 7 | 8 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); } 9 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .#{$fa-css-prefix}-rotate-90, 15 | :root .#{$fa-css-prefix}-rotate-180, 16 | :root .#{$fa-css-prefix}-rotate-270, 17 | :root .#{$fa-css-prefix}-flip-horizontal, 18 | :root .#{$fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /pkg/utils/randomstr.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "math/rand" 5 | ) 6 | 7 | const encodeStd = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" 8 | const encodeURL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" 9 | 10 | /** 11 | @param dataLen: 数据长度,base64膨胀率1.33,返回的string长度是dataLen的1.33倍 12 | */ 13 | func NewRandomBase64(strLen int) string { 14 | ba := make([]byte, strLen) 15 | for i := 0; i < strLen; i++ { 16 | ba[i] = encodeURL[rand.Int()%len(encodeURL)] 17 | } 18 | 19 | return string(ba) 20 | } 21 | 22 | func NewRandomHex(strLen int) string { 23 | ba := make([]byte, strLen) 24 | baseStr := []byte("0123456789abcdef") 25 | for i := 0; i < strLen; i++ { 26 | ba[i] = baseStr[rand.Int()%len(baseStr)] 27 | } 28 | 29 | return string(ba) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/utils/time.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | const ( 8 | DefaultTimeFmt = "2006-01-02 15:04:05" 9 | StdZeroTimeStr = "0001-01-01 00:00:00" // 标准库里time.Time{} jsonMashal以后的字符串 10 | ZeroTimeStr = "1999-12-31 00:00:00" // 我们自己期望使用的时间 "0" 值字符串 11 | ) 12 | 13 | // time.Time 转字符串 14 | func TimeToString(t time.Time) string { 15 | return t.Format(DefaultTimeFmt) 16 | } 17 | 18 | // 字符串转 time.Time 19 | func StringToTime(str string) time.Time { 20 | local, err := time.LoadLocation("Local") 21 | if err != nil { 22 | panic(err) 23 | } 24 | t, err := time.ParseInLocation(DefaultTimeFmt, str, local) 25 | if err != nil { 26 | panic(err) 27 | } 28 | return t 29 | } 30 | 31 | // 判断当前时间是不是"0"值 32 | func IsEmptyTime(t time.Time) bool { 33 | return t == time.Time{} 34 | } 35 | -------------------------------------------------------------------------------- /static/bower/jquery/src/exports/global.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../var/strundefined" 4 | ], function( jQuery, strundefined ) { 5 | 6 | var 7 | // Map over jQuery in case of overwrite 8 | _jQuery = window.jQuery, 9 | 10 | // Map over the $ in case of overwrite 11 | _$ = window.$; 12 | 13 | jQuery.noConflict = function( deep ) { 14 | if ( window.$ === jQuery ) { 15 | window.$ = _$; 16 | } 17 | 18 | if ( deep && window.jQuery === jQuery ) { 19 | window.jQuery = _jQuery; 20 | } 21 | 22 | return jQuery; 23 | }; 24 | 25 | // Expose jQuery and $ identifiers, even in AMD 26 | // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 27 | // and CommonJS for browser emulators (#13566) 28 | if ( typeof noGlobal === strundefined ) { 29 | window.jQuery = window.$ = jQuery; 30 | } 31 | 32 | }); 33 | -------------------------------------------------------------------------------- /static/bower/bootstrap/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "http://getbootstrap.com", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 3" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/component-animations.less: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | // Heads up! 6 | // 7 | // We don't use the `.opacity()` mixin here since it causes a bug with text 8 | // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552. 9 | 10 | .fade { 11 | opacity: 0; 12 | .transition(opacity .15s linear); 13 | &.in { 14 | opacity: 1; 15 | } 16 | } 17 | 18 | .collapse { 19 | display: none; 20 | 21 | &.in { display: block; } 22 | tr&.in { display: table-row; } 23 | tbody&.in { display: table-row-group; } 24 | } 25 | 26 | .collapsing { 27 | position: relative; 28 | height: 0; 29 | overflow: hidden; 30 | .transition-property(~"height, visibility"); 31 | .transition-duration(.35s); 32 | .transition-timing-function(ease); 33 | } 34 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/table-row.less: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | .table-row-variant(@state; @background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table > thead > tr, 7 | .table > tbody > tr, 8 | .table > tfoot > tr { 9 | > td.@{state}, 10 | > th.@{state}, 11 | &.@{state} > td, 12 | &.@{state} > th { 13 | background-color: @background; 14 | } 15 | } 16 | 17 | // Hover states for `.table-hover` 18 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 19 | .table-hover > tbody > tr { 20 | > td.@{state}:hover, 21 | > th.@{state}:hover, 22 | &.@{state}:hover > td, 23 | &:hover > .@{state}, 24 | &.@{state}:hover > th { 25 | background-color: darken(@background, 5%); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /deploy/codegen/flexdrivecode/role.go: -------------------------------------------------------------------------------- 1 | package flexdrivecode 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type Role struct { 10 | Id int `xorm:"not null pk autoincr comment('角色id') INT(10)"` 11 | Name string `xorm:"not null default '' comment('角色名称') VARCHAR(32)"` 12 | Status int `xorm:"not null default 1 comment('状态 1=正常启用 99=删除') TINYINT(4)"` 13 | Created time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('创建时间') TIMESTAMP"` 14 | Updated time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 15 | Permit string `xorm:"not null comment('授权内容 json') TEXT"` 16 | } 17 | 18 | func (t Role) TableName() string { 19 | return "role" 20 | } 21 | 22 | func (t *Role) GetById(int id) error { 23 | _, err := base.GetByCol("id", id, t) 24 | return err 25 | } 26 | -------------------------------------------------------------------------------- /pkg/app/admin/view/common/head.tpl: -------------------------------------------------------------------------------- 1 | {{define "common/head.tpl"}} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{.appname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {{end}} 20 | -------------------------------------------------------------------------------- /static/bower/fontawesome/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "font-awesome", 3 | "description": "Font Awesome", 4 | "version": "4.2.0", 5 | "keywords": [], 6 | "homepage": "http://fontawesome.io", 7 | "dependencies": {}, 8 | "devDependencies": {}, 9 | "license": [ 10 | "OFL-1.1", 11 | "MIT", 12 | "CC-BY-3.0" 13 | ], 14 | "main": [ 15 | "./css/font-awesome.css", 16 | "./fonts/*" 17 | ], 18 | "ignore": [ 19 | "*/.*", 20 | "*.json", 21 | "src", 22 | "*.yml", 23 | "Gemfile", 24 | "Gemfile.lock", 25 | "*.md" 26 | ], 27 | "_release": "4.2.0", 28 | "_resolution": { 29 | "type": "version", 30 | "tag": "v4.2.0", 31 | "commit": "0b924144a95a54fa738d0450ff66c1dabd11ae74" 32 | }, 33 | "_source": "https://github.com/FortAwesome/Font-Awesome.git", 34 | "_target": "~4.2.0", 35 | "_originalSource": "fontawesome" 36 | } -------------------------------------------------------------------------------- /pkg/app/customer/view/common/head.tpl: -------------------------------------------------------------------------------- 1 | {{define "common/head.tpl"}} 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{.appname}} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | {{end}} 20 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/close.less: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: (@font-size-base * 1.5); 9 | font-weight: @close-font-weight; 10 | line-height: 1; 11 | color: @close-color; 12 | text-shadow: @close-text-shadow; 13 | .opacity(.2); 14 | 15 | &:hover, 16 | &:focus { 17 | color: @close-color; 18 | text-decoration: none; 19 | cursor: pointer; 20 | .opacity(.5); 21 | } 22 | 23 | // Additional properties for button version 24 | // iOS requires the button element instead of an anchor tag. 25 | // If you want the anchor version, it requires `href="#"`. 26 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 27 | button& { 28 | padding: 0; 29 | cursor: pointer; 30 | background: transparent; 31 | border: 0; 32 | -webkit-appearance: none; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/thumbnails.less: -------------------------------------------------------------------------------- 1 | // 2 | // Thumbnails 3 | // -------------------------------------------------- 4 | 5 | 6 | // Mixin and adjust the regular image class 7 | .thumbnail { 8 | display: block; 9 | padding: @thumbnail-padding; 10 | margin-bottom: @line-height-computed; 11 | line-height: @line-height-base; 12 | background-color: @thumbnail-bg; 13 | border: 1px solid @thumbnail-border; 14 | border-radius: @thumbnail-border-radius; 15 | .transition(border .2s ease-in-out); 16 | 17 | > img, 18 | a > img { 19 | &:extend(.img-responsive); 20 | margin-left: auto; 21 | margin-right: auto; 22 | } 23 | 24 | // Add a hover state for linked versions only 25 | a&:hover, 26 | a&:focus, 27 | a&.active { 28 | border-color: @link-color; 29 | } 30 | 31 | // Image captions 32 | .caption { 33 | padding: @thumbnail-caption-padding; 34 | color: @thumbnail-caption-color; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /static/bower/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "version": "2.1.4", 4 | "main": "dist/jquery.js", 5 | "license": "MIT", 6 | "ignore": [ 7 | "**/.*", 8 | "build", 9 | "dist/cdn", 10 | "speed", 11 | "test", 12 | "*.md", 13 | "AUTHORS.txt", 14 | "Gruntfile.js", 15 | "package.json" 16 | ], 17 | "devDependencies": { 18 | "sizzle": "2.1.1-jquery.2.1.2", 19 | "requirejs": "2.1.10", 20 | "qunit": "1.14.0", 21 | "sinon": "1.8.1" 22 | }, 23 | "keywords": [ 24 | "jquery", 25 | "javascript", 26 | "library" 27 | ], 28 | "homepage": "https://github.com/jquery/jquery-dist", 29 | "_release": "2.1.4", 30 | "_resolution": { 31 | "type": "version", 32 | "tag": "2.1.4", 33 | "commit": "7751e69b615c6eca6f783a81e292a55725af6b85" 34 | }, 35 | "_source": "https://github.com/jquery/jquery-dist.git", 36 | "_target": "~2.1.1", 37 | "_originalSource": "jquery" 38 | } -------------------------------------------------------------------------------- /runcluster.sh: -------------------------------------------------------------------------------- 1 | #go build -o flexdrive cmd/node/main.go 2 | SERVEAPI=0.0.0.0:10010 SERVEADMIN=0.0.0.0:10011 SERVECUSTOMER=0.0.0.0:10012 SERVECLUSTER=0.0.0.0:10013 CLUSTERMEMBERS=127.0.0.1:10013,127.0.0.1:10023,127.0.0.1:10033 DATADSN='sqlite3://./flexdrive.db' STORAGEDIR=./data/ ./flexdrive > 1.log 2>&1 & 3 | SERVEAPI=0.0.0.0:10020 SERVEADMIN=0.0.0.0:10021 SERVECUSTOMER=0.0.0.0:10022 SERVECLUSTER=0.0.0.0:10023 CLUSTERMEMBERS=127.0.0.1:10013,127.0.0.1:10023,127.0.0.1:10033 DATADSN='sqlite3://./flexdrive.db' STORAGEDIR=./data/ ./flexdrive > 2.log 2>&1 & 4 | SERVEAPI=0.0.0.0:10030 SERVEADMIN=0.0.0.0:10031 SERVECUSTOMER=0.0.0.0:10032 SERVECLUSTER=0.0.0.0:10033 CLUSTERMEMBERS=127.0.0.1:10013,127.0.0.1:10023,127.0.0.1:10033 DATADSN='sqlite3://./flexdrive.db' STORAGEDIR=./data/ ./flexdrive > 3.log 2>&1 & 5 | 6 | sleep 1 7 | ps aux | grep flexdrive | grep -v grep 8 | echo Visit admin: http://127.0.0.1:10011/adm 9 | echo Visit customer: http://127.0.0.1:10012/ 10 | -------------------------------------------------------------------------------- /pkg/app/customer/apihandler/myprofile.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "github.com/uxff/flexdrive/pkg/dao" 6 | "github.com/uxff/flexdrive/pkg/log" 7 | ) 8 | 9 | func init() { 10 | } 11 | 12 | func Profile(c *gin.Context) { 13 | requestId := c.GetString(CtxKeyRequestId) 14 | 15 | loginInfo := getLoginInfo(c) 16 | levelInfo, err := dao.GetUserLevelById(loginInfo.UserEnt.LevelId) 17 | if err != nil { 18 | log.Trace(requestId).Errorf("query level error:%v", err) 19 | JsonErrMsg(c, ErrInvalidParam, "查询等级错误") 20 | return 21 | } 22 | 23 | if levelInfo == nil { 24 | levelInfo, err = dao.GetDefaultUserLevel() 25 | if err != nil { 26 | log.Trace(requestId).Errorf("query level error:%v", err) 27 | JsonErrMsg(c, ErrInvalidParam, "查询等级错误") 28 | return 29 | } 30 | } 31 | 32 | if levelInfo == nil { 33 | JsonErrMsg(c, ErrInvalidParam, "无默认等级") 34 | return 35 | } 36 | 37 | JsonOk(c, levelInfo) 38 | } 39 | -------------------------------------------------------------------------------- /pkg/app/admin/view/common/error.tpl: -------------------------------------------------------------------------------- 1 | {{ define "common/error.tpl" }} 2 | 3 | {{template "common/head.tpl" .}} 4 | {{template "common/partheader.tpl" .}} 5 | 6 |
7 |
8 |
9 |
10 |
11 |

温馨提示

12 |
13 | 14 |
15 |

16 | {{.errMsg}}   17 | 返回   18 | {{if not .IsLogin}} 19 | 登录 20 | {{end}} 21 |

22 |
23 | 24 |
25 |
26 |
27 |
28 | {{template "common/partfooter.tpl"}} 29 | {{template "common/foot.tpl"}} 30 | 31 | {{ end }} -------------------------------------------------------------------------------- /pkg/app/customer/view/common/error.tpl: -------------------------------------------------------------------------------- 1 | {{ define "common/error.tpl" }} 2 | 3 | {{template "common/head.tpl" .}} 4 | {{template "common/partheader.tpl" .}} 5 | 6 |
7 |
8 |
9 |
10 |
11 |

温馨提示

12 |
13 | 14 |
15 |

16 | {{.errMsg}}   17 | 返回   18 | {{if not .IsLogin}} 19 | 登录 20 | {{end}} 21 |

22 |
23 | 24 |
25 |
26 |
27 |
28 | {{template "common/partfooter.tpl"}} 29 | {{template "common/foot.tpl"}} 30 | 31 | {{ end }} -------------------------------------------------------------------------------- /deploy/codegen/flexdrivetpl/struct.go.tpl: -------------------------------------------------------------------------------- 1 | package {{.Models}} 2 | 3 | {{$ilen := len .Imports}} 4 | {{if gt $ilen 0}} 5 | import ( 6 | {{range .Imports}}"{{.}}"{{end}} 7 | "github.com/uxff/flexdrive/pkg/dao/base" 8 | ) 9 | {{end}} 10 | 11 | {{range .Tables}} 12 | type {{Mapper .Name}} struct { 13 | {{$table := .}} 14 | {{range .ColumnsSeq}}{{$col := $table.GetColumn .}} {{Mapper1up $col.Name}} {{Type $col}} {{Tag $table $col}} 15 | {{end}} 16 | } 17 | 18 | func (t {{Mapper .Name}}) TableName() string { 19 | return "{{.Name}}" 20 | } 21 | 22 | func (t *{{Mapper .Name}}) UpdateById(cols []string) error { 23 | _, err := base.UpdateByCol("id", t.Id, t, cols) 24 | return err 25 | } 26 | 27 | func Get{{Mapper .Name}}ById(id int) (*{{Mapper .Name}}, error) { 28 | e := &{{Mapper .Name}}{} 29 | exist, err := base.GetByCol("id", id, e) 30 | if err != nil { 31 | return nil, err 32 | } 33 | if !exist { 34 | return nil, nil 35 | } 36 | return e, err 37 | } 38 | 39 | {{end}} 40 | -------------------------------------------------------------------------------- /govscode.sh: -------------------------------------------------------------------------------- 1 | #export GOPROXY=https://proxy.golang.org 2 | #go get -u -v github.com/bytbox/golint 3 | #go get -u -v github.com/golang/tools 4 | go get -u -v github.com/lukehoban/go-outline 5 | go get -u -v github.com/newhook/go-symbols 6 | go get -u -v github.com/josharian/impl 7 | go get -u -v github.com/sqs/goreturns 8 | go get -u -v github.com/cweill/gotests 9 | #go get -u golang.org/x/tools/... 10 | #go get -u -v github.com/nsf/gocode 11 | go get -u -v github.com/mdempsky/gocode 12 | go get -u -v github.com/rogpeppe/godef 13 | go get -u -v github.com/golang/lint/golint 14 | go get -u -v github.com/lukehoban/go-find-references 15 | #go get -u -v sourcegraph.com/sqs/goreturns 16 | go get -u -v golang.org/x/tools/cmd/gorename 17 | go get -u -v github.com/tpng/gopkgs 18 | go get -u -v github.com/newhook/go-symbols 19 | go get -u -v golang.org/x/tools/cmd/guru 20 | 21 | #additional 22 | #go get -v -u github.com/peterh/liner 23 | #go get -v -u github.com/derekparker/delve/cmd/dlv 24 | 25 | -------------------------------------------------------------------------------- /pkg/dao/base/postgre.md: -------------------------------------------------------------------------------- 1 | # postgre 迁移踩坑 2 | 3 | ### 1、where 子句 4 | where 1 and mStatus=1 5 | 要改成 6 | where true and mStatus=1 7 | 8 | ### 2、类型和映射 9 | 不要开启其他column mapper的时候: 10 | 字段名数据库中是agId 则代码entity定义的名称必须是AgId 除了首字母,其他都要和表中完全一致。 11 | 12 | 如果开启了则按照mapper走。 13 | xorm定义的 tag 中 '字段名1' 这种生效,在pg中会被加引号。 14 | 15 | ### 3、时间不能有0000-00-00 16 | xorm定义的default('0001-01-01 00:00:00') 不生效。 17 | 写入时,判断如果time.Unix()<1000则time.Add(1*time.Second) 18 | 19 | ### 4、并行写太多会丢数据,报too many clients 20 | show max_connections;返回2100 21 | 测试10个协程不会有问题,100个协程会丢数据。 22 | 23 | 24 | ### 5、最终方案 25 | 5.1 数据库ddl字段名使用小写。 26 | entity定义的变量名不变。 27 | 28 | 5.2 entity声明增加tag tag中字段名使用小写。 29 | todo: 测试mysql兼容性 30 | 31 | 5.3 开发中的字段不要加引号,如果一定要加,那就加成小写。 32 | 33 | 5.4 不要使用columeMapper。 34 | 35 | postgres 错误duplicate key value violates unique constraint 解决方案 36 | SELECT setval('tablename_id_seq', (SELECT MAX(id) FROM tablename)+1) 37 | 38 | 39 | 主要是:serial key其实是由sequence实现的,当你手动给serial列赋值的时候,sequence是不会自增量变化的。 40 | 最好不要给serial手工赋值 41 | -------------------------------------------------------------------------------- /deploy/codegen/flexdrivecode/user_level.go: -------------------------------------------------------------------------------- 1 | package flexdrivecode 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type UserLevel struct { 10 | Id int `xorm:"not null pk autoincr comment('会员级别id') INT(10)"` 11 | Name string `xorm:"not null comment('会员级别名称') VARCHAR(32)"` 12 | QuotaSpace int64 `xorm:"not null default 0 comment('会员级别的用户空间 单位KB') BIGINT(20)"` 13 | Price int `xorm:"not null default 0 comment('会员级别的价格 单位分') INT(11)"` 14 | Created time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('创建时间') TIMESTAMP"` 15 | Updated time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 16 | Status int `xorm:"not null default 1 comment('状态 1=启用 99=删除') TINYINT(4)"` 17 | } 18 | 19 | func (t UserLevel) TableName() string { 20 | return "user_level" 21 | } 22 | 23 | func (t *UserLevel) GetById(int id) error { 24 | _, err := base.GetByCol("id", id, t) 25 | return err 26 | } 27 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/pingableif/if.go: -------------------------------------------------------------------------------- 1 | package pingableif 2 | 3 | import ( 4 | "net/url" 5 | ) 6 | 7 | type MsgHandler func(fromId, toId, msgId string, reqParam url.Values) (url.Values, error) 8 | type PongHandler func(fromId, toId string, metaData url.Values) (url.Values, error) 9 | 10 | // its a communicate middle ware, clusterworker rely use this interface 11 | // GrpcWorker implements this interface 12 | // HttpWorker implements this interface 13 | type PingableWorker interface { 14 | Serve(serviceAddr string) error 15 | PingTo(mateAddr string, fromId string, metaData url.Values) (url.Values, error) // ping out to other 16 | // like recv ping, cannot use grpcServer.Ping instead 17 | RegisterPong(PongHandler) 18 | MsgTo(mateAddr, action, msgId string, param url.Values) (url.Values, error) 19 | RegisterMsgHandler(action string, handler MsgHandler) // like recv OnMsg 20 | // todo: extend as worker with all functions inlcuding Follow,Remove,Add,EraseMaster,etc 21 | } 22 | 23 | // TODO 内部节点间通信走正式RPC, 外部业务通信可以走伪RPC 24 | -------------------------------------------------------------------------------- /pkg/dao/oper_log.go: -------------------------------------------------------------------------------- 1 | package dao 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type OperLog struct { 10 | Id int `xorm:"not null pk comment('操作记录id') INT(11)"` 11 | ManagerId int `xorm:"not null comment('操作员id 对应员工id') INT(11)"` 12 | ManagerName string `xorm:"not null default '' comment('操作人名称') VARCHAR(32)"` 13 | OperBiz string `xorm:"not null comment('操作业务 枚举') VARCHAR(64)"` 14 | OperParams string `xorm:"not null comment('操作内容参数') TEXT"` 15 | Created time.Time `xorm:"created not null default '1999-12-31 00:00:00' comment('操作时间') TIMESTAMP"` 16 | Updated time.Time `xorm:"updated not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 17 | Status int `xorm:"not null default 1 comment('状态 1=正常') TINYINT(4)"` 18 | } 19 | 20 | func (t OperLog) TableName() string { 21 | return "oper_log" 22 | } 23 | 24 | func (t *OperLog) GetById(id int) error { 25 | _, err := base.GetByCol("id", id, t) 26 | return err 27 | } 28 | -------------------------------------------------------------------------------- /static/bower/fontawesome/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | .fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | 13 | .fa-icon-rotate(@degrees, @rotation) { 14 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation); 15 | -webkit-transform: rotate(@degrees); 16 | -ms-transform: rotate(@degrees); 17 | transform: rotate(@degrees); 18 | } 19 | 20 | .fa-icon-flip(@horiz, @vert, @rotation) { 21 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=@rotation, mirror=1); 22 | -webkit-transform: scale(@horiz, @vert); 23 | -ms-transform: scale(@horiz, @vert); 24 | transform: scale(@horiz, @vert); 25 | } 26 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Floats 7 | // ------------------------- 8 | 9 | .clearfix { 10 | .clearfix(); 11 | } 12 | .center-block { 13 | .center-block(); 14 | } 15 | .pull-right { 16 | float: right !important; 17 | } 18 | .pull-left { 19 | float: left !important; 20 | } 21 | 22 | 23 | // Toggling content 24 | // ------------------------- 25 | 26 | // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1 27 | .hide { 28 | display: none !important; 29 | } 30 | .show { 31 | display: block !important; 32 | } 33 | .invisible { 34 | visibility: hidden; 35 | } 36 | .text-hide { 37 | .text-hide(); 38 | } 39 | 40 | 41 | // Hide from screenreaders and browsers 42 | // 43 | // Credit: HTML5 Boilerplate 44 | 45 | .hidden { 46 | display: none !important; 47 | } 48 | 49 | 50 | // For Affix plugin 51 | // ------------------------- 52 | 53 | .affix { 54 | position: fixed; 55 | } 56 | -------------------------------------------------------------------------------- /deploy/codegen/flexdrivecode/oper_log.go: -------------------------------------------------------------------------------- 1 | package flexdrivecode 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type OperLog struct { 10 | Id int `xorm:"not null pk comment('操作记录id') INT(11)"` 11 | ManagerId int `xorm:"not null comment('操作员id 对应员工id') INT(11)"` 12 | ManagerName string `xorm:"not null default '' comment('操作人名称') VARCHAR(32)"` 13 | OperBiz string `xorm:"not null comment('操作业务 枚举') VARCHAR(64)"` 14 | OperParams string `xorm:"not null comment('操作内容参数') TEXT"` 15 | Created time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('操作时间') TIMESTAMP"` 16 | Updated time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 17 | Status int `xorm:"not null default 1 comment('状态 1=正常') TINYINT(4)"` 18 | } 19 | 20 | func (t OperLog) TableName() string { 21 | return "oper_log" 22 | } 23 | 24 | func (t *OperLog) GetById(int id) error { 25 | _, err := base.GetByCol("id", id, t) 26 | return err 27 | } 28 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_mixins.scss: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | @mixin fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal 14px/1 FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | 13 | @mixin fa-icon-rotate($degrees, $rotation) { 14 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); 15 | -webkit-transform: rotate($degrees); 16 | -ms-transform: rotate($degrees); 17 | transform: rotate($degrees); 18 | } 19 | 20 | @mixin fa-icon-flip($horiz, $vert, $rotation) { 21 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}); 22 | -webkit-transform: scale($horiz, $vert); 23 | -ms-transform: scale($horiz, $vert); 24 | transform: scale($horiz, $vert); 25 | } 26 | -------------------------------------------------------------------------------- /pkg/app/admin/view/common/paginator.tpl: -------------------------------------------------------------------------------- 1 | {{define "paginator.tpl"}} 2 | {{if gt .paginator.PageNums 1}} 3 | 25 | {{end}} 26 | {{end}} -------------------------------------------------------------------------------- /pkg/app/customer/view/common/paginator.tpl: -------------------------------------------------------------------------------- 1 | {{define "paginator.tpl"}} 2 | {{if gt .paginator.PageNums 1}} 3 | 25 | {{end}} 26 | {{end}} -------------------------------------------------------------------------------- /pkg/app/admin/view/common/base.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{.appname}} 8 | 9 | {{range .HeadStyles}} 10 | 11 | {{end}} 12 | 13 | 14 | 15 | {{.BaseHeader}} 16 | 17 |
18 | {{.LayoutContent}} 19 |
20 | 21 | {{.BaseFooter}} 22 | 23 | 24 | 25 | 26 | {{range .HeadScripts}} 27 | 28 | {{end}} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/httpworker/clusterhelper.go: -------------------------------------------------------------------------------- 1 | package httpworker 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | ) 7 | 8 | const regPreKey = "/mycluster/" 9 | const masterKey = "master" 10 | const membersKey = "workers" 11 | 12 | type clusterHelper struct { 13 | clusterId string 14 | } 15 | 16 | func NewClusterHelper(clusterId string) *clusterHelper { 17 | return &clusterHelper{ 18 | clusterId, 19 | } 20 | } 21 | 22 | func (c *clusterHelper) genClusterKeyBase() string { 23 | return regPreKey + c.clusterId + "/" 24 | } 25 | 26 | //// 生成一个字符串key(比如redis key) 用于保存 workers 27 | //func (c *clusterHelper) genMasterIdKey() string { 28 | // return c.genClusterKeyBase() + masterKey 29 | //} 30 | 31 | //// 生成一个字符串key(比如redis key) 用于保存 worders 32 | //func (c *clusterHelper) genMembersKey() string { 33 | // return c.genClusterKeyBase() + membersKey 34 | //} 35 | 36 | func (c *clusterHelper) genMemberHash(memberId string) string { 37 | s := c.genClusterKeyBase() + memberId 38 | h := md5.New() 39 | h.Write([]byte(s)) 40 | return hex.EncodeToString(h.Sum(nil)) 41 | } 42 | -------------------------------------------------------------------------------- /static/bower/jquery/src/attributes/support.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../var/support" 3 | ], function( support ) { 4 | 5 | (function() { 6 | var input = document.createElement( "input" ), 7 | select = document.createElement( "select" ), 8 | opt = select.appendChild( document.createElement( "option" ) ); 9 | 10 | input.type = "checkbox"; 11 | 12 | // Support: iOS<=5.1, Android<=4.2+ 13 | // Default value for a checkbox should be "on" 14 | support.checkOn = input.value !== ""; 15 | 16 | // Support: IE<=11+ 17 | // Must access selectedIndex to make default options select 18 | support.optSelected = opt.selected; 19 | 20 | // Support: Android<=2.3 21 | // Options inside disabled selects are incorrectly marked as disabled 22 | select.disabled = true; 23 | support.optDisabled = !opt.disabled; 24 | 25 | // Support: IE<=11+ 26 | // An input loses its value after becoming a radio 27 | input = document.createElement( "input" ); 28 | input.value = "t"; 29 | input.type = "radio"; 30 | support.radioValue = input.value === "t"; 31 | })(); 32 | 33 | return support; 34 | 35 | }); 36 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/clusterworker/clusterhelper.go: -------------------------------------------------------------------------------- 1 | package clusterworker 2 | 3 | import ( 4 | "crypto/md5" 5 | "encoding/hex" 6 | ) 7 | 8 | const regPreKey = "/mycluster/" 9 | const masterKey = "master" 10 | const membersKey = "workers" 11 | 12 | type clusterHelper struct { 13 | clusterId string 14 | } 15 | 16 | func NewClusterHelper(clusterId string) *clusterHelper { 17 | return &clusterHelper{ 18 | clusterId, 19 | } 20 | } 21 | 22 | func (c *clusterHelper) genClusterKeyBase() string { 23 | return regPreKey + c.clusterId + "/" 24 | } 25 | 26 | //// 生成一个字符串key(比如redis key) 用于保存 workers 27 | //func (c *clusterHelper) genMasterIdKey() string { 28 | // return c.genClusterKeyBase() + masterKey 29 | //} 30 | 31 | //// 生成一个字符串key(比如redis key) 用于保存 worders 32 | //func (c *clusterHelper) genMembersKey() string { 33 | // return c.genClusterKeyBase() + membersKey 34 | //} 35 | 36 | func (c *clusterHelper) genMemberHash(memberAddr string) string { 37 | s := c.genClusterKeyBase() + memberAddr 38 | h := md5.New() 39 | h.Write([]byte(s)) 40 | return hex.EncodeToString(h.Sum(nil)) 41 | } 42 | -------------------------------------------------------------------------------- /pkg/utils/jsonTime.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | type JsonTime time.Time 8 | 9 | func NewJsonTimeNow() JsonTime { 10 | return JsonTime(time.Now()) 11 | } 12 | 13 | // 重写 time.Time 的 MarshalJSON 14 | func (j JsonTime) MarshalJSON() ([]byte, error) { 15 | if j.IsEmptyTime() { 16 | return []byte(`"` + ZeroTimeStr + `"`), nil 17 | } 18 | return []byte(`"` + j.String() + `"`), nil 19 | } 20 | 21 | // 重写 time.Time 的 UnmarshalJSON 22 | func (j *JsonTime) UnmarshalJSON(b []byte) error { 23 | now, err := time.ParseInLocation(`"`+DefaultTimeFmt+`"`, string(b), time.Local) 24 | *j = JsonTime(now) 25 | return err 26 | } 27 | 28 | // 重写 time.Time 的 String 29 | func (j JsonTime) String() string { 30 | str := time.Time(j).Format(DefaultTimeFmt) 31 | if str == StdZeroTimeStr { 32 | return ZeroTimeStr 33 | } 34 | return str 35 | } 36 | 37 | // 判断当前时间是不是"0"值 38 | func (j JsonTime) IsEmptyTime() bool { 39 | return j.String() == ZeroTimeStr 40 | } 41 | 42 | // 转换为标准库里time.Time类型 43 | func (j JsonTime) ToStdTime() time.Time { 44 | return time.Time(j) 45 | } 46 | -------------------------------------------------------------------------------- /static/bower/bootstrap/package.js: -------------------------------------------------------------------------------- 1 | // package metadata file for Meteor.js 2 | 3 | /* jshint strict:false */ 4 | /* global Package:true */ 5 | 6 | Package.describe({ 7 | name: 'twbs:bootstrap', // http://atmospherejs.com/twbs/bootstrap 8 | summary: 'The most popular front-end framework for developing responsive, mobile first projects on the web.', 9 | version: '3.3.7', 10 | git: 'https://github.com/twbs/bootstrap.git' 11 | }); 12 | 13 | Package.onUse(function (api) { 14 | api.versionsFrom('METEOR@1.0'); 15 | api.use('jquery', 'client'); 16 | var assets = [ 17 | 'dist/fonts/glyphicons-halflings-regular.eot', 18 | 'dist/fonts/glyphicons-halflings-regular.svg', 19 | 'dist/fonts/glyphicons-halflings-regular.ttf', 20 | 'dist/fonts/glyphicons-halflings-regular.woff', 21 | 'dist/fonts/glyphicons-halflings-regular.woff2' 22 | ]; 23 | if (api.addAssets) { 24 | api.addAssets(assets, 'client'); 25 | } else { 26 | api.addFiles(assets, 'client', { isAsset: true }); 27 | } 28 | api.addFiles([ 29 | 'dist/css/bootstrap.css', 30 | 'dist/js/bootstrap.js' 31 | ], 'client'); 32 | }); 33 | -------------------------------------------------------------------------------- /static/bower/jquery/src/exports/amd.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Register as a named AMD module, since jQuery can be concatenated with other 6 | // files that may use define, but not via a proper concatenation script that 7 | // understands anonymous AMD modules. A named AMD is safest and most robust 8 | // way to register. Lowercase jquery is used because AMD module names are 9 | // derived from file names, and jQuery is normally delivered in a lowercase 10 | // file name. Do this after creating the global so that if an AMD module wants 11 | // to call noConflict to hide this version of jQuery, it will work. 12 | 13 | // Note that for maximum portability, libraries that are not jQuery should 14 | // declare themselves as anonymous modules, and avoid setting a global if an 15 | // AMD loader is present. jQuery is a special case. For more information, see 16 | // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 17 | 18 | if ( typeof define === "function" && define.amd ) { 19 | define( "jquery", [], function() { 20 | return jQuery; 21 | }); 22 | } 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /pkg/app/customer/handler/myprofile.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/gin-gonic/gin" 7 | "github.com/uxff/flexdrive/pkg/dao" 8 | "github.com/uxff/flexdrive/pkg/log" 9 | ) 10 | 11 | func init() { 12 | } 13 | 14 | func Profile(c *gin.Context) { 15 | requestId := c.GetString(CtxKeyRequestId) 16 | 17 | loginInfo := getLoginInfo(c) 18 | levelInfo, err := dao.GetUserLevelById(loginInfo.UserEnt.LevelId) 19 | if err != nil { 20 | log.Trace(requestId).Errorf("query level error:%v", err) 21 | StdErrMsgResponse(c, ErrInvalidParam, "查询等级错误") 22 | return 23 | } 24 | 25 | if levelInfo == nil { 26 | levelInfo, err = dao.GetDefaultUserLevel() 27 | if err != nil { 28 | log.Trace(requestId).Errorf("query level error:%v", err) 29 | StdErrMsgResponse(c, ErrInvalidParam, "查询等级错误") 30 | return 31 | } 32 | } 33 | 34 | if levelInfo == nil { 35 | StdErrMsgResponse(c, ErrInvalidParam, "无默认等级") 36 | return 37 | } 38 | 39 | c.HTML(http.StatusOK, "my/profile.tpl", gin.H{ 40 | "LoginInfo": getLoginInfo(c), 41 | "IsLogin": isLoginIn(c), 42 | "userLevel": levelInfo, 43 | }) 44 | } 45 | -------------------------------------------------------------------------------- /static/bower/bootstrap/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "http://getbootstrap.com", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 3" 33 | }, 34 | "version": "3.3.7", 35 | "_release": "3.3.7", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.3.7", 39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86" 40 | }, 41 | "_source": "https://github.com/twbs/bootstrap.git", 42 | "_target": "~3.3.1", 43 | "_originalSource": "bootstrap" 44 | } -------------------------------------------------------------------------------- /static/bower/bootstrap/less/pager.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pager pagination 3 | // -------------------------------------------------- 4 | 5 | 6 | .pager { 7 | padding-left: 0; 8 | margin: @line-height-computed 0; 9 | list-style: none; 10 | text-align: center; 11 | &:extend(.clearfix all); 12 | li { 13 | display: inline; 14 | > a, 15 | > span { 16 | display: inline-block; 17 | padding: 5px 14px; 18 | background-color: @pager-bg; 19 | border: 1px solid @pager-border; 20 | border-radius: @pager-border-radius; 21 | } 22 | 23 | > a:hover, 24 | > a:focus { 25 | text-decoration: none; 26 | background-color: @pager-hover-bg; 27 | } 28 | } 29 | 30 | .next { 31 | > a, 32 | > span { 33 | float: right; 34 | } 35 | } 36 | 37 | .previous { 38 | > a, 39 | > span { 40 | float: left; 41 | } 42 | } 43 | 44 | .disabled { 45 | > a, 46 | > a:hover, 47 | > a:focus, 48 | > span { 49 | color: @pager-disabled-color; 50 | background-color: @pager-bg; 51 | cursor: @cursor-disabled; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /static/bower/jquery/src/core/parseHTML.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "./var/rsingleTag", 4 | "../manipulation" // buildFragment 5 | ], function( jQuery, rsingleTag ) { 6 | 7 | // data: string of html 8 | // context (optional): If specified, the fragment will be created in this context, defaults to document 9 | // keepScripts (optional): If true, will include scripts passed in the html string 10 | jQuery.parseHTML = function( data, context, keepScripts ) { 11 | if ( !data || typeof data !== "string" ) { 12 | return null; 13 | } 14 | if ( typeof context === "boolean" ) { 15 | keepScripts = context; 16 | context = false; 17 | } 18 | context = context || document; 19 | 20 | var parsed = rsingleTag.exec( data ), 21 | scripts = !keepScripts && []; 22 | 23 | // Single tag 24 | if ( parsed ) { 25 | return [ context.createElement( parsed[1] ) ]; 26 | } 27 | 28 | parsed = jQuery.buildFragment( [ data ], context, scripts ); 29 | 30 | if ( scripts && scripts.length ) { 31 | jQuery( scripts ).remove(); 32 | } 33 | 34 | return jQuery.merge( [], parsed.childNodes ); 35 | }; 36 | 37 | return jQuery.parseHTML; 38 | 39 | }); 40 | -------------------------------------------------------------------------------- /pkg/log/log.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | var ( 4 | DefaultLogger Logger 5 | ) 6 | 7 | type Logger interface { 8 | Debugf(format string, v ...interface{}) 9 | Infof(format string, v ...interface{}) 10 | Warnf(format string, v ...interface{}) 11 | Errorf(format string, v ...interface{}) 12 | Fatalf(format string, v ...interface{}) 13 | //Trace(traceId string) 14 | } 15 | 16 | func SetLogger(l Logger) { 17 | DefaultLogger = l 18 | } 19 | 20 | func Debugf(format string, v ...interface{}) { 21 | if DefaultLogger != nil { 22 | DefaultLogger.Debugf(format, v...) 23 | } 24 | } 25 | 26 | func Infof(format string, v ...interface{}) { 27 | if DefaultLogger != nil { 28 | DefaultLogger.Infof(format, v...) 29 | } 30 | } 31 | 32 | func Warnf(format string, v ...interface{}) { 33 | if DefaultLogger != nil { 34 | DefaultLogger.Warnf(format, v...) 35 | } 36 | } 37 | 38 | func Errorf(format string, v ...interface{}) { 39 | if DefaultLogger != nil { 40 | DefaultLogger.Errorf(format, v...) 41 | } 42 | } 43 | 44 | func Fatalf(format string, v ...interface{}) { 45 | if DefaultLogger != nil { 46 | DefaultLogger.Fatalf(format, v...) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /static/bower/jquery/src/manipulation/support.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../var/support" 3 | ], function( support ) { 4 | 5 | (function() { 6 | var fragment = document.createDocumentFragment(), 7 | div = fragment.appendChild( document.createElement( "div" ) ), 8 | input = document.createElement( "input" ); 9 | 10 | // Support: Safari<=5.1 11 | // Check state lost if the name is set (#11217) 12 | // Support: Windows Web Apps (WWA) 13 | // `name` and `type` must use .setAttribute for WWA (#14901) 14 | input.setAttribute( "type", "radio" ); 15 | input.setAttribute( "checked", "checked" ); 16 | input.setAttribute( "name", "t" ); 17 | 18 | div.appendChild( input ); 19 | 20 | // Support: Safari<=5.1, Android<4.2 21 | // Older WebKit doesn't clone checked state correctly in fragments 22 | support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 23 | 24 | // Support: IE<=11+ 25 | // Make sure textarea (and checkbox) defaultValue is properly cloned 26 | div.innerHTML = ""; 27 | support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 28 | })(); 29 | 30 | return support; 31 | 32 | }); 33 | -------------------------------------------------------------------------------- /pkg/log/trace.go: -------------------------------------------------------------------------------- 1 | package log 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "time" 7 | ) 8 | 9 | type Tracer struct { 10 | TraceId string 11 | Logger 12 | } 13 | 14 | func (t *Tracer) Debugf(format string, args ...interface{}) { 15 | t.Logger.Debugf(t.wrapTraceId()+format, args...) 16 | } 17 | 18 | func (t *Tracer) Infof(format string, args ...interface{}) { 19 | t.Logger.Infof(t.wrapTraceId()+format, args...) 20 | } 21 | 22 | func (t *Tracer) Warnf(format string, args ...interface{}) { 23 | t.Logger.Warnf(t.wrapTraceId()+format, args...) 24 | } 25 | 26 | func (t *Tracer) Errorf(format string, args ...interface{}) { 27 | t.Logger.Errorf(t.wrapTraceId()+format, args...) 28 | } 29 | 30 | func (t *Tracer) Fatalf(format string, args ...interface{}) { 31 | t.Logger.Fatalf(t.wrapTraceId()+format, args...) 32 | os.Exit(1) 33 | } 34 | 35 | func (t *Tracer) wrapTraceId() string { 36 | return "traceId:" + t.TraceId + " " 37 | } 38 | 39 | func Trace(traceId string) Logger { 40 | if traceId == "" { 41 | traceId = fmt.Sprintf("%d", time.Now().UnixNano()) 42 | } 43 | 44 | return &Tracer{ 45 | TraceId: traceId, 46 | Logger: DefaultLogger, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /static/bower/bootstrap/grunt/bs-commonjs-generator.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Grunt task for the CommonJS module generation 3 | * http://getbootstrap.com 4 | * Copyright 2014-2015 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var fs = require('fs'); 11 | var path = require('path'); 12 | 13 | var COMMONJS_BANNER = '// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.\n'; 14 | 15 | module.exports = function generateCommonJSModule(grunt, srcFiles, destFilepath) { 16 | var destDir = path.dirname(destFilepath); 17 | 18 | function srcPathToDestRequire(srcFilepath) { 19 | var requirePath = path.relative(destDir, srcFilepath).replace(/\\/g, '/'); 20 | return 'require(\'' + requirePath + '\')'; 21 | } 22 | 23 | var moduleOutputJs = COMMONJS_BANNER + srcFiles.map(srcPathToDestRequire).join('\n'); 24 | try { 25 | fs.writeFileSync(destFilepath, moduleOutputJs); 26 | } catch (err) { 27 | grunt.fail.warn(err); 28 | } 29 | grunt.log.writeln('File ' + destFilepath.cyan + ' created.'); 30 | }; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Manuel Martínez-Almeida 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /static/bower/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2016 Twitter, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /pkg/app/admin/handler/errorcode.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | const ( 4 | // 成功 5 | ErrSuccess = "0" 6 | 7 | // 错误 8 | ErrNotLogin = "10" 9 | ErrLoginExpired = "11" 10 | ErrMgrNotExist = "12" 11 | ErrInvalidPass = "13" 12 | ErrNoPermit = "14" 13 | ErrInvalidParam = "15" 14 | ErrInvalidCaptcha = "16" 15 | ErrNameDuplicate = "17" 16 | ErrMgrDisabled = "18" 17 | ErrRoleNotExist = "19" 18 | ErrInternal = "101" 19 | ErrLevelNotExist = "21" 20 | ErrLevelDisabled = "22" 21 | ErrItemNotExist = "23" 22 | ) 23 | 24 | var errCodeMap = map[string]string{ 25 | ErrSuccess: "操作成功", 26 | ErrNotLogin: "尚未登录,需要登录后才能操作", 27 | ErrLoginExpired: "登录状态已过期,需要重新登录", 28 | ErrMgrNotExist: "账号不存在", 29 | ErrMgrDisabled: "账号被禁用", 30 | ErrInvalidPass: "账号错误或密码错误", 31 | ErrNoPermit: "没有权限", 32 | ErrInvalidParam: "参数错误", 33 | ErrInvalidCaptcha: "验证码错误", 34 | ErrNameDuplicate: "名称重复,请更换名称后重试", 35 | ErrInternal: "系统内部错误,请稍后再试", 36 | ErrLevelDisabled: "会员等级被禁用", 37 | ErrLevelNotExist: "会员等级不存在", 38 | ErrItemNotExist: "内容不存在", 39 | } 40 | 41 | func CodeToMessage(code string) string { 42 | return errCodeMap[code] 43 | } 44 | -------------------------------------------------------------------------------- /pkg/app/admin/apihandler/errorcode.go: -------------------------------------------------------------------------------- 1 | package apihandler 2 | 3 | const ( 4 | // 成功 5 | ErrSuccess = "0" 6 | 7 | // 错误码 8 | ErrNotLogin = "10" 9 | ErrLoginExpired = "11" 10 | ErrMgrNotExist = "12" 11 | ErrInvalidPass = "13" 12 | ErrNoPermit = "14" 13 | ErrInvalidParam = "15" 14 | ErrInvalidCaptcha = "16" 15 | ErrNameDuplicate = "17" 16 | ErrMgrDisabled = "18" 17 | ErrRoleNotExist = "19" 18 | ErrInternal = "101" 19 | ErrLevelNotExist = "21" 20 | ErrLevelDisabled = "22" 21 | ErrItemNotExist = "23" 22 | ) 23 | 24 | var errCodeMap = map[string]string{ 25 | ErrSuccess: "操作成功", 26 | ErrNotLogin: "尚未登录,需要登录后才能操作", 27 | ErrLoginExpired: "登录状态已过期,需要重新登录", 28 | ErrMgrNotExist: "账号不存在", 29 | ErrMgrDisabled: "账号被禁用", 30 | ErrInvalidPass: "账号错误或密码错误", 31 | ErrNoPermit: "没有权限", 32 | ErrInvalidParam: "参数错误", 33 | ErrInvalidCaptcha: "验证码错误", 34 | ErrNameDuplicate: "名称重复,请更换名称后重试", 35 | ErrInternal: "系统内部错误,请稍后再试", 36 | ErrLevelDisabled: "会员等级被禁用", 37 | ErrLevelNotExist: "会员等级不存在", 38 | ErrItemNotExist: "内容不存在", 39 | } 40 | 41 | func CodeToMessage(code string) string { 42 | return errCodeMap[code] 43 | } 44 | -------------------------------------------------------------------------------- /static/bower/jquery/MIT-LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2014 jQuery Foundation and other contributors 2 | http://jquery.com/ 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /deploy/codegen/flexdrivecode/share.go: -------------------------------------------------------------------------------- 1 | package flexdrivecode 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type Share struct { 10 | Id int `xorm:"not null pk autoincr comment('文件id') INT(10)"` 11 | FileHash string `xorm:"not null default '' comment('文件哈希') VARCHAR(32)"` 12 | UserId int `xorm:"not null default 0 comment('分享者用户id') INT(11)"` 13 | NodeId int `xorm:"not null default 0 comment('所在节点名') INT(11)"` 14 | FileName string `xorm:"not null default '' comment('文件名') VARCHAR(32)"` 15 | Path string `xorm:"not null default '' comment('文件路径') VARCHAR(256)"` 16 | Created time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('创建时间') TIMESTAMP"` 17 | Updated time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 18 | Status int `xorm:"not null default 1 comment('状态 1=正常 2=隐藏 99=已删除') TINYINT(4)"` 19 | Expired time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('分享有效期') TIMESTAMP"` 20 | } 21 | 22 | func (t Share) TableName() string { 23 | return "share" 24 | } 25 | 26 | func (t *Share) GetById(int id) error { 27 | _, err := base.GetByCol("id", id, t) 28 | return err 29 | } 30 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/media.less: -------------------------------------------------------------------------------- 1 | .media { 2 | // Proper spacing between instances of .media 3 | margin-top: 15px; 4 | 5 | &:first-child { 6 | margin-top: 0; 7 | } 8 | } 9 | 10 | .media, 11 | .media-body { 12 | zoom: 1; 13 | overflow: hidden; 14 | } 15 | 16 | .media-body { 17 | width: 10000px; 18 | } 19 | 20 | .media-object { 21 | display: block; 22 | 23 | // Fix collapse in webkit from max-width: 100% and display: table-cell. 24 | &.img-thumbnail { 25 | max-width: none; 26 | } 27 | } 28 | 29 | .media-right, 30 | .media > .pull-right { 31 | padding-left: 10px; 32 | } 33 | 34 | .media-left, 35 | .media > .pull-left { 36 | padding-right: 10px; 37 | } 38 | 39 | .media-left, 40 | .media-right, 41 | .media-body { 42 | display: table-cell; 43 | vertical-align: top; 44 | } 45 | 46 | .media-middle { 47 | vertical-align: middle; 48 | } 49 | 50 | .media-bottom { 51 | vertical-align: bottom; 52 | } 53 | 54 | // Reset margins on headings for tighter default spacing 55 | .media-heading { 56 | margin-top: 0; 57 | margin-bottom: 5px; 58 | } 59 | 60 | // Media list variation 61 | // 62 | // Undo default ul/ol styles 63 | .media-list { 64 | padding-left: 0; 65 | list-style: none; 66 | } 67 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins/image.less: -------------------------------------------------------------------------------- 1 | // Image Mixins 2 | // - Responsive image 3 | // - Retina image 4 | 5 | 6 | // Responsive image 7 | // 8 | // Keep images from scaling beyond the width of their parents. 9 | .img-responsive(@display: block) { 10 | display: @display; 11 | max-width: 100%; // Part 1: Set a maximum relative to the parent 12 | height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching 13 | } 14 | 15 | 16 | // Retina image 17 | // 18 | // Short retina mixin for setting background-image and -size. Note that the 19 | // spelling of `min--moz-device-pixel-ratio` is intentional. 20 | .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) { 21 | background-image: url("@{file-1x}"); 22 | 23 | @media 24 | only screen and (-webkit-min-device-pixel-ratio: 2), 25 | only screen and ( min--moz-device-pixel-ratio: 2), 26 | only screen and ( -o-min-device-pixel-ratio: 2/1), 27 | only screen and ( min-device-pixel-ratio: 2), 28 | only screen and ( min-resolution: 192dpi), 29 | only screen and ( min-resolution: 2dppx) { 30 | background-image: url("@{file-2x}"); 31 | background-size: @width-1x @height-1x; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pkg/app/admin/handler/fs.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/uxff/flexdrive/pkg/dao" 8 | 9 | "github.com/gin-gonic/gin" 10 | ) 11 | 12 | func Fs(c *gin.Context) { 13 | 14 | fileHash := c.Param("fileHash") 15 | fileName := c.Param("fileName") 16 | fileIndex, err := dao.GetFileIndexByFileHash(fileHash) 17 | if err != nil { 18 | c.Status(http.StatusNotFound) 19 | //StdErrMsgResponse(c, ErrInternal, "文件读取错误") 20 | return 21 | } 22 | 23 | if fileIndex == nil { 24 | c.Status(http.StatusNotFound) 25 | //StdErrMsgResponse(c, ErrInternal, "文件不存在或已被删除") 26 | 27 | return 28 | } 29 | 30 | if fileName == "" { 31 | fileName = fileIndex.FileName 32 | } 33 | 34 | // node := storagemodel.GetCurrentNode() 35 | // if node == nil { 36 | // StdErrMsgResponse(c, ErrInternal, "文件集群状态异常") 37 | // return 38 | // } 39 | 40 | //physicalFilePath := node.FileHashToStoragePath(fileHash) 41 | 42 | c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", fileName)) 43 | //fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名 44 | c.Writer.Header().Add("Content-Type", "application/octet-stream") 45 | //c.File(physicalFilePath) 46 | c.File(fileIndex.InnerPath) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/app/admin/apihandler/fs.go: -------------------------------------------------------------------------------- 1 | package apihandler 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/uxff/flexdrive/pkg/dao" 8 | 9 | "github.com/gin-gonic/gin" 10 | ) 11 | 12 | func Fs(c *gin.Context) { 13 | 14 | fileHash := c.Param("fileHash") 15 | fileName := c.Param("fileName") 16 | fileIndex, err := dao.GetFileIndexByFileHash(fileHash) 17 | if err != nil { 18 | c.Status(http.StatusNotFound) 19 | //StdErrMsgResponse(c, ErrInternal, "文件读取错误") 20 | return 21 | } 22 | 23 | if fileIndex == nil { 24 | c.Status(http.StatusNotFound) 25 | //StdErrMsgResponse(c, ErrInternal, "文件不存在或已被删除") 26 | 27 | return 28 | } 29 | 30 | if fileName == "" { 31 | fileName = fileIndex.FileName 32 | } 33 | 34 | // node := storagemodel.GetCurrentNode() 35 | // if node == nil { 36 | // StdErrMsgResponse(c, ErrInternal, "文件集群状态异常") 37 | // return 38 | // } 39 | 40 | //physicalFilePath := node.FileHashToStoragePath(fileHash) 41 | 42 | c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", fileName)) 43 | //fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名 44 | c.Writer.Header().Add("Content-Type", "application/octet-stream") 45 | //c.File(physicalFilePath) 46 | c.File(fileIndex.InnerPath) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/app/customer/apihandler/fs.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/uxff/flexdrive/pkg/dao" 8 | 9 | "github.com/gin-gonic/gin" 10 | ) 11 | 12 | func Fs(c *gin.Context) { 13 | 14 | fileHash := c.Param("fileHash") 15 | fileName := c.Param("fileName") 16 | fileIndex, err := dao.GetFileIndexByFileHash(fileHash) 17 | if err != nil { 18 | c.Status(http.StatusNotFound) 19 | //StdErrMsgResponse(c, ErrInternal, "文件读取错误") 20 | return 21 | } 22 | 23 | if fileIndex == nil { 24 | c.Status(http.StatusNotFound) 25 | //StdErrMsgResponse(c, ErrInternal, "文件不存在或已被删除") 26 | 27 | return 28 | } 29 | 30 | if fileName == "" { 31 | fileName = fileIndex.FileName 32 | } 33 | 34 | // node := storagemodel.GetCurrentNode() 35 | // if node == nil { 36 | // StdErrMsgResponse(c, ErrInternal, "文件集群状态异常") 37 | // return 38 | // } 39 | 40 | //physicalFilePath := node.FileHashToStoragePath(fileHash) 41 | 42 | c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", fileName)) 43 | //fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名 44 | c.Writer.Header().Add("Content-Type", "application/octet-stream") 45 | //c.File(physicalFilePath) 46 | c.File(fileIndex.InnerPath) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/app/customer/handler/fs.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | 7 | "github.com/uxff/flexdrive/pkg/dao" 8 | 9 | "github.com/gin-gonic/gin" 10 | ) 11 | 12 | func Fs(c *gin.Context) { 13 | 14 | fileHash := c.Param("fileHash") 15 | fileName := c.Param("fileName") 16 | fileIndex, err := dao.GetFileIndexByFileHash(fileHash) 17 | if err != nil { 18 | c.Status(http.StatusNotFound) 19 | //StdErrMsgResponse(c, ErrInternal, "文件读取错误") 20 | return 21 | } 22 | 23 | if fileIndex == nil { 24 | c.Status(http.StatusNotFound) 25 | //StdErrMsgResponse(c, ErrInternal, "文件不存在或已被删除") 26 | 27 | return 28 | } 29 | 30 | if fileName == "" { 31 | fileName = fileIndex.FileName 32 | } 33 | 34 | // node := storagemodel.GetCurrentNode() 35 | // if node == nil { 36 | // StdErrMsgResponse(c, ErrInternal, "文件集群状态异常") 37 | // return 38 | // } 39 | 40 | //physicalFilePath := node.FileHashToStoragePath(fileHash) 41 | 42 | c.Writer.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=%s", fileName)) 43 | //fmt.Sprintf("attachment; filename=%s", filename)对下载的文件重命名 44 | c.Writer.Header().Add("Content-Type", "application/octet-stream") 45 | //c.File(physicalFilePath) 46 | c.File(fileIndex.InnerPath) 47 | } 48 | -------------------------------------------------------------------------------- /static/bower/bootstrap/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Before opening an issue: 2 | 3 | - [Search for duplicate or closed issues](https://github.com/twbs/bootstrap/issues?utf8=%E2%9C%93&q=is%3Aissue) 4 | - [Validate](http://validator.w3.org/nu/) and [lint](https://github.com/twbs/bootlint#in-the-browser) any HTML to avoid common problems 5 | - Prepare a [reduced test case](https://css-tricks.com/reduced-test-cases/) for any bugs 6 | - Read the [contributing guidelines](https://github.com/twbs/bootstrap/blob/master/CONTRIBUTING.md) 7 | 8 | When asking general "how to" questions: 9 | 10 | - Please do not open an issue here 11 | - Instead, ask for help on [StackOverflow, IRC, or Slack](https://github.com/twbs/bootstrap/blob/master/README.md#community) 12 | 13 | When reporting a bug, include: 14 | 15 | - Operating system and version (Windows, Mac OS X, Android, iOS, Win10 Mobile) 16 | - Browser and version (Chrome, Firefox, Safari, IE, MS Edge, Opera 15+, Android Browser) 17 | - Reduced test cases and potential fixes using [JS Bin](https://jsbin.com) 18 | 19 | When suggesting a feature, include: 20 | 21 | - As much detail as possible for what we should add and why it's important to Bootstrap 22 | - Relevant links to prior art, screenshots, or live demos whenever possible 23 | -------------------------------------------------------------------------------- /deploy/codegen/flexdrivecode/node.go: -------------------------------------------------------------------------------- 1 | package flexdrivecode 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type Node struct { 10 | Id int `xorm:"not null pk autoincr comment('主键id') INT(10)"` 11 | NodeName string `xorm:"not null comment('节点号') VARCHAR(16)"` 12 | TotalSpace int64 `xorm:"not null default 0 comment('全部空间 单位KB') BIGINT(20)"` 13 | UsedSpace int64 `xorm:"not null default 0 comment('使用的空间 单位KB') BIGINT(20)"` 14 | FileCount int64 `xorm:"not null default 0 comment('文件数量') BIGINT(20)"` 15 | Remark string `xorm:"not null comment('房间备注') TEXT"` 16 | Created time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('添加时间') TIMESTAMP"` 17 | Updated time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 18 | Status int `xorm:"not null default 1 comment('状态 1=正常启用 2=注册超时 99=删除 ') TINYINT(4)"` 19 | LastRegistered time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('最后注册时间') TIMESTAMP"` 20 | } 21 | 22 | func (t Node) TableName() string { 23 | return "node" 24 | } 25 | 26 | func (t *Node) GetById(int id) error { 27 | _, err := base.GetByCol("id", id, t) 28 | return err 29 | } 30 | -------------------------------------------------------------------------------- /static/bower/jquery/src/event/alias.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../event" 4 | ], function( jQuery ) { 5 | 6 | jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + 7 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 8 | "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { 9 | 10 | // Handle event binding 11 | jQuery.fn[ name ] = function( data, fn ) { 12 | return arguments.length > 0 ? 13 | this.on( name, null, data, fn ) : 14 | this.trigger( name ); 15 | }; 16 | }); 17 | 18 | jQuery.fn.extend({ 19 | hover: function( fnOver, fnOut ) { 20 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 21 | }, 22 | 23 | bind: function( types, data, fn ) { 24 | return this.on( types, null, data, fn ); 25 | }, 26 | unbind: function( types, fn ) { 27 | return this.off( types, null, fn ); 28 | }, 29 | 30 | delegate: function( selector, types, data, fn ) { 31 | return this.on( types, selector, data, fn ); 32 | }, 33 | undelegate: function( selector, types, fn ) { 34 | // ( namespace ) or ( selector, types [, fn] ) 35 | return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); 36 | } 37 | }); 38 | 39 | }); 40 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/grpcpingable/pb/pingablepb/pingable.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | package pingablepb; 3 | 4 | // 成员节点 5 | message NodeMember { 6 | string id = 1; 7 | string masterId = 2; 8 | string lastRegistered = 3; 9 | string serviceAddr = 4; 10 | string clusterId = 5; 11 | } 12 | 13 | // 心跳请求结构体 14 | message PingRequest { 15 | string fromId = 1; 16 | string masterId = 2; 17 | string metaData = 3; 18 | } 19 | 20 | // 心跳响应结构体 21 | message PingResponse { 22 | int32 code = 1; 23 | string msg = 2; 24 | repeated NodeMember members = 3; // 数组 25 | string masterId = 4; 26 | string metaData = 5; 27 | } 28 | 29 | // 消息请求结构体 30 | message MsgRequest { 31 | string fromId = 1; 32 | string toId = 2; 33 | string msgId = 3; 34 | string action = 4; 35 | string data = 5; 36 | } 37 | 38 | // 消息想用结构体 39 | message MsgResponse { 40 | int32 code = 1; 41 | string msg = 2; 42 | string msgId = 3; 43 | string action = 4; 44 | string data = 5; 45 | } 46 | 47 | // grpc 服务端接口 48 | service PingableInterface { 49 | // ping 心跳服务 50 | rpc Ping(PingRequest) returns (PingResponse) {} 51 | // msg 消息服务 用于接收同伴发送来的消息 52 | rpc Msg(MsgRequest) returns (MsgResponse) {} 53 | } 54 | -------------------------------------------------------------------------------- /pkg/app/nodestorage/clusterworker/ioc.go: -------------------------------------------------------------------------------- 1 | package clusterworker 2 | 3 | // use pingableif instead the interface bellow: 4 | 5 | // 依赖翻转的可操作接口说明 6 | // 消息处理句柄 问题:回到弱类型 但是能兼容grpc和http的实现 reqParam as metaData 7 | // type MsgHandler func(fromId, toId, msgId string, reqParam url.Values) (url.Values, error) 8 | // type PongHandler func(fromId, toId, msgId string, reqParam url.Values) (url.Values, error) 9 | 10 | // // its a communicate middle ware, clusterworker rely use this interface 11 | // // GrpcWorker implements this interface 12 | // // HttpWorker implements this interface 13 | // type PingableWorker interface { 14 | // Serve(serviceAddr string) error 15 | // PingTo(mateAddr string, fromId string, metaData interface{}) (url.Values, error) // ping out to other 16 | // // like recv ping, cannot use grpcServer.Ping instead 17 | // RegisterPong(PongHandler) 18 | // MsgTo(mateAddr, action, msgId string, param url.Values) (url.Values, error) 19 | // RegisterMsgHandler(action string, handler MsgHandler) // like recv OnMsg 20 | // // todo: extend as worker with all functions inlcuding Follow,Remove,Add,EraseMaster,etc 21 | // // TODO 内部节点间通信走正式RPC, 外部业务通信可以走伪RPC 22 | // } 23 | 24 | // 25 | // type MetaNode interface { 26 | // GetMeta(metaKey string) interface{} 27 | // SetMeta(metaKey string, metaValue interface{}) 28 | // } 29 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------------------------------- 3 | 4 | // Utilities 5 | @import "mixins/hide-text.less"; 6 | @import "mixins/opacity.less"; 7 | @import "mixins/image.less"; 8 | @import "mixins/labels.less"; 9 | @import "mixins/reset-filter.less"; 10 | @import "mixins/resize.less"; 11 | @import "mixins/responsive-visibility.less"; 12 | @import "mixins/size.less"; 13 | @import "mixins/tab-focus.less"; 14 | @import "mixins/reset-text.less"; 15 | @import "mixins/text-emphasis.less"; 16 | @import "mixins/text-overflow.less"; 17 | @import "mixins/vendor-prefixes.less"; 18 | 19 | // Components 20 | @import "mixins/alerts.less"; 21 | @import "mixins/buttons.less"; 22 | @import "mixins/panels.less"; 23 | @import "mixins/pagination.less"; 24 | @import "mixins/list-group.less"; 25 | @import "mixins/nav-divider.less"; 26 | @import "mixins/forms.less"; 27 | @import "mixins/progress-bar.less"; 28 | @import "mixins/table-row.less"; 29 | 30 | // Skins 31 | @import "mixins/background-variant.less"; 32 | @import "mixins/border-radius.less"; 33 | @import "mixins/gradients.less"; 34 | 35 | // Layout 36 | @import "mixins/clearfix.less"; 37 | @import "mixins/center-block.less"; 38 | @import "mixins/nav-vertical-align.less"; 39 | @import "mixins/grid-framework.less"; 40 | @import "mixins/grid.less"; 41 | -------------------------------------------------------------------------------- /pkg/utils/filehash/filesha1.go: -------------------------------------------------------------------------------- 1 | package filehash 2 | 3 | import ( 4 | "crypto/sha1" 5 | "encoding/hex" 6 | "io" 7 | "os" 8 | 9 | "github.com/uxff/flexdrive/pkg/log" 10 | ) 11 | 12 | // 可计算大文件的hash 13 | func CalcSha1(fileName string) (string, error) { 14 | fileHandle, err := os.Open(fileName) 15 | if err != nil { 16 | return "", err 17 | } 18 | defer fileHandle.Close() 19 | 20 | sha1Enc := sha1.New() 21 | if _, err := io.Copy(sha1Enc, fileHandle); err != nil { 22 | log.Errorf("err of doing this:%v", err) 23 | return "", err 24 | } 25 | 26 | hashStr := hex.EncodeToString(sha1Enc.Sum(nil)) 27 | return hashStr, nil 28 | } 29 | 30 | // 可计算大文件的hash 31 | func CalcStrSha1(fileName string) (string, error) { 32 | 33 | sha1Enc := sha1.New() 34 | // if _, err := io.Copy(sha1Enc, fileHandle); err != nil { 35 | // log.Errorf("err of doing this:%v", err) 36 | // return "", err 37 | // } 38 | sha1Enc.Write([]byte(fileName)) 39 | 40 | hashStr := hex.EncodeToString(sha1Enc.Sum(nil)) 41 | return hashStr, nil 42 | } 43 | 44 | // 调用前必须Seek到文件头 45 | func CalcFileSha1(fileHandle io.Reader) (string, error) { 46 | sha1Enc := sha1.New() 47 | if _, err := io.Copy(sha1Enc, fileHandle); err != nil { 48 | log.Errorf("err of doing this:%v", err) 49 | return "", err 50 | } 51 | 52 | hashStr := hex.EncodeToString(sha1Enc.Sum(nil)) 53 | return hashStr, nil 54 | 55 | } 56 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/labels.less: -------------------------------------------------------------------------------- 1 | // 2 | // Labels 3 | // -------------------------------------------------- 4 | 5 | .label { 6 | display: inline; 7 | padding: .2em .6em .3em; 8 | font-size: 75%; 9 | font-weight: bold; 10 | line-height: 1; 11 | color: @label-color; 12 | text-align: center; 13 | white-space: nowrap; 14 | vertical-align: baseline; 15 | border-radius: .25em; 16 | 17 | // Add hover effects, but only for links 18 | a& { 19 | &:hover, 20 | &:focus { 21 | color: @label-link-hover-color; 22 | text-decoration: none; 23 | cursor: pointer; 24 | } 25 | } 26 | 27 | // Empty labels collapse automatically (not available in IE8) 28 | &:empty { 29 | display: none; 30 | } 31 | 32 | // Quick fix for labels in buttons 33 | .btn & { 34 | position: relative; 35 | top: -1px; 36 | } 37 | } 38 | 39 | // Colors 40 | // Contextual variations (linked labels get darker on :hover) 41 | 42 | .label-default { 43 | .label-variant(@label-default-bg); 44 | } 45 | 46 | .label-primary { 47 | .label-variant(@label-primary-bg); 48 | } 49 | 50 | .label-success { 51 | .label-variant(@label-success-bg); 52 | } 53 | 54 | .label-info { 55 | .label-variant(@label-info-bg); 56 | } 57 | 58 | .label-warning { 59 | .label-variant(@label-warning-bg); 60 | } 61 | 62 | .label-danger { 63 | .label-variant(@label-danger-bg); 64 | } 65 | -------------------------------------------------------------------------------- /static/bower/bootstrap/nuget/bootstrap.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bootstrap 5 | 3.3.7 6 | Bootstrap CSS 7 | Twitter, Inc. 8 | bootstrap 9 | The most popular front-end framework for developing responsive, mobile first projects on the web. 10 | http://blog.getbootstrap.com 11 | Bootstrap framework in CSS. Includes fonts and JavaScript 12 | en-us 13 | http://getbootstrap.com 14 | http://getbootstrap.com/apple-touch-icon.png 15 | https://github.com/twbs/bootstrap/blob/master/LICENSE 16 | Copyright 2016 17 | false 18 | 19 | 20 | 21 | css js less mobile-first responsive front-end framework web 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/jumbotron.less: -------------------------------------------------------------------------------- 1 | // 2 | // Jumbotron 3 | // -------------------------------------------------- 4 | 5 | 6 | .jumbotron { 7 | padding-top: @jumbotron-padding; 8 | padding-bottom: @jumbotron-padding; 9 | margin-bottom: @jumbotron-padding; 10 | color: @jumbotron-color; 11 | background-color: @jumbotron-bg; 12 | 13 | h1, 14 | .h1 { 15 | color: @jumbotron-heading-color; 16 | } 17 | 18 | p { 19 | margin-bottom: (@jumbotron-padding / 2); 20 | font-size: @jumbotron-font-size; 21 | font-weight: 200; 22 | } 23 | 24 | > hr { 25 | border-top-color: darken(@jumbotron-bg, 10%); 26 | } 27 | 28 | .container &, 29 | .container-fluid & { 30 | border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container 31 | padding-left: (@grid-gutter-width / 2); 32 | padding-right: (@grid-gutter-width / 2); 33 | } 34 | 35 | .container { 36 | max-width: 100%; 37 | } 38 | 39 | @media screen and (min-width: @screen-sm-min) { 40 | padding-top: (@jumbotron-padding * 1.6); 41 | padding-bottom: (@jumbotron-padding * 1.6); 42 | 43 | .container &, 44 | .container-fluid & { 45 | padding-left: (@jumbotron-padding * 2); 46 | padding-right: (@jumbotron-padding * 2); 47 | } 48 | 49 | h1, 50 | .h1 { 51 | font-size: @jumbotron-heading-font-size; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /static/bower/bootstrap/nuget/bootstrap.less.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bootstrap.less 5 | 3.3.7 6 | Bootstrap Less 7 | Twitter, Inc. 8 | bootstrap 9 | The most popular front-end framework for developing responsive, mobile first projects on the web. 10 | http://blog.getbootstrap.com 11 | Bootstrap framework in Less. Includes fonts and JavaScript 12 | en-us 13 | http://getbootstrap.com 14 | http://getbootstrap.com/apple-touch-icon.png 15 | https://github.com/twbs/bootstrap/blob/master/LICENSE 16 | Copyright 2016 17 | false 18 | 19 | 20 | 21 | css js less mobile-first responsive front-end framework web 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /deploy/codegen/flexdrivecode/manager.go: -------------------------------------------------------------------------------- 1 | package flexdrivecode 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type Manager struct { 10 | Id int `xorm:"not null pk autoincr comment('管理员id') INT(10)"` 11 | Name string `xorm:"not null default '' comment('管理员名称') VARCHAR(32)"` 12 | Phone string `xorm:"not null default '' comment('管理员手机号') VARCHAR(12)"` 13 | Email string `xorm:"not null default '' comment('管理员email') VARCHAR(32)"` 14 | Pwd string `xorm:"not null default '' comment('密码') VARCHAR(32)"` 15 | Created time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('创建时间') TIMESTAMP"` 16 | Updated time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 17 | Status int `xorm:"not null default 1 comment('状态 1=正常 99=删除') TINYINT(4)"` 18 | RoleId int `xorm:"not null default 0 comment('角色id') INT(11)"` 19 | IsSuper int `xorm:"not null default 0 comment('是否是超管 1=超管') TINYINT(4)"` 20 | LastLoginAt time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('最后登录时间') TIMESTAMP"` 21 | LastLoginIp string `xorm:"not null default '' comment('最后登录ip') VARCHAR(16)"` 22 | } 23 | 24 | func (t Manager) TableName() string { 25 | return "manager" 26 | } 27 | 28 | func (t *Manager) GetById(int id) error { 29 | _, err := base.GetByCol("id", id, t) 30 | return err 31 | } 32 | -------------------------------------------------------------------------------- /static/js/twitter-bootstrap-hover-dropdown.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Project: Twitter Bootstrap Hover Dropdown 3 | * Author: Cameron Spear 4 | * Contributors: Mattia Larentis 5 | * 6 | * Dependencies: Twitter Bootstrap's Dropdown plugin, jQuery 7 | * 8 | * A simple plugin to enable twitter bootstrap dropdowns to active on hover and provide a nice user experience. 9 | * 10 | * License: MIT 11 | * 12 | * http://cameronspear.com/blog/twitter-bootstrap-dropdown-on-hover-plugin/ 13 | */(function(e,t,n){var r=e();e.fn.dropdownHover=function(n){r=r.add(this.parent());return this.each(function(){var i=e(this),s=i.parent(),o={delay:500,instantlyCloseOthers:!0},u={delay:e(this).data("delay"),instantlyCloseOthers:e(this).data("close-others")},a=e.extend(!0,{},o,n,u),f;s.hover(function(e){if(!s.hasClass("open")&&!i.is(e.target))return!0;a.instantlyCloseOthers===!0&&r.removeClass("open");t.clearTimeout(f);s.addClass("open")},function(){f=t.setTimeout(function(){s.removeClass("open")},a.delay)});i.hover(function(){a.instantlyCloseOthers===!0&&r.removeClass("open");t.clearTimeout(f);s.addClass("open")});s.find(".dropdown-submenu").each(function(){var n=e(this),r;n.hover(function(){t.clearTimeout(r);n.children(".dropdown-menu").show();n.siblings().children(".dropdown-menu").hide()},function(){var e=n.children(".dropdown-menu");r=t.setTimeout(function(){e.hide()},a.delay)})})})};e(document).ready(function(){e('[data-hover="dropdown"]').dropdownHover()})})(jQuery,this); -------------------------------------------------------------------------------- /pkg/app/admin/view/common/paginator2.tpl: -------------------------------------------------------------------------------- 1 | {{define "paginator2.tpl"}} 2 | 28 | {{end}} -------------------------------------------------------------------------------- /pkg/app/customer/handler/errorcode.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | const ( 4 | // 成功 5 | ErrSuccess = "0" 6 | 7 | // 错误 8 | ErrNotLogin = "10" 9 | ErrLoginExpired = "11" 10 | ErrUserNotExist = "12" 11 | ErrInvalidPass = "13" 12 | ErrNoPermit = "14" 13 | ErrInvalidParam = "15" 14 | ErrInvalidCaptcha = "16" 15 | ErrNameDuplicate = "17" 16 | ErrUserDisabled = "18" 17 | ErrInternal = "101" 18 | ErrLevelNotExist = "21" 19 | ErrLevelDisabled = "22" 20 | ErrEmailDuplicate = "23" 21 | ErrItemNotExist = "24" 22 | ErrUserFileNotExist = "25" 23 | ErrShareFileNotExist = "26" 24 | ) 25 | 26 | var errCodeMap = map[string]string{ 27 | ErrSuccess: "操作成功", 28 | ErrNotLogin: "尚未登录,需要登录后才能操作", 29 | ErrLoginExpired: "登录状态已过期,需要重新登录", 30 | ErrUserNotExist: "账号不存在", 31 | ErrUserDisabled: "账号被禁用", 32 | ErrInvalidPass: "账号错误或密码错误", 33 | ErrNoPermit: "没有权限", 34 | ErrInvalidParam: "参数错误", 35 | ErrInvalidCaptcha: "验证码错误", 36 | ErrNameDuplicate: "名称重复,请更换名称后重试", 37 | ErrInternal: "系统内部错误,请稍后再试", 38 | ErrLevelDisabled: "会员等级被禁用", 39 | ErrLevelNotExist: "会员等级不存在", 40 | ErrEmailDuplicate: "邮箱重复", 41 | ErrItemNotExist: "该条目不存在", 42 | ErrUserFileNotExist: "会员的文件不存在", 43 | ErrShareFileNotExist: "分享文件不存在", 44 | } 45 | 46 | func CodeToMessage(code string) string { 47 | return errCodeMap[code] 48 | } 49 | -------------------------------------------------------------------------------- /pkg/app/customer/view/common/paginator2.tpl: -------------------------------------------------------------------------------- 1 | {{define "paginator2.tpl"}} 2 | 28 | {{end}} -------------------------------------------------------------------------------- /pkg/app/customer/apihandler/errorcode.go: -------------------------------------------------------------------------------- 1 | package handler 2 | 3 | const ( 4 | // 成功 5 | ErrSuccess = "0" 6 | 7 | // 错误 8 | ErrNotLogin = "10" 9 | ErrLoginExpired = "11" 10 | ErrUserNotExist = "12" 11 | ErrInvalidPass = "13" 12 | ErrNoPermit = "14" 13 | ErrInvalidParam = "15" 14 | ErrInvalidCaptcha = "16" 15 | ErrNameDuplicate = "17" 16 | ErrUserDisabled = "18" 17 | ErrInternal = "101" 18 | ErrLevelNotExist = "21" 19 | ErrLevelDisabled = "22" 20 | ErrEmailDuplicate = "23" 21 | ErrItemNotExist = "24" 22 | ErrUserFileNotExist = "25" 23 | ErrShareFileNotExist = "26" 24 | ) 25 | 26 | var errCodeMap = map[string]string{ 27 | ErrSuccess: "操作成功", 28 | ErrNotLogin: "尚未登录,需要登录后才能操作", 29 | ErrLoginExpired: "登录状态已过期,需要重新登录", 30 | ErrUserNotExist: "账号不存在", 31 | ErrUserDisabled: "账号被禁用", 32 | ErrInvalidPass: "账号错误或密码错误", 33 | ErrNoPermit: "没有权限", 34 | ErrInvalidParam: "参数错误", 35 | ErrInvalidCaptcha: "验证码错误", 36 | ErrNameDuplicate: "名称重复,请更换名称后重试", 37 | ErrInternal: "系统内部错误,请稍后再试", 38 | ErrLevelDisabled: "会员等级被禁用", 39 | ErrLevelNotExist: "会员等级不存在", 40 | ErrEmailDuplicate: "邮箱重复", 41 | ErrItemNotExist: "该条目不存在", 42 | ErrUserFileNotExist: "会员的文件不存在", 43 | ErrShareFileNotExist: "分享文件不存在", 44 | } 45 | 46 | func CodeToMessage(code string) string { 47 | return errCodeMap[code] 48 | } 49 | -------------------------------------------------------------------------------- /static/bower/bootstrap/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | addressable (2.4.0) 5 | colorator (1.1.0) 6 | ffi (1.11.3) 7 | ffi (1.11.3-x64-mingw32) 8 | forwardable-extended (2.6.0) 9 | jekyll (3.6.3) 10 | addressable (~> 2.4) 11 | colorator (~> 1.0) 12 | jekyll-sass-converter (~> 1.0) 13 | jekyll-watch (~> 1.1) 14 | kramdown (~> 1.14) 15 | liquid (~> 4.0) 16 | mercenary (~> 0.3.3) 17 | pathutil (~> 0.9) 18 | rouge (>= 1.7, < 3) 19 | safe_yaml (~> 1.0) 20 | jekyll-sass-converter (1.5.2) 21 | sass (~> 3.4) 22 | jekyll-sitemap (0.11.0) 23 | addressable (~> 2.4.0) 24 | jekyll-watch (1.5.1) 25 | listen (~> 3.0) 26 | kramdown (1.17.0) 27 | liquid (4.0.3) 28 | listen (3.2.1) 29 | rb-fsevent (~> 0.10, >= 0.10.3) 30 | rb-inotify (~> 0.9, >= 0.9.10) 31 | mercenary (0.3.6) 32 | pathutil (0.16.2) 33 | forwardable-extended (~> 2.6) 34 | rb-fsevent (0.10.3) 35 | rb-inotify (0.10.1) 36 | ffi (~> 1.0) 37 | rouge (2.2.1) 38 | safe_yaml (1.0.5) 39 | sass (3.7.4) 40 | sass-listen (~> 4.0.0) 41 | sass-listen (4.0.0) 42 | rb-fsevent (~> 0.9, >= 0.9.4) 43 | rb-inotify (~> 0.9, >= 0.9.7) 44 | 45 | PLATFORMS 46 | ruby 47 | x64-mingw32 48 | 49 | DEPENDENCIES 50 | jekyll (~> 3.6.3) 51 | jekyll-sitemap (~> 0.11.0) 52 | 53 | BUNDLED WITH 54 | 1.12.5 55 | -------------------------------------------------------------------------------- /static/bower/fontawesome/scss/_extras.scss: -------------------------------------------------------------------------------- 1 | /* EXTRAS 2 | * -------------------------- */ 3 | 4 | /* Stacked and layered icon */ 5 | 6 | /* Animated rotating icon */ 7 | .#{$fa-css-prefix}-spin { 8 | -webkit-animation: spin 2s infinite linear; 9 | -moz-animation: spin 2s infinite linear; 10 | -o-animation: spin 2s infinite linear; 11 | animation: spin 2s infinite linear; 12 | } 13 | 14 | @-moz-keyframes spin { 15 | 0% { -moz-transform: rotate(0deg); } 16 | 100% { -moz-transform: rotate(359deg); } 17 | } 18 | @-webkit-keyframes spin { 19 | 0% { -webkit-transform: rotate(0deg); } 20 | 100% { -webkit-transform: rotate(359deg); } 21 | } 22 | @-o-keyframes spin { 23 | 0% { -o-transform: rotate(0deg); } 24 | 100% { -o-transform: rotate(359deg); } 25 | } 26 | @-ms-keyframes spin { 27 | 0% { -ms-transform: rotate(0deg); } 28 | 100% { -ms-transform: rotate(359deg); } 29 | } 30 | @keyframes spin { 31 | 0% { transform: rotate(0deg); } 32 | 100% { transform: rotate(359deg); } 33 | } 34 | 35 | 36 | // Icon rotations & flipping 37 | // ------------------------- 38 | 39 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); } 40 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); } 41 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); } 42 | 43 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); } 44 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); } 45 | -------------------------------------------------------------------------------- /deploy/codegen/flexdrivecode/order.go: -------------------------------------------------------------------------------- 1 | package flexdrivecode 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/dao/base" 7 | ) 8 | 9 | type Order struct { 10 | Id int `xorm:"not null pk autoincr comment('订单id') INT(10)"` 11 | UserId int `xorm:"not null comment('用户id') INT(11)"` 12 | OriginLevelId int `xorm:"not null comment('用户原等级id') INT(11)"` 13 | AwardLevelId int `xorm:"not null default 0 comment('用户购买的等级id') INT(11)"` 14 | AwardSpace int64 `xorm:"not null default 0 comment('本次购买的容量空间 单位KB') BIGINT(11)"` 15 | Phone string `xorm:"not null default '' comment('用户手机号') VARCHAR(12)"` 16 | LevelName string `xorm:"not null default '' comment('等级名') VARCHAR(12)"` 17 | TotalAmount int `xorm:"not null default 0 comment('订单价格 单位分') INT(11)"` 18 | PayAmount int `xorm:"not null default 0 comment('实付款金额 单位分') INT(11)"` 19 | Remark string `xorm:"not null comment('订单备注') TEXT"` 20 | Created time.Time `xorm:"not null default '1999-12-31 00:00:00' comment('创建时间') TIMESTAMP"` 21 | Updated time.Time `xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"` 22 | Status int `xorm:"not null default 1 comment('状态 1=待付款 2=未付款关闭 3=已付款 4=已退款') TINYINT(4)"` 23 | } 24 | 25 | func (t Order) TableName() string { 26 | return "order" 27 | } 28 | 29 | func (t *Order) GetById(int id) error { 30 | _, err := base.GetByCol("id", id, t) 31 | return err 32 | } 33 | -------------------------------------------------------------------------------- /pkg/app/admin/view/common/alert.tpl: -------------------------------------------------------------------------------- 1 | {{ define "alart.tpl"}} 2 | {{if .flash}} 3 | {{if (index .flash "warning")}} 4 | 10 | {{else if (index .flash "error")}} 11 | 17 | {{else if (index .flash "success")}} 18 | 24 | {{end}} 25 | {{end}} 26 | {{end}} 27 | -------------------------------------------------------------------------------- /pkg/app/customer/view/common/alert.tpl: -------------------------------------------------------------------------------- 1 | {{ define "alart.tpl"}} 2 | {{if .flash}} 3 | {{if (index .flash "warning")}} 4 | 10 | {{else if (index .flash "error")}} 11 | 17 | {{else if (index .flash "success")}} 18 | 24 | {{end}} 25 | {{end}} 26 | {{end}} 27 | -------------------------------------------------------------------------------- /pkg/app/customer/view/index/links.tpl: -------------------------------------------------------------------------------- 1 | {{append . "HeadStyles" "/static/css/custom.css"}} 2 | {{append . "HeadScripts" "/static/js/custom.js"}} 3 | 4 | 5 |
6 | 16 | 17 |
18 | 19 | {{range $gi, $lister := .thelinks}} 20 | 21 |
22 |
23 |

{{$lister.Name}}

24 |
25 |
26 | 27 |
28 | {{range $k, $site := $lister.Links}} 29 |
30 | {{$site.Name}} 31 |
32 | {{end}} 33 |
34 |
35 |
36 | 37 | {{end}} 38 |
39 |
40 | -------------------------------------------------------------------------------- /static/bower/jquery/src/core/access.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core" 3 | ], function( jQuery ) { 4 | 5 | // Multifunctional method to get and set values of a collection 6 | // The value/s can optionally be executed if it's a function 7 | var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 8 | var i = 0, 9 | len = elems.length, 10 | bulk = key == null; 11 | 12 | // Sets many values 13 | if ( jQuery.type( key ) === "object" ) { 14 | chainable = true; 15 | for ( i in key ) { 16 | jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); 17 | } 18 | 19 | // Sets one value 20 | } else if ( value !== undefined ) { 21 | chainable = true; 22 | 23 | if ( !jQuery.isFunction( value ) ) { 24 | raw = true; 25 | } 26 | 27 | if ( bulk ) { 28 | // Bulk operations run against the entire set 29 | if ( raw ) { 30 | fn.call( elems, value ); 31 | fn = null; 32 | 33 | // ...except when executing function values 34 | } else { 35 | bulk = fn; 36 | fn = function( elem, key, value ) { 37 | return bulk.call( jQuery( elem ), value ); 38 | }; 39 | } 40 | } 41 | 42 | if ( fn ) { 43 | for ( ; i < len; i++ ) { 44 | fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); 45 | } 46 | } 47 | } 48 | 49 | return chainable ? 50 | elems : 51 | 52 | // Gets 53 | bulk ? 54 | fn.call( elems ) : 55 | len ? fn( elems[0], key ) : emptyGet; 56 | }; 57 | 58 | return access; 59 | 60 | }); 61 | -------------------------------------------------------------------------------- /pkg/app/admin/view/index/links.tpl: -------------------------------------------------------------------------------- 1 | {{append . "HeadStyles" "/static/css/custom.css"}} 2 | {{append . "HeadScripts" "/static/js/custom.js"}} 3 | 4 | 5 |
6 | 16 | 17 |
18 | 19 | {{range $gi, $lister := .thelinks}} 20 | 21 |
22 |
23 |

{{$lister.Name}}

24 |
25 |
26 | 27 |
28 | {{range $k, $site := $lister.Links}} 29 |
30 | {{$site.Name}} 31 |
32 | {{end}} 33 |
34 |
35 |
36 | 37 | {{end}} 38 |
39 |
40 | -------------------------------------------------------------------------------- /static/bower/bootstrap/less/badges.less: -------------------------------------------------------------------------------- 1 | // 2 | // Badges 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .badge { 8 | display: inline-block; 9 | min-width: 10px; 10 | padding: 3px 7px; 11 | font-size: @font-size-small; 12 | font-weight: @badge-font-weight; 13 | color: @badge-color; 14 | line-height: @badge-line-height; 15 | vertical-align: middle; 16 | white-space: nowrap; 17 | text-align: center; 18 | background-color: @badge-bg; 19 | border-radius: @badge-border-radius; 20 | 21 | // Empty badges collapse automatically (not available in IE8) 22 | &:empty { 23 | display: none; 24 | } 25 | 26 | // Quick fix for badges in buttons 27 | .btn & { 28 | position: relative; 29 | top: -1px; 30 | } 31 | 32 | .btn-xs &, 33 | .btn-group-xs > .btn & { 34 | top: 0; 35 | padding: 1px 5px; 36 | } 37 | 38 | // Hover state, but only for links 39 | a& { 40 | &:hover, 41 | &:focus { 42 | color: @badge-link-hover-color; 43 | text-decoration: none; 44 | cursor: pointer; 45 | } 46 | } 47 | 48 | // Account for badges in navs 49 | .list-group-item.active > &, 50 | .nav-pills > .active > a > & { 51 | color: @badge-active-color; 52 | background-color: @badge-active-bg; 53 | } 54 | 55 | .list-group-item > & { 56 | float: right; 57 | } 58 | 59 | .list-group-item > & + & { 60 | margin-right: 5px; 61 | } 62 | 63 | .nav-pills > li > a > & { 64 | margin-left: 3px; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /pkg/dao/role.go: -------------------------------------------------------------------------------- 1 | package dao 2 | 3 | import ( 4 | "time" 5 | 6 | "github.com/uxff/flexdrive/pkg/app/admin/model/rbac" 7 | "github.com/uxff/flexdrive/pkg/dao/base" 8 | ) 9 | 10 | type Role struct { 11 | Id int `xorm:"not null pk autoincr comment('角色id') INT(10)"` 12 | Name string `xorm:"not null default '' comment('角色名称') VARCHAR(32)"` 13 | Status int `xorm:"not null default 1 comment('状态 1=正常启用 99=删除') TINYINT(4)"` 14 | Created time.Time `xorm:"created not null default '1999-12-31 00:00:00' comment('创建时间') TIMESTAMP"` 15 | Updated time.Time `xorm:"updated not null default 'CURRENT_TIMESTAMP' comment('更新时间') TIMESTAMP"` 16 | Permit rbac.RoleAccess `xorm:"not null comment('授权内容 json') json"` 17 | } 18 | 19 | func (t Role) TableName() string { 20 | return "role" 21 | } 22 | 23 | func (t *Role) UpdateById(cols []string) error { 24 | _, err := base.UpdateByCol("id", t.Id, t, cols) 25 | return err 26 | } 27 | 28 | func GetRoleById(id int) (*Role, error) { 29 | ent := &Role{} 30 | exist, err := base.GetByCol("id", id, ent) 31 | if err != nil { 32 | return nil, err 33 | } 34 | if !exist { 35 | return nil, nil 36 | } 37 | return ent, nil 38 | } 39 | func GetRoleByName(name string) (*Role, error) { 40 | ent := &Role{} 41 | exist, err := base.GetByCol("name", name, ent) 42 | if err != nil { 43 | return nil, err 44 | } 45 | if !exist { 46 | return nil, nil 47 | } 48 | return ent, err 49 | } 50 | 51 | func (t *Role) IsSuper() bool { 52 | return t.Id == 1 53 | } 54 | -------------------------------------------------------------------------------- /pkg/app/customer/view/order/mockpay.tpl: -------------------------------------------------------------------------------- 1 | {{ define "order/mockpay.tpl" }} 2 | 3 |
4 |

5 | 本页面用于模拟本系统的订单支付跳转到第三方支付页面 6 |

7 |

8 | 请在1分钟内支付,否则订单会失效,失效后请重新打开支付 9 |

10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 |
订单号{{.Order.Id}}
用户Id
用户Email{{.User.Email}}
订单号
订单内容{{.Order.LevelName}}
订单金额{{.Order.TotalAmount}}
支付机构订单号
输入支付验证码({{.VerifyCode}})
44 | 45 | 46 | 返回 47 |
48 | {{end}} -------------------------------------------------------------------------------- /static/bower/bootstrap/less/bootstrap.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.3.7 (http://getbootstrap.com) 3 | * Copyright 2011-2016 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */ 6 | 7 | // Core variables and mixins 8 | @import "variables.less"; 9 | @import "mixins.less"; 10 | 11 | // Reset and dependencies 12 | @import "normalize.less"; 13 | @import "print.less"; 14 | @import "glyphicons.less"; 15 | 16 | // Core CSS 17 | @import "scaffolding.less"; 18 | @import "type.less"; 19 | @import "code.less"; 20 | @import "grid.less"; 21 | @import "tables.less"; 22 | @import "forms.less"; 23 | @import "buttons.less"; 24 | 25 | // Components 26 | @import "component-animations.less"; 27 | @import "dropdowns.less"; 28 | @import "button-groups.less"; 29 | @import "input-groups.less"; 30 | @import "navs.less"; 31 | @import "navbar.less"; 32 | @import "breadcrumbs.less"; 33 | @import "pagination.less"; 34 | @import "pager.less"; 35 | @import "labels.less"; 36 | @import "badges.less"; 37 | @import "jumbotron.less"; 38 | @import "thumbnails.less"; 39 | @import "alerts.less"; 40 | @import "progress-bars.less"; 41 | @import "media.less"; 42 | @import "list-group.less"; 43 | @import "panels.less"; 44 | @import "responsive-embed.less"; 45 | @import "wells.less"; 46 | @import "close.less"; 47 | 48 | // Components w/ JavaScript 49 | @import "modals.less"; 50 | @import "tooltip.less"; 51 | @import "popovers.less"; 52 | @import "carousel.less"; 53 | 54 | // Utility classes 55 | @import "utilities.less"; 56 | @import "responsive-utilities.less"; 57 | -------------------------------------------------------------------------------- /static/bower/bootstrap/grunt/bs-raw-files-generator.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Grunt task for generating raw-files.min.js for the Customizer 3 | * http://getbootstrap.com 4 | * Copyright 2014-2015 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | */ 7 | 8 | 'use strict'; 9 | 10 | var fs = require('fs'); 11 | var btoa = require('btoa'); 12 | var glob = require('glob'); 13 | 14 | function getFiles(type) { 15 | var files = {}; 16 | var recursive = type === 'less'; 17 | var globExpr = recursive ? '/**/*' : '/*'; 18 | glob.sync(type + globExpr) 19 | .filter(function (path) { 20 | return type === 'fonts' ? true : new RegExp('\\.' + type + '$').test(path); 21 | }) 22 | .forEach(function (fullPath) { 23 | var relativePath = fullPath.replace(/^[^/]+\//, ''); 24 | files[relativePath] = type === 'fonts' ? btoa(fs.readFileSync(fullPath)) : fs.readFileSync(fullPath, 'utf8'); 25 | }); 26 | return 'var __' + type + ' = ' + JSON.stringify(files) + '\n'; 27 | } 28 | 29 | module.exports = function generateRawFilesJs(grunt, banner) { 30 | if (!banner) { 31 | banner = ''; 32 | } 33 | var dirs = ['js', 'less', 'fonts']; 34 | var files = banner + dirs.map(getFiles).reduce(function (combined, file) { 35 | return combined + file; 36 | }, ''); 37 | var rawFilesJs = 'docs/assets/js/raw-files.min.js'; 38 | try { 39 | fs.writeFileSync(rawFilesJs, files); 40 | } catch (err) { 41 | grunt.fail.warn(err); 42 | } 43 | grunt.log.writeln('File ' + rawFilesJs.cyan + ' created.'); 44 | }; 45 | -------------------------------------------------------------------------------- /static/bower/jquery/src/ajax/script.js: -------------------------------------------------------------------------------- 1 | define([ 2 | "../core", 3 | "../ajax" 4 | ], function( jQuery ) { 5 | 6 | // Install script dataType 7 | jQuery.ajaxSetup({ 8 | accepts: { 9 | script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" 10 | }, 11 | contents: { 12 | script: /(?:java|ecma)script/ 13 | }, 14 | converters: { 15 | "text script": function( text ) { 16 | jQuery.globalEval( text ); 17 | return text; 18 | } 19 | } 20 | }); 21 | 22 | // Handle cache's special case and crossDomain 23 | jQuery.ajaxPrefilter( "script", function( s ) { 24 | if ( s.cache === undefined ) { 25 | s.cache = false; 26 | } 27 | if ( s.crossDomain ) { 28 | s.type = "GET"; 29 | } 30 | }); 31 | 32 | // Bind script tag hack transport 33 | jQuery.ajaxTransport( "script", function( s ) { 34 | // This transport only deals with cross domain requests 35 | if ( s.crossDomain ) { 36 | var script, callback; 37 | return { 38 | send: function( _, complete ) { 39 | script = jQuery("