mirror of
https://github.com/Luzifer/share.git
synced 2024-12-20 10:31:16 +00:00
Renew technologies used
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
bbff947bd0
commit
bdcb49be2a
6 changed files with 296 additions and 302 deletions
198
.eslintrc.json
Normal file
198
.eslintrc.json
Normal file
|
@ -0,0 +1,198 @@
|
|||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 8,
|
||||
"ecmaFeatures": {
|
||||
"experimentalObjectRestSpread": true,
|
||||
"jsx": true
|
||||
},
|
||||
"sourceType": "module"
|
||||
},
|
||||
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": false
|
||||
},
|
||||
|
||||
"plugins": [
|
||||
"import",
|
||||
"node",
|
||||
"promise",
|
||||
"standard"
|
||||
],
|
||||
|
||||
"globals": {
|
||||
"document": false,
|
||||
"navigator": false,
|
||||
"window": false
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"arrow-spacing": ["error", { "before": true, "after": true }],
|
||||
"block-spacing": ["error", "always"],
|
||||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
|
||||
"camelcase": ["error", { "properties": "never" }],
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"comma-spacing": ["error", { "before": false, "after": true }],
|
||||
"comma-style": ["error", "last"],
|
||||
"constructor-super": "error",
|
||||
"curly": ["error", "multi-line"],
|
||||
"dot-location": ["error", "property"],
|
||||
"eol-last": "error",
|
||||
"eqeqeq": ["error", "always", { "null": "ignore" }],
|
||||
"func-call-spacing": ["error", "never"],
|
||||
"generator-star-spacing": ["error", { "before": true, "after": true }],
|
||||
"handle-callback-err": ["error", "^(err|error)$" ],
|
||||
"indent": ["error", 2, {
|
||||
"SwitchCase": 1,
|
||||
"VariableDeclarator": 1,
|
||||
"outerIIFEBody": 1,
|
||||
"MemberExpression": 1,
|
||||
"FunctionDeclaration": { "parameters": 1, "body": 1 },
|
||||
"FunctionExpression": { "parameters": 1, "body": 1 },
|
||||
"CallExpression": { "arguments": 1 },
|
||||
"ArrayExpression": 1,
|
||||
"ObjectExpression": 1,
|
||||
"ImportDeclaration": 1,
|
||||
"flatTernaryExpressions": false,
|
||||
"ignoreComments": false
|
||||
}],
|
||||
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
|
||||
"keyword-spacing": ["error", { "before": true, "after": true }],
|
||||
"new-cap": ["error", { "newIsCap": true, "capIsNew": false }],
|
||||
"new-parens": "error",
|
||||
"no-array-constructor": "error",
|
||||
"no-caller": "error",
|
||||
"no-class-assign": "error",
|
||||
"no-compare-neg-zero": "error",
|
||||
"no-cond-assign": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-constant-condition": ["error", { "checkLoops": false }],
|
||||
"no-control-regex": "error",
|
||||
"no-debugger": "error",
|
||||
"no-delete-var": "error",
|
||||
"no-dupe-args": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-dupe-keys": "error",
|
||||
"no-duplicate-case": "error",
|
||||
"no-empty-character-class": "error",
|
||||
"no-empty-pattern": "error",
|
||||
"no-eval": "error",
|
||||
"no-ex-assign": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-boolean-cast": "error",
|
||||
"no-extra-parens": ["error", "functions"],
|
||||
"no-fallthrough": "error",
|
||||
"no-floating-decimal": "error",
|
||||
"no-func-assign": "error",
|
||||
"no-global-assign": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-inner-declarations": ["error", "functions"],
|
||||
"no-invalid-regexp": "error",
|
||||
"no-irregular-whitespace": "error",
|
||||
"no-iterator": "error",
|
||||
"no-label-var": "error",
|
||||
"no-labels": ["error", { "allowLoop": false, "allowSwitch": false }],
|
||||
"no-lone-blocks": "error",
|
||||
"no-mixed-operators": ["error", {
|
||||
"groups": [
|
||||
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
||||
["&&", "||"],
|
||||
["in", "instanceof"]
|
||||
],
|
||||
"allowSamePrecedence": true
|
||||
}],
|
||||
"no-mixed-spaces-and-tabs": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }],
|
||||
"no-negated-in-lhs": "error",
|
||||
"no-new": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-object": "error",
|
||||
"no-new-require": "error",
|
||||
"no-new-symbol": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-obj-calls": "error",
|
||||
"no-octal": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-path-concat": "error",
|
||||
"no-proto": "error",
|
||||
"no-redeclare": "error",
|
||||
"no-regex-spaces": "error",
|
||||
"no-return-assign": ["error", "except-parens"],
|
||||
"no-return-await": "error",
|
||||
"no-self-assign": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "error",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-sparse-arrays": "error",
|
||||
"no-tabs": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"no-this-before-super": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-undef": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-unexpected-multiline": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
|
||||
"no-unreachable": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unsafe-negation": "error",
|
||||
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true, "allowTaggedTemplates": true }],
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }],
|
||||
"no-use-before-define": ["error", { "functions": false, "classes": false, "variables": false }],
|
||||
"no-useless-call": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-escape": "error",
|
||||
"no-useless-rename": "error",
|
||||
"no-useless-return": "error",
|
||||
"no-whitespace-before-property": "error",
|
||||
"no-with": "error",
|
||||
"object-property-newline": ["error", { "allowMultiplePropertiesPerLine": true }],
|
||||
"one-var": ["error", { "initialized": "never" }],
|
||||
"operator-linebreak": ["error", "after", { "overrides": { "?": "before", ":": "before" } }],
|
||||
"padded-blocks": ["error", { "blocks": "never", "switches": "never", "classes": "never" }],
|
||||
"prefer-promise-reject-errors": "error",
|
||||
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
|
||||
"rest-spread-spacing": ["error", "never"],
|
||||
"semi": ["error", "always"],
|
||||
"semi-spacing": ["error", { "before": false, "after": true }],
|
||||
"space-before-blocks": ["error", "always"],
|
||||
"space-before-function-paren": ["error", "never"],
|
||||
"space-in-parens": ["error", "never"],
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": ["error", { "words": true, "nonwords": false }],
|
||||
"spaced-comment": ["error", "always", {
|
||||
"line": { "markers": ["*package", "!", "/", ",", "="] },
|
||||
"block": { "balanced": true, "markers": ["*package", "!", ",", ":", "::", "flow-include"], "exceptions": ["*"] }
|
||||
}],
|
||||
"symbol-description": "error",
|
||||
"template-curly-spacing": ["error", "never"],
|
||||
"template-tag-spacing": ["error", "never"],
|
||||
"unicode-bom": ["error", "never"],
|
||||
"use-isnan": "error",
|
||||
"valid-typeof": ["error", { "requireStringLiterals": true }],
|
||||
"wrap-iife": ["error", "any", { "functionPrototypeMethods": true }],
|
||||
"yield-star-spacing": ["error", "both"],
|
||||
"yoda": ["error", "never"],
|
||||
|
||||
"import/export": "error",
|
||||
"import/first": "error",
|
||||
"import/no-duplicates": "error",
|
||||
"import/no-webpack-loader-syntax": "error",
|
||||
|
||||
"node/no-deprecated-api": "error",
|
||||
"node/process-exit-as-throw": "error",
|
||||
|
||||
"promise/param-names": "error",
|
||||
|
||||
"standard/array-bracket-even-spacing": ["error", "either"],
|
||||
"standard/computed-property-even-spacing": ["error", "even"],
|
||||
"standard/no-callback-literal": "error",
|
||||
"standard/object-curly-even-spacing": ["error", "either"]
|
||||
}
|
||||
}
|
8
Makefile
8
Makefile
|
@ -1,10 +1,10 @@
|
|||
default:
|
||||
|
||||
pack: generate
|
||||
go-bindata -modtime 1 frontend
|
||||
lint:
|
||||
docker run --rm -ti -v $(CURDIR):$(CURDIR) -w $(CURDIR) luzifer/eslint frontend/*.js
|
||||
|
||||
generate:
|
||||
coffee -c frontend/app.coffee
|
||||
pack:
|
||||
go-bindata -modtime 1 frontend
|
||||
|
||||
auto-hook-pre-commit: pack
|
||||
git diff --exit-code bindata.go
|
||||
|
|
210
bindata.go
210
bindata.go
|
@ -1,11 +1,9 @@
|
|||
// Code generated by go-bindata. DO NOT EDIT.
|
||||
// sources:
|
||||
// frontend/app.coffee
|
||||
// frontend/app.js
|
||||
// frontend/index.html
|
||||
|
||||
package main
|
||||
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
|
@ -38,6 +36,7 @@ func bindataRead(data []byte, name string) ([]byte, error) {
|
|||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
|
||||
type asset struct {
|
||||
bytes []byte
|
||||
info fileInfoEx
|
||||
|
@ -78,176 +77,12 @@ func (fi bindataFileInfo) Sys() interface{} {
|
|||
return nil
|
||||
}
|
||||
|
||||
var _frontendAppCoffee = []byte(
|
||||
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x53\x4d\x4f\x1b\x31\x10\xbd\xfb\x57\xcc\x01\xc9\x59\x35\x71\x8a\xca" +
|
||||
"\x09\x69\x2b\x55\xb0\x40\x24\x12\xaa\x10\x6e\x55\x91\x59\xcf\xae\xdd\x6e\xc6\x91\xed\x74\xc3\xbf\xaf\xec\xfd\x68" +
|
||||
"\x52\xa8\x7a\xf3\xcc\xbc\x79\xf3\xf1\xc6\x95\x69\xf0\x69\x7d\x0f\x39\xec\x49\x61\x65\x08\x15\x63\xcb\xc7\xdb\xe7" +
|
||||
"\xd5\xc3\xe6\xf9\xe6\xe1\x69\x75\x0d\x39\xf0\x1b\xd3\x20\x90\x0d\x50\xd9\x3d\x29\x3e\x02\xbe\x16\xeb\xe5\x62\xb3" +
|
||||
"\x29\x12\x68\x65\x03\xc8\xa6\xb1\x2d\x2a\x08\x16\x64\x59\xa2\xf7\x10\x0b\x74\x09\xb7\xc5\xaa\x58\x2f\xae\x9e\x8b" +
|
||||
"\xf5\x3a\xc2\x1f\xed\x16\x83\x36\x54\x43\x8b\x14\xa0\x75\x96\x6a\xce\xd8\x19\xcc\x3e\x33\x80\xb3\x49\x6b\x48\xd9" +
|
||||
"\x36\x13\x2f\x86\x14\x70\x2d\xbd\x2e\xb5\xa4\x1a\xf9\x14\xa2\x71\x6f\xa5\x62\x30\x3e\x27\x19\x03\x00\x60\x83\x0d" +
|
||||
"\x79\xc7\x13\xcb\x43\x0e\x1d\x99\x68\x6c\x29\x83\xb1\x24\x22\x4c\xf8\xfd\x8b\x0f\xce\x50\x3d\x39\x8f\xd9\xb8\x7d" +
|
||||
"\x41\x15\x27\x5d\x50\x65\x27\x31\x31\x63\xec\xc4\x09\x39\x74\xfe\x8e\xdb\x54\x3d\x7d\x0e\x9c\xa7\xf2\x0e\xc3\xde" +
|
||||
"\x11\x68\x49\xaa\xc1\xc2\x39\xeb\x96\xe8\xbd\xac\x11\x4e\x56\xca\xfa\xc6\xba\xc5\xc7\x57\x9c\x58\xc8\x1f\xf2\x90" +
|
||||
"\xac\x69\x22\x8b\xeb\xb1\xea\x12\xf8\x5d\xf1\xe5\xba\xe3\xf7\xfb\xb4\xd4\xcb\xa1\x42\x6c\x2e\x05\x30\xd6\xba\x3c" +
|
||||
"\x2e\xcc\xd8\x11\x26\x36\xae\x64\x90\x53\xf0\x41\x86\xbd\x9f\xc2\x41\xbb\x7e\x8a\xf0\xba\x8b\x1b\x3a\x68\x27\x6a" +
|
||||
"\x0c\x6b\xf4\x3b\x4b\x1e\xef\x50\x2a\x74\xc0\xaf\x2c\x05\xa4\x30\xdb\xbc\xee\x90\xc7\xbe\x4b\x4b\xde\x36\x28\x1a" +
|
||||
"\x5b\x0f\x33\xb0\xa4\x17\x17\x5e\xdb\x76\xd6\x58\xa9\x0c\xd5\x3c\x13\xda\x28\x4c\xb2\xc4\x58\x84\x36\x86\x7e\xce" +
|
||||
"\xb4\xc3\x8a\x67\x42\x86\xe0\x80\x27\x63\x3a\xf2\xfc\x05\xf5\xae\x1c\x91\xf1\xfd\x1e\x90\xe4\x16\x79\x26\x02\x1e" +
|
||||
"\xc2\x10\x3d\xd2\x75\xf0\x34\xd2\x87\x05\x29\x3c\x3c\x54\x13\x3e\xe7\x19\x7c\x80\xf3\x8c\x75\x12\xc6\xf9\xc5\x56" +
|
||||
"\x86\x52\xc3\xfc\xbb\xd9\xca\x1a\xbf\xcd\xe7\x69\xa9\xe3\x4c\xc9\xcb\xb3\x64\xf4\x87\xd6\x29\xfd\x1e\xc5\x2f\xa3" +
|
||||
"\xd0\xbe\xa1\x48\xde\x7f\x51\x8c\xa8\x1a\x09\x9d\x29\xff\xe0\xd8\x91\xa2\x51\xc4\x83\x76\x83\x86\xbd\x7c\xdb\xfe" +
|
||||
"\xc0\x72\xf0\xad\x89\x1d\x44\x21\x3b\x44\xaa\xd2\x6a\x24\xb8\xf8\x78\x01\x21\x3e\x4e\xcf\xf0\x28\xfe\xe9\x34\x3e" +
|
||||
"\x7e\xec\xee\xba\x1a\xdf\x5d\xf0\xd1\x17\x66\xe9\xf3\xbd\xb9\xf3\xbe\x9d\x93\xc6\x97\x63\x8b\x93\x3e\x9c\x0d\x9f" +
|
||||
"\x9c\x8b\x74\xb9\x83\x82\x43\xf6\xff\xef\x29\xc5\x86\xdc\x7e\x59\xbf\x03\x00\x00\xff\xff\x1c\x3b\xdb\x6c\xcc\x04" +
|
||||
"\x00\x00")
|
||||
|
||||
func frontendAppCoffeeBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_frontendAppCoffee,
|
||||
"frontend/app.coffee",
|
||||
)
|
||||
}
|
||||
|
||||
func frontendAppCoffee() (*asset, error) {
|
||||
bytes, err := frontendAppCoffeeBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "frontend/app.coffee", size: 1228, md5checksum: "", mode: os.FileMode(436), modTime: time.Unix(1, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _frontendAppJs = []byte(
|
||||
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x54\x4d\x6f\x32\x37\x10\xbe\xf3\x2b\xe6\x10\xc9\x5e\x75\x63\x42\x9b" +
|
||||
"\x13\x68\x0f\x55\x42\x12\xa4\x40\x2a\x42\x6e\x55\x23\xb3\x9e\xdd\x75\xbb\xd8\xc8\x36\x81\xa8\xe2\xbf\x57\xf6\x7e" +
|
||||
"\xb0\x0b\x49\xdf\xf7\x66\xcf\xc7\x33\xf3\x78\x1e\xcf\x70\x08\x8f\xa8\xd0\x70\x87\x02\xd6\x9f\x70\xa7\xb3\x0c\xf1" +
|
||||
"\x35\x35\x72\xeb\x60\xc4\x46\xbf\xb2\xdb\x01\xcd\x76\x2a\x75\x52\x2b\x1a\xc1\xbf\x03\x80\x0f\x6e\x60\xfe\xfa\xf8" +
|
||||
"\xfe\x38\x5d\x4c\x97\xb3\xbb\xf7\xe9\x72\x19\x07\xc3\xe2\x65\xf5\xfe\xf0\xf2\xb6\xb8\x3f\x5d\xff\x98\x2e\xe7\xb3" +
|
||||
"\xd5\x6a\x7a\x1f\x03\x6e\xd6\x28\x1e\x64\x89\x33\x95\xe9\x18\x32\x59\xe2\xdb\xf2\x39\x86\x82\x2b\x51\xe2\xd4\x7b" +
|
||||
"\xdb\x8b\x31\xda\xf4\x2e\x73\xb4\x96\xe7\xe8\x6d\xb6\x78\xd6\x5c\x4c\x06\x03\x68\x30\x20\x81\x0f\x2d\x05\xdc\x04" +
|
||||
"\x63\xaf\x13\x48\x80\xf8\x9a\xa0\xb4\x83\x4c\xef\x94\x20\xbd\xa0\xb6\x3f\x1f\xb8\xd0\x0e\x78\x59\xea\x3d\x0a\x70" +
|
||||
"\x1a\x78\x9a\xa2\xb5\xa1\xc8\x29\xa9\x43\xda\xa7\xbc\xea\x0d\xba\x42\xaa\x1c\xf6\xa8\x1c\xec\x8d\x56\x79\x15\x7c" +
|
||||
"\x75\xfe\x6c\xde\xb4\x97\x4a\xe8\x7d\xc4\xd6\x52\x09\x4a\x3c\x97\xb4\xe0\x2a\x47\x72\x22\x16\x4d\x42\xac\x41\xb7" +
|
||||
"\x33\xaa\xb5\xd2\x60\x3e\x46\x01\xba\x31\x42\x02\x17\x35\xfc\x70\x7c\xc7\x15\x8a\x3f\x41\x02\x55\x59\x56\xea\x94" +
|
||||
"\xfb\x60\xe6\x01\x98\xdd\xad\xad\x33\x52\xe5\x74\xd4\xaf\xd9\x1b\x14\xf5\x10\x55\xf1\x50\xbb\xe7\xec\x36\x10\xe2" +
|
||||
"\xea\x26\x64\x06\xb4\x2a\x9d\x24\x40\x48\x63\xee\xb0\x3a\x1f\x2c\xed\x4d\xad\xee\xe7\xd8\x72\xa8\x86\x7c\xe2\x55" +
|
||||
"\xe3\x5c\x31\xfe\x37\x3f\x84\x52\x71\x5b\xc3\x0f\x44\x8b\x31\x90\xa7\xe9\xef\xf7\x24\xae\xad\x76\x17\xa6\x39\xee" +
|
||||
"\xc9\xad\xf6\xa1\x6f\x64\xdc\xed\xaa\x2a\xdf\xa1\xdd\xc9\xea\x92\x16\xdc\xf1\x18\xac\xe3\x6e\x67\x63\x38\x14\xa6" +
|
||||
"\x3b\x06\xf7\xb9\xad\xdb\xf5\x27\x48\xbc\x9f\xe5\xe8\x96\x68\xb7\x5a\x59\x7c\x42\x2e\xd0\x50\x72\xa7\x95\x43\xe5" +
|
||||
"\xae\x57\x9f\x5b\x24\x35\xf5\x54\x2b\xab\x4b\x64\xa5\xce\x69\xfd\x00\xb5\xe7\x8a\x12\x66\x0b\xbd\xbf\x2e\x35\x17" +
|
||||
"\x52\xe5\x24\x62\x85\x14\x48\x3b\x6e\x9f\x50\x4a\xf5\xcf\x75\x61\x30\x23\x11\xe3\xce\x19\x4a\xc2\xa5\xfd\x77\x5f" +
|
||||
"\x85\x5b\x93\xb6\xd1\xfe\xfc\x5d\xb0\xe2\x1b\x24\x11\x73\x78\x70\x4d\x73\x1d\x35\x35\x96\x92\x5b\x37\x53\x02\x0f" +
|
||||
"\x2f\x19\x25\x43\x12\xc1\x2f\x30\x8a\x6a\x24\x2f\x10\xff\x28\x6c\xc3\x5d\x5a\xd0\xe1\x5f\x72\xc3\x73\xfc\x73\x38" +
|
||||
"\x8c\x4e\x5a\x69\x89\x06\x1f\x89\xc2\xa5\xa1\xd9\x48\xa0\x2b\x94\x0b\xd0\x0f\x29\x50\x7f\x03\x1a\x7c\x3f\x01\xda" +
|
||||
"\x28\xad\xc9\xcb\xfd\xb6\x94\x69\x2f\xb3\x27\x11\x2f\x9f\xae\x44\x0e\x85\x69\x14\xd2\x15\xc7\xa6\xd2\x7d\x55\xaa" +
|
||||
"\xbe\x40\x02\x97\x4b\x03\xc0\xee\xa5\x4b\x0b\xf0\x48\xac\x0f\x14\x94\xc2\x2d\xc2\xed\xcd\xed\xb8\xb5\xb4\x4d\xf7" +
|
||||
"\xfe\xd4\xe4\x3c\xe3\xb7\xff\xc9\x68\xd7\xe2\x29\x4b\x60\xc6\x77\xa5\xfb\x26\xa9\xb3\x16\x9b\x94\x63\xfd\x89\xe8" +
|
||||
"\xf9\x46\xbb\xf8\xfb\x35\xfd\xaf\xdf\x72\xde\xbe\x4d\xfb\x34\x4d\x7c\xbb\x56\x09\x0b\x5f\xb8\xd1\x64\x17\xef\x87" +
|
||||
"\x1f\xe6\x7c\xc0\x0d\x52\x7f\xbc\xc7\x88\xa5\xbc\x2c\xa9\x2b\xa4\x8d\x26\x83\xff\x02\x00\x00\xff\xff\x53\x89\x65" +
|
||||
"\xf1\x37\x07\x00\x00")
|
||||
|
||||
func frontendAppJsBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_frontendAppJs,
|
||||
"frontend/app.js",
|
||||
)
|
||||
}
|
||||
|
||||
func frontendAppJs() (*asset, error) {
|
||||
bytes, err := frontendAppJsBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "frontend/app.js", size: 1847, md5checksum: "", mode: os.FileMode(436), modTime: time.Unix(1, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _frontendIndexHtml = []byte(
|
||||
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xbc\x58\xeb\x53\xdb\xb8\x16\xff\xde\xbf\xe2\xd4\xfb\x61\x77\xdb\xda\xce" +
|
||||
"\x03\x08\xa1\x4e\xe6\x52\xc8\xa5\x50\x1e\xe5\x51\x0a\xec\xec\x07\xd9\x3a\xb6\x05\xb2\xe4\x4a\xb2\x13\xb3\x73\xff" +
|
||||
"\xf7\x3b\x72\xe2\x90\x64\x59\x9a\xde\xdd\xb9\xcc\x30\x46\xf2\x79\xfd\x8e\x7e\x3a\xe7\x98\xe0\xf5\xfe\xd9\xde\xd5" +
|
||||
"\xed\xe7\x11\xa4\x26\xe3\xc3\x57\x81\x7d\x00\x27\x22\x19\x38\x28\x9c\xe1\x2b\x80\x20\x45\x42\xed\x1f\x00\x41\x86" +
|
||||
"\x86\x40\x94\x12\xa5\xd1\x0c\x9c\xc2\xc4\xee\xb6\xb3\xf8\x2a\x35\x26\x77\xf1\x5b\xc1\xca\x81\x73\xe3\x7e\xd9\x75" +
|
||||
"\xf7\x64\x96\x13\xc3\x42\x8e\x0e\x44\x52\x18\x14\x66\xe0\x1c\x8e\x06\x48\x13\x5c\xd2\x14\x24\xc3\x81\x53\x32\x1c" +
|
||||
"\xe7\x52\x99\x05\xe1\x31\xa3\x26\x1d\x50\x2c\x59\x84\x6e\xbd\x78\x07\x4c\x30\xc3\x08\x77\x75\x44\x38\x0e\xda\x8d" +
|
||||
"\xa1\xd7\xae\x0b\x57\x29\x02\x09\x65\x89\xd0\x85\xda\xb0\x21\x89\x86\x37\x59\xa1\xcd\x1b\x88\x64\x86\x10\x33\xa5" +
|
||||
"\x0d\x30\x01\x26\x45\xb0\xd8\xde\x03\x11\x15\x48\x93\xa2\xaa\xd7\x8d\x6f\xb0\x4a\x53\x9d\x37\x24\x36\xa8\xde\x58" +
|
||||
"\x15\x8d\x53\x93\xae\x3b\xf3\x6a\x98\xe1\x38\xbc\x4c\x89\x42\xf8\x17\xf0\xe2\x91\xc5\xa8\x3c\x26\x03\x7f\xfa\xe6" +
|
||||
"\xd5\x53\x70\x1f\xa4\x34\xda\x28\x92\x3f\x69\x73\x26\x1e\x40\x21\x1f\x38\xda\x54\x1c\x75\x8a\x68\x1c\x48\x15\xc6" +
|
||||
"\x03\xc7\x66\x53\xef\xf8\x7e\x44\xc5\xbd\xf6\x22\x2e\x0b\x1a\x73\xa2\xd0\x8b\x64\xe6\x93\x7b\x32\xf1\x39\x0b\xb5" +
|
||||
"\x6f\xc6\xcc\x18\x54\x6e\xd8\x58\xf7\xbb\x5e\xd7\xeb\xf9\x91\xd6\xfe\x7c\xcf\xcb\x98\xf0\x22\xad\x9d\xda\xed\xf4" +
|
||||
"\x87\x09\x83\x89\x62\xa6\x1a\x38\x3a\x25\x9d\xcd\x2d\xb7\xdf\xde\x1a\x85\x27\x49\xaf\x75\x71\x5e\xf5\x8f\x3f\xb2" +
|
||||
"\x83\x87\x9b\xc7\x83\xed\xf4\x32\xe9\x8f\xe8\x69\xd5\xef\x1d\x90\xc7\xd3\x03\x9f\xb0\xdb\xf6\x78\xe0\x40\xa4\xa4" +
|
||||
"\xd6\x52\xb1\x84\x89\x81\x43\x84\x14\x55\x26\x0b\xed\x80\xff\xcf\x61\xab\xe3\x1f\x13\x13\xa5\x33\x50\x94\xa8\x07" +
|
||||
"\x5e\x3d\x83\x0b\x5e\x04\x66\x62\xd1\xc7\x4f\xed\xfc\x68\x7b\xef\x51\x4d\x46\xb7\xfe\x4d\x7f\x63\xfb\xfa\xf3\x4d" +
|
||||
"\x5f\x93\x49\xd4\xd5\xa7\xea\x31\xad\xbe\x6c\x1e\xde\xbc\xbd\x4d\x5e\x06\xf6\x8f\x21\x8b\xa5\x30\x2e\x19\xa3\x96" +
|
||||
"\x19\xfa\x1b\x5e\xcf\x6b\xd5\x07\xb6\xb8\xbd\xde\x99\xe1\x9d\x52\x47\xd1\x78\x3f\xf2\xbb\xc5\x7e\xaa\xa9\xd9\x6a" +
|
||||
"\xeb\xe3\x8e\x3c\xfb\x70\xdb\xdd\xea\x7c\x3b\xe9\x72\x29\xda\x49\x35\x9a\x3c\x1c\xb7\xd6\x81\x56\x03\x1a\xce\x3c" +
|
||||
"\xa6\x6d\xf8\x03\x0c\x4e\x8c\x4b\x38\x4b\xc4\x0e\x44\x28\x0c\xaa\xf7\x50\x87\xa9\xd9\x23\xee\x40\x6f\x33\x9f\xbc" +
|
||||
"\x87\xff\x34\x1a\x9d\xef\x6b\x74\x36\x16\x35\x3c\x7b\xdd\x08\x13\xa8\xe0\x0f\xc8\x88\x4a\x98\x70\x8d\xcc\x77\xa0" +
|
||||
"\xdb\x5a\x12\xd3\xa9\x1c\xbb\x09\x0a\x54\x2c\x7a\x37\x5b\xb2\x8c\x24\xd8\x2c\x4a\x46\x51\x36\x0b\x54\x4a\x5a\x83" +
|
||||
"\x94\xe9\x9c\x93\x6a\x07\x84\x14\xb8\x60\x8d\x65\x89\xab\x50\xe7\x52\x68\x56\xe2\xdc\xf3\x0e\xb4\x80\x14\x46\x36" +
|
||||
"\x92\x81\x3f\xcb\xc7\xd3\x25\xfe\x78\x75\x72\xbc\x09\x3a\x65\x19\x10\x41\xe1\xa2\x36\x42\xbd\x7b\x0d\xb1\x54\x70" +
|
||||
"\x38\xda\x06\x5d\xe4\xb6\x88\x81\x8c\x67\xc2\xc8\x31\x43\x61\x74\xad\x90\x21\x65\x04\xbe\x15\xa8\x18\x2e\x94\x11" +
|
||||
"\x6b\xfa\xeb\xee\xc5\xe9\xe1\xe9\xc1\xce\xa2\x51\x2a\x51\x8b\x9f\x0d\x8c\xa5\x7a\x00\x16\x43\x25\x0b\xb0\x65\xb2" +
|
||||
"\x2e\x5f\x39\x49\x10\x4a\x46\x20\x66\x1c\x77\x7c\x7f\xc9\xdc\x6f\x2c\x06\x6e\xe0\x70\x04\xfd\xdf\x9b\x03\x0d\x74" +
|
||||
"\xa4\x58\x6e\x40\xab\x68\x6d\xa6\xda\x96\xb0\xa9\x53\x56\xfa\x5d\xaf\xe7\x75\x9f\xd6\x35\x3f\xef\x97\xe8\xf9\x3c" +
|
||||
"\x45\xbb\x47\x95\x7f\x10\x5e\x1e\xab\xa4\x25\xfb\xd5\xe6\xdd\xa6\x68\x17\xe3\xd6\xb7\xc9\xdd\x68\xef\x63\x6f\x6f" +
|
||||
"\xeb\xec\x3c\xbf\xfe\x90\x9c\xfe\xfb\x96\xb4\x5e\xb8\x7d\xc3\xc0\x9f\x06\xff\x77\xb0\xa8\x79\x62\xfd\xb6\xb7\xe1" +
|
||||
"\x75\xe6\x1b\xeb\x42\x49\xb6\xd8\x6e\x5c\xde\xe5\x6f\xc5\xfe\x79\xe7\x8a\x5e\x5d\xf8\xd7\xd7\x9f\x8e\xe2\x6e\x78" +
|
||||
"\xa0\xe4\x46\x11\x6e\xc6\xe5\xd7\xcb\xaf\xd7\x17\xac\x73\x3a\x5a\x1b\x4a\xf0\xfa\x37\x14\x94\xc5\xbf\x4f\x4f\x2f" +
|
||||
"\xf0\x9b\x8e\x1b\x84\x92\x56\x33\x19\x41\x4a\x88\x38\xd1\x7a\xe0\x08\x52\x86\x44\xc1\xf4\xe1\x52\x8c\x49\xc1\x8d" +
|
||||
"\x33\x4f\x0b\x65\x73\xc9\xf9\xd5\x72\x63\x5e\x30\x3a\x97\x69\xfa\x91\xb2\x84\xb4\xbf\x46\x26\x09\x47\x48\xd0\x40" +
|
||||
"\xa2\x64\x91\x23\xad\xd9\x1c\xa2\xed\x2c\x90\xc9\x90\x71\x6c\xee\xd2\x9c\x64\xab\xde\x66\x01\xd9\xe8\x51\x2d\xf8" +
|
||||
"\xb2\x40\x0a\x63\xa4\x00\x53\xe5\x38\x70\xa6\x0b\x67\x45\x6d\x16\x42\x24\x39\x27\xb9\x46\xea\x00\x25\x86\xcc\xb6" +
|
||||
"\x2d\x94\xe9\x7e\xb3\x4d\x54\x62\x67\x90\x9f\x42\xed\xe2\x84\x64\x39\x47\x77\x66\xa8\x91\x74\xdb\x0e\x10\xc5\x88" +
|
||||
"\x8b\x93\x9c\x08\x8a\x74\xe0\xc4\x84\x6b\x5c\x8a\xcc\xd2\x28\x27\xa2\x89\x45\x2b\x57\x0a\x5e\x39\xc3\xab\x69\x34" +
|
||||
"\x82\x94\x2c\x21\x86\x49\x11\xf8\x56\xee\x05\x55\x16\x49\xe1\x86\x44\xd5\xa7\xfb\x7f\x11\x0d\xfc\x69\x26\x97\xf6" +
|
||||
"\xc8\x4a\x5a\x43\x7b\xc6\x4d\x6f\xfa\xc9\x19\x06\xac\x11\x88\x09\xc4\xc4\xd5\x76\x70\x99\x25\x2a\x65\x94\xa2\x18" +
|
||||
"\x38\x46\x15\x68\x1d\xb2\x45\xcb\xcf\x4d\x38\x64\x81\x08\x3e\x65\xe5\xac\x4e\x36\xab\x9a\x64\xbe\xb7\xc2\xc2\xa7" +
|
||||
"\x22\xe5\x0b\x52\x0e\x61\x56\x5b\x9f\xa3\x2d\xd4\xb5\x9c\x4b\x42\x99\x48\x9e\x18\x9e\xb6\x17\xfc\xae\xe2\xc9\x99" +
|
||||
"\xb0\x9a\x31\x71\xf3\xc2\x9e\xf6\x77\xa0\x05\x7e\x63\x6d\x11\xc1\x0b\xd1\xcc\x5a\xd0\x7a\xd1\xd4\x85\xc8\xa5\x72" +
|
||||
"\x2c\x2c\x88\xf5\x63\xb1\x66\x3b\xc3\x80\xcc\xcf\x6d\x6e\x96\x71\xb4\xd3\x87\x6b\x5f\xd4\x65\xdf\x4e\xce\xce\xb0" +
|
||||
"\x10\xf5\xb4\x49\xed\x99\x04\x7e\xda\xf9\x21\x48\x75\x1b\x7d\x02\xf4\x1d\xaf\x8b\x55\x84\x65\xc9\xb4\xfe\xce\x45" +
|
||||
"\x57\x1a\xeb\x5c\x53\xab\x85\x94\x35\xc4\x59\x33\xbe\xba\xb3\x3f\x5b\xe0\x30\x0b\x91\x2e\xfa\x5b\xdd\x70\xdb\x5b" +
|
||||
"\x61\xd5\x5f\x0c\xb9\x36\x56\xcf\xf8\x4a\x72\xbd\x74\x77\xb4\x2c\x54\x84\x2b\x80\x9e\x45\x60\x43\xaf\x0d\x0d\x97" +
|
||||
"\x08\xff\x23\xa0\xea\x09\x65\x3d\x16\xe1\x24\xe2\x24\xab\xcb\x90\x1b\x31\x15\xf1\x1f\x60\x75\xcd\xa4\x79\xba\xa6" +
|
||||
"\x3e\xff\x82\x20\xf6\xb6\xde\x9f\x17\xa8\x2a\xf8\x45\x60\x84\x5a\x13\x55\xd5\x7d\x60\xfe\xe1\xf2\xb3\x86\x23\x52" +
|
||||
"\x92\xcb\x69\xe7\xcd\x79\x91\x30\xa1\x7f\x7d\xba\xd1\xff\x43\x4b\xbe\xb7\xa3\x50\xe5\xb7\xbd\x76\xc7\xdb\x98\xad" +
|
||||
"\x9e\x6d\xc7\x7f\x6e\xc6\x77\x52\x8f\xc2\x8b\xe3\xf0\xf4\xfc\xf1\x38\x17\x9f\x0e\x1f\x46\x54\x7d\x2e\x7b\xfc\xac" +
|
||||
"\xea\xef\x75\x7a\xe9\xc7\xf3\xb7\x37\xf9\x36\xd9\x38\x99\xec\x9e\xff\x40\x33\x76\x5d\x38\x14\x11\x2f\x28\x02\xe1" +
|
||||
"\xdc\x7e\x00\xe6\x8c\x23\x6d\xd0\xc2\x2f\x21\x72\x39\xfe\xf5\x1d\x48\x05\x6c\x26\xc8\x04\x65\x25\xa3\x05\xe1\x35" +
|
||||
"\xe3\x35\x10\x0d\x02\x91\x22\xfd\x5b\xb9\xf9\xab\x4f\xbb\xfb\xd5\x2f\xbb\xef\xe7\xea\xcb\xe6\xdd\x08\x3f\xc5\x07" +
|
||||
"\xa7\x67\xf7\xa4\xd5\xea\x9d\x9c\xec\x77\x6f\x3f\x1c\xb6\x76\xbb\x67\x97\x77\x67\xe7\x21\x1e\x6c\x3d\x76\xe2\xce" +
|
||||
"\x6d\x2b\x2d\xb6\xd7\xca\xd5\x9f\x31\x91\x3c\xb7\x71\x2c\xe5\x33\xf0\xa7\x23\x4c\xe0\x4f\xff\xbf\xf0\xea\xbf\x01" +
|
||||
"\x00\x00\xff\xff\xe7\xf3\xc7\x89\x71\x10\x00\x00")
|
||||
|
||||
func frontendIndexHtmlBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_frontendIndexHtml,
|
||||
"frontend/index.html",
|
||||
)
|
||||
}
|
||||
|
||||
func frontendIndexHtml() (*asset, error) {
|
||||
bytes, err := frontendIndexHtmlBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "frontend/index.html", size: 4209, md5checksum: "", mode: os.FileMode(436), modTime: time.Unix(1, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
//
|
||||
// Asset loads and returns the asset for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
//
|
||||
func Asset(name string) ([]byte, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
|
@ -260,9 +95,11 @@ func Asset(name string) ([]byte, error) {
|
|||
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
|
||||
}
|
||||
|
||||
//
|
||||
// MustAsset is like Asset but panics when Asset would return an error.
|
||||
// It simplifies safe initialization of global variables.
|
||||
// nolint: deadcode
|
||||
//
|
||||
func MustAsset(name string) []byte {
|
||||
a, err := Asset(name)
|
||||
if err != nil {
|
||||
|
@ -272,9 +109,10 @@ func MustAsset(name string) []byte {
|
|||
return a
|
||||
}
|
||||
|
||||
//
|
||||
// AssetInfo loads and returns the asset info for the given name.
|
||||
// It returns an error if the asset could not be found or
|
||||
// could not be loaded.
|
||||
// It returns an error if the asset could not be found or could not be loaded.
|
||||
//
|
||||
func AssetInfo(name string) (os.FileInfo, error) {
|
||||
cannonicalName := strings.Replace(name, "\\", "/", -1)
|
||||
if f, ok := _bindata[cannonicalName]; ok {
|
||||
|
@ -287,8 +125,10 @@ func AssetInfo(name string) (os.FileInfo, error) {
|
|||
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
|
||||
}
|
||||
|
||||
//
|
||||
// AssetNames returns the names of the assets.
|
||||
// nolint: deadcode
|
||||
//
|
||||
func AssetNames() []string {
|
||||
names := make([]string, 0, len(_bindata))
|
||||
for name := range _bindata {
|
||||
|
@ -297,13 +137,13 @@ func AssetNames() []string {
|
|||
return names
|
||||
}
|
||||
|
||||
//
|
||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||
//
|
||||
var _bindata = map[string]func() (*asset, error){
|
||||
"frontend/app.coffee": frontendAppCoffee,
|
||||
"frontend/app.js": frontendAppJs,
|
||||
"frontend/index.html": frontendIndexHtml,
|
||||
}
|
||||
|
||||
//
|
||||
// AssetDir returns the file names below a certain
|
||||
// directory embedded in the file by go-bindata.
|
||||
// For example if you run go-bindata on data/... and data contains the
|
||||
|
@ -317,6 +157,7 @@ var _bindata = map[string]func() (*asset, error){
|
|||
// AssetDir("data/img") would return []string{"a.png", "b.png"}
|
||||
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
|
||||
// AssetDir("") will return []string{"data"}.
|
||||
//
|
||||
func AssetDir(name string) ([]string, error) {
|
||||
node := _bintree
|
||||
if len(name) != 0 {
|
||||
|
@ -325,12 +166,20 @@ func AssetDir(name string) ([]string, error) {
|
|||
for _, p := range pathList {
|
||||
node = node.Children[p]
|
||||
if node == nil {
|
||||
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
|
||||
return nil, &os.PathError{
|
||||
Op: "open",
|
||||
Path: name,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if node.Func != nil {
|
||||
return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
|
||||
return nil, &os.PathError{
|
||||
Op: "open",
|
||||
Path: name,
|
||||
Err: os.ErrNotExist,
|
||||
}
|
||||
}
|
||||
rv := make([]string, 0, len(node.Children))
|
||||
for childName := range node.Children {
|
||||
|
@ -339,18 +188,13 @@ func AssetDir(name string) ([]string, error) {
|
|||
return rv, nil
|
||||
}
|
||||
|
||||
|
||||
type bintree struct {
|
||||
Func func() (*asset, error)
|
||||
Children map[string]*bintree
|
||||
}
|
||||
|
||||
var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"frontend": {nil, map[string]*bintree{
|
||||
"app.coffee": {frontendAppCoffee, map[string]*bintree{}},
|
||||
"app.js": {frontendAppJs, map[string]*bintree{}},
|
||||
"index.html": {frontendIndexHtml, map[string]*bintree{}},
|
||||
}},
|
||||
}}
|
||||
var _bintree = &bintree{Func: nil, Children: map[string]*bintree{}}
|
||||
|
||||
// RestoreAsset restores an asset under the given directory
|
||||
func RestoreAsset(dir, name string) error {
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
fileURL = undefined
|
||||
|
||||
MSG_NOT_FOUND = 'File not found'
|
||||
MSG_NOT_PERMITTED = 'Not allowed to access file'
|
||||
MSG_GENERIC_ERR = 'Something went wrong'
|
||||
|
||||
$ ->
|
||||
$(window).bind 'hashchange', hashLoad
|
||||
hashLoad()
|
||||
|
||||
hashLoad = ->
|
||||
file = window.location.hash.substring(1)
|
||||
embedFileInfo(file)
|
||||
|
||||
embedFileInfo = (file) ->
|
||||
if file == ''
|
||||
return handleErrorMessage MSG_NOT_FOUND
|
||||
|
||||
fileURL = file
|
||||
$.ajax file,
|
||||
method: 'HEAD'
|
||||
success: handleEmbed
|
||||
error: handleError
|
||||
|
||||
handleEmbed = (data, status, xhr) ->
|
||||
type = xhr.getResponseHeader 'Content-Type'
|
||||
|
||||
console.log fileURL
|
||||
|
||||
$('.show-loading').hide()
|
||||
$('.filelink-href').attr 'href', fileURL
|
||||
$('.filelink-src').attr 'src', fileURL
|
||||
$('.filename').text fileURL.substring(fileURL.lastIndexOf('/') + 1)
|
||||
|
||||
if type.match /^image\//
|
||||
$('.show-image').show()
|
||||
return
|
||||
|
||||
if type.match /^video\//
|
||||
$('.show-video').show()
|
||||
return
|
||||
|
||||
$('.show-generic').show()
|
||||
|
||||
handleError = (xhr, status) ->
|
||||
message = switch xhr.status
|
||||
when 404 then MSG_NOT_FOUND
|
||||
when 403 then MSG_NOT_PERMITTED
|
||||
else MSG_GENERIC_ERR
|
||||
|
||||
handleErrorMessage message
|
||||
|
||||
handleErrorMessage = (message) ->
|
||||
$('.error').text message
|
||||
$('.show-loading').hide()
|
||||
$('.show-error').show()
|
120
frontend/app.js
120
frontend/app.js
|
@ -1,76 +1,86 @@
|
|||
// Generated by CoffeeScript 1.12.4
|
||||
(function() {
|
||||
var MSG_GENERIC_ERR, MSG_NOT_FOUND, MSG_NOT_PERMITTED, embedFileInfo, fileURL, handleEmbed, handleError, handleErrorMessage, hashLoad;
|
||||
let fileURL = null;
|
||||
const MSG_NOT_FOUND = 'File not found';
|
||||
const MSG_NOT_PERMITTED = 'Not allowed to access file';
|
||||
const MSG_GENERIC_ERR = 'Something went wrong';
|
||||
|
||||
fileURL = void 0;
|
||||
/* global $:false */
|
||||
|
||||
MSG_NOT_FOUND = 'File not found';
|
||||
class Share {
|
||||
init() {
|
||||
$(window).bind('hashchange', this.hashLoad);
|
||||
this.hashLoad();
|
||||
}
|
||||
|
||||
MSG_NOT_PERMITTED = 'Not allowed to access file';
|
||||
|
||||
MSG_GENERIC_ERR = 'Something went wrong';
|
||||
|
||||
$(function() {
|
||||
$(window).bind('hashchange', hashLoad);
|
||||
return hashLoad();
|
||||
});
|
||||
|
||||
hashLoad = function() {
|
||||
var file;
|
||||
file = window.location.hash.substring(1);
|
||||
return embedFileInfo(file);
|
||||
};
|
||||
|
||||
embedFileInfo = function(file) {
|
||||
embedFileInfo(file = '') {
|
||||
if (file === '') {
|
||||
return handleErrorMessage(MSG_NOT_FOUND);
|
||||
this.handleErrorMessage(MSG_NOT_FOUND);
|
||||
}
|
||||
fileURL = file;
|
||||
return $.ajax(file, {
|
||||
method: 'HEAD',
|
||||
success: handleEmbed,
|
||||
error: handleError
|
||||
});
|
||||
};
|
||||
|
||||
handleEmbed = function(data, status, xhr) {
|
||||
var type;
|
||||
type = xhr.getResponseHeader('Content-Type');
|
||||
console.log(fileURL);
|
||||
fileURL = file;
|
||||
$.ajax(file, {
|
||||
method: 'HEAD',
|
||||
success: (data, status, xhr) => {
|
||||
this.handleEmbed(data, status, xhr);
|
||||
},
|
||||
error: (xhr, status) => {
|
||||
this.handleError(xhr, status);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
handleEmbed(data, status, xhr) {
|
||||
let type = xhr.getResponseHeader('Content-Type');
|
||||
|
||||
$('.show-loading').hide();
|
||||
$('.filelink-href').attr('href', fileURL);
|
||||
$('.filelink-src').attr('src', fileURL);
|
||||
$('.filename').text(fileURL.substring(fileURL.lastIndexOf('/') + 1));
|
||||
|
||||
if (type.match(/^image\//)) {
|
||||
$('.filelink-src').attr('src', fileURL);
|
||||
$('.show-image').show();
|
||||
return;
|
||||
}
|
||||
if (type.match(/^video\//)) {
|
||||
let src = $('<source>');
|
||||
src.attr('src', fileURL);
|
||||
src.appendTo($('video'));
|
||||
$('.show-video').show();
|
||||
return;
|
||||
}
|
||||
return $('.show-generic').show();
|
||||
};
|
||||
|
||||
handleError = function(xhr, status) {
|
||||
var message;
|
||||
message = (function() {
|
||||
switch (xhr.status) {
|
||||
case 404:
|
||||
return MSG_NOT_FOUND;
|
||||
case 403:
|
||||
return MSG_NOT_PERMITTED;
|
||||
default:
|
||||
return MSG_GENERIC_ERR;
|
||||
}
|
||||
})();
|
||||
return handleErrorMessage(message);
|
||||
};
|
||||
$('.filelink-href').attr('href', fileURL);
|
||||
$('.show-generic').show();
|
||||
}
|
||||
|
||||
handleErrorMessage = function(message) {
|
||||
handleError(xhr, status) {
|
||||
let message = '';
|
||||
switch (xhr.status) {
|
||||
case 404:
|
||||
message = MSG_NOT_FOUND;
|
||||
break;
|
||||
case 403:
|
||||
message = MSG_NOT_PERMITTED;
|
||||
break;
|
||||
default:
|
||||
message = MSG_GENERIC_ERR;
|
||||
break;
|
||||
}
|
||||
|
||||
this.handleErrorMessage(message);
|
||||
}
|
||||
|
||||
handleErrorMessage(message) {
|
||||
$('.error').text(message);
|
||||
$('.show-loading').hide();
|
||||
return $('.show-error').show();
|
||||
};
|
||||
$('.show-error').show();
|
||||
}
|
||||
|
||||
}).call(this);
|
||||
hashLoad() {
|
||||
let file = window.location.hash.substring(1);
|
||||
this.embedFileInfo(file);
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
let share = new Share();
|
||||
share.init();
|
||||
});
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
h2 { text-align: center; font-size: 24px; }
|
||||
.container { margin-top: 30px; }
|
||||
.show-generic, .show-image, .show-video, .show-error { display: none; }
|
||||
.img-responsive { margin: 0 auto; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -44,16 +43,15 @@
|
|||
<h2><a href="#" class="filelink-href filename">untitled</a></h2>
|
||||
</div>
|
||||
|
||||
<div class="container show-image">
|
||||
<div class="container show-image text-center">
|
||||
<a href="#" class="filelink-href">
|
||||
<img src="" class="img-responsive filelink-src">
|
||||
<img src="" class="img-fluid filelink-src">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="container show-video">
|
||||
<div class="embed-responsive embed-responsive-16by9">
|
||||
<video controls>
|
||||
<source src="" class="filelink-src">
|
||||
</video>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue