Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d8c756233 | ||
|
|
d5f0471ab7 | ||
|
|
f7aaae3f63 | ||
|
|
2515819026 | ||
|
|
7ad727d27d | ||
|
|
adbff03274 | ||
|
|
6b8a65382f |
No files matched your search
@@ -131,18 +131,21 @@ p code {
|
|||||||
display: flex;
|
display: flex;
|
||||||
color: rgb(84, 110, 122);
|
color: rgb(84, 110, 122);
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
padding: 0 0 1em;
|
|
||||||
margin: 0 0 1em;
|
margin: 0 0 1em;
|
||||||
font-size: .8em;
|
font-size: .8em;
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
text-align: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard #nav li {
|
.dashboard #nav li {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
padding: 0 0 1em;
|
||||||
|
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard #nav li:last-child {
|
.dashboard #nav li.active {
|
||||||
text-align: right
|
border-color: #2196f3
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard #nav i {
|
.dashboard #nav i {
|
||||||
|
|||||||
@@ -1,16 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dashboard">
|
<div class="dashboard">
|
||||||
<ul id="nav">
|
<ul id="nav">
|
||||||
<li>
|
<li><router-link to="/settings/profile">{{ $t('settings.profileSettings') }}</router-link></li>
|
||||||
<router-link to="/settings/profile">
|
<li class="active"><router-link to="/settings/global">{{ $t('settings.globalSettings') }}</router-link></li>
|
||||||
<i class="material-icons">keyboard_arrow_left</i> {{ $t('settings.profileSettings') }}
|
<li><router-link to="/users">{{ $t('settings.userManagement') }}</router-link></li>
|
||||||
</router-link>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<router-link to="/users">
|
|
||||||
{{ $t('settings.userManagement') }} <i class="material-icons">keyboard_arrow_right</i>
|
|
||||||
</router-link>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h1>{{ $t('settings.globalSettings') }}</h1>
|
<h1>{{ $t('settings.globalSettings') }}</h1>
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dashboard">
|
<div class="dashboard">
|
||||||
<ul id="nav" v-if="user.admin">
|
<ul id="nav" v-if="user.admin">
|
||||||
<li>
|
<li class="active"><router-link to="/settings/profile">{{ $t('settings.profileSettings') }}</router-link></li>
|
||||||
<router-link to="/settings/global">
|
<li><router-link to="/settings/global">{{ $t('settings.globalSettings') }}</router-link></li>
|
||||||
{{ $t('settings.globalSettings') }} <i class="material-icons">keyboard_arrow_right</i>
|
<li><router-link to="/users">{{ $t('settings.userManagement') }}</router-link></li>
|
||||||
</router-link>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h1>{{ $t('settings.profileSettings') }}</h1>
|
<h1>{{ $t('settings.profileSettings') }}</h1>
|
||||||
|
|||||||
@@ -2,12 +2,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<form @submit="save" class="dashboard">
|
<form @submit="save" class="dashboard">
|
||||||
<ul id="nav">
|
<ul id="nav">
|
||||||
<li>
|
<li><router-link to="/settings/profile">{{ $t('settings.profileSettings') }}</router-link></li>
|
||||||
<router-link to="/users">
|
<li><router-link to="/settings/global">{{ $t('settings.globalSettings') }}</router-link></li>
|
||||||
<i class="material-icons">keyboard_arrow_left</i> {{ $t('settings.userManagement') }}
|
<li><router-link to="/users">{{ $t('settings.userManagement') }}</router-link></li>
|
||||||
</router-link>
|
|
||||||
</li>
|
|
||||||
<li></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h1 v-if="id === 0">{{ $t('settings.newUser') }}</h1>
|
<h1 v-if="id === 0">{{ $t('settings.newUser') }}</h1>
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="dashboard">
|
<div class="dashboard">
|
||||||
<ul id="nav">
|
<ul id="nav">
|
||||||
<li>
|
<li><router-link to="/settings/profile">{{ $t('settings.profileSettings') }}</router-link></li>
|
||||||
<router-link to="/settings/global">
|
<li><router-link to="/settings/global">{{ $t('settings.globalSettings') }}</router-link></li>
|
||||||
<i class="material-icons">keyboard_arrow_left</i> {{ $t('settings.globalSettings') }}
|
<li class="active"><router-link to="/users">{{ $t('settings.userManagement') }}</router-link></li>
|
||||||
</router-link>
|
|
||||||
</li>
|
|
||||||
<li></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h1>{{ $t('settings.users') }} <router-link to="/users/new"><button>{{ $t('buttons.new') }}</button></router-link></h1>
|
<h1>{{ $t('settings.users') }} <router-link to="/users/new"><button>{{ $t('buttons.new') }}</button></router-link></h1>
|
||||||
@@ -19,7 +16,7 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr v-for="user in users">
|
<tr v-for="user in users" :key="user.id">
|
||||||
<td>{{ user.username }}</td>
|
<td>{{ user.username }}</td>
|
||||||
<td><i v-if="user.admin" class="material-icons">done</i><i v-else class="material-icons">close</i></td>
|
<td><i v-if="user.admin" class="material-icons">done</i><i v-else class="material-icons">close</i></td>
|
||||||
<td>{{ user.filesystem }}</td>
|
<td>{{ user.filesystem }}</td>
|
||||||
|
|||||||
+2
-11
@@ -41,7 +41,6 @@ var (
|
|||||||
allowNew bool
|
allowNew bool
|
||||||
allowPublish bool
|
allowPublish bool
|
||||||
showVer bool
|
showVer bool
|
||||||
version = "master"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -53,7 +52,7 @@ func init() {
|
|||||||
flag.StringVarP(&scope, "scope", "s", ".", "Default scope option for new users")
|
flag.StringVarP(&scope, "scope", "s", ".", "Default scope option for new users")
|
||||||
flag.StringVarP(&baseurl, "baseurl", "b", "", "Base URL")
|
flag.StringVarP(&baseurl, "baseurl", "b", "", "Base URL")
|
||||||
flag.StringVar(&commands, "commands", "git svn hg", "Default commands option for new users")
|
flag.StringVar(&commands, "commands", "git svn hg", "Default commands option for new users")
|
||||||
flag.StringVarP(&prefixurl, "prefixurl", "p", "", "Prefix URL")
|
flag.StringVar(&prefixurl, "prefixurl", "", "Prefix URL")
|
||||||
flag.BoolVar(&allowCommands, "allow-commands", true, "Default allow commands option for new users")
|
flag.BoolVar(&allowCommands, "allow-commands", true, "Default allow commands option for new users")
|
||||||
flag.BoolVar(&allowEdit, "allow-edit", true, "Default allow edit option for new users")
|
flag.BoolVar(&allowEdit, "allow-edit", true, "Default allow edit option for new users")
|
||||||
flag.BoolVar(&allowPublish, "allow-publish", true, "Default allow publish option for new users")
|
flag.BoolVar(&allowPublish, "allow-publish", true, "Default allow publish option for new users")
|
||||||
@@ -102,15 +101,7 @@ func setupViper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func printVersion() {
|
func printVersion() {
|
||||||
version = strings.TrimSpace(version)
|
fmt.Println("filemanager version", filemanager.Version)
|
||||||
|
|
||||||
if version == "" {
|
|
||||||
fmt.Println("filemanager is at an untracked version")
|
|
||||||
} else {
|
|
||||||
version = strings.TrimPrefix(version, "v")
|
|
||||||
fmt.Println("filemanager version", version)
|
|
||||||
}
|
|
||||||
|
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ import (
|
|||||||
"github.com/robfig/cron"
|
"github.com/robfig/cron"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Version is the current File Manager version.
|
||||||
|
const Version = "1.3.0"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrExist = errors.New("the resource already exists")
|
ErrExist = errors.New("the resource already exists")
|
||||||
ErrNotExist = errors.New("the resource does not exist")
|
ErrNotExist = errors.New("the resource does not exist")
|
||||||
|
|||||||
+23
-27
@@ -6,6 +6,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -53,11 +54,7 @@ func serve(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
|||||||
// Check if this request is made to the service worker. If so,
|
// Check if this request is made to the service worker. If so,
|
||||||
// pass it through a template to add the needed variables.
|
// pass it through a template to add the needed variables.
|
||||||
if r.URL.Path == "/sw.js" {
|
if r.URL.Path == "/sw.js" {
|
||||||
return renderFile(
|
return renderFile(c, w, "sw.js")
|
||||||
c, w,
|
|
||||||
c.Assets.MustString("sw.js"),
|
|
||||||
"application/javascript",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if this request is made to the static assets folder. If so, and
|
// Checks if this request is made to the static assets folder. If so, and
|
||||||
@@ -95,11 +92,7 @@ func serve(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
|||||||
w.Header().Set("x-content-type", "nosniff")
|
w.Header().Set("x-content-type", "nosniff")
|
||||||
w.Header().Set("x-xss-protection", "1; mode=block")
|
w.Header().Set("x-xss-protection", "1; mode=block")
|
||||||
|
|
||||||
return renderFile(
|
return renderFile(c, w, "index.html")
|
||||||
c, w,
|
|
||||||
c.Assets.MustString("index.html"),
|
|
||||||
"text/html",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// staticHandler handles the static assets path.
|
// staticHandler handles the static assets path.
|
||||||
@@ -109,11 +102,7 @@ func staticHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int,
|
|||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return renderFile(
|
return renderFile(c, w, "static/manifest.json")
|
||||||
c, w,
|
|
||||||
c.Assets.MustString("static/manifest.json"),
|
|
||||||
"application/json",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// apiHandler is the main entry point for the /api endpoint.
|
// apiHandler is the main entry point for the /api endpoint.
|
||||||
@@ -219,8 +208,21 @@ func splitURL(path string) (string, string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// renderFile renders a file using a template with some needed variables.
|
// renderFile renders a file using a template with some needed variables.
|
||||||
func renderFile(c *fm.Context, w http.ResponseWriter, file string, contentType string) (int, error) {
|
func renderFile(c *fm.Context, w http.ResponseWriter, file string) (int, error) {
|
||||||
tpl := template.Must(template.New("file").Parse(file))
|
tpl := template.Must(template.New("file").Parse(c.Assets.MustString(file)))
|
||||||
|
|
||||||
|
var contentType string
|
||||||
|
switch filepath.Ext(file) {
|
||||||
|
case ".html":
|
||||||
|
contentType = "text/html"
|
||||||
|
case ".js":
|
||||||
|
contentType = "application/javascript"
|
||||||
|
case ".json":
|
||||||
|
contentType = "application/json"
|
||||||
|
default:
|
||||||
|
contentType = "text"
|
||||||
|
}
|
||||||
|
|
||||||
w.Header().Set("Content-Type", contentType+"; charset=utf-8")
|
w.Header().Set("Content-Type", contentType+"; charset=utf-8")
|
||||||
|
|
||||||
data := map[string]interface{}{
|
data := map[string]interface{}{
|
||||||
@@ -245,11 +247,8 @@ func renderFile(c *fm.Context, w http.ResponseWriter, file string, contentType s
|
|||||||
func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, error) {
|
||||||
s, err := c.Store.Share.Get(r.URL.Path)
|
s, err := c.Store.Share.Get(r.URL.Path)
|
||||||
if err == fm.ErrNotExist {
|
if err == fm.ErrNotExist {
|
||||||
return renderFile(
|
w.WriteHeader(http.StatusNotFound)
|
||||||
c, w,
|
return renderFile(c, w, "static/share/404.html")
|
||||||
c.Assets.MustString("static/share/404.html"),
|
|
||||||
"text/html",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -258,11 +257,8 @@ func sharePage(c *fm.Context, w http.ResponseWriter, r *http.Request) (int, erro
|
|||||||
|
|
||||||
if s.Expires && s.ExpireDate.Before(time.Now()) {
|
if s.Expires && s.ExpireDate.Before(time.Now()) {
|
||||||
c.Store.Share.Delete(s.Hash)
|
c.Store.Share.Delete(s.Hash)
|
||||||
return renderFile(
|
w.WriteHeader(http.StatusNotFound)
|
||||||
c, w,
|
return renderFile(c, w, "static/share/404.html")
|
||||||
c.Assets.MustString("static/share/404.html"),
|
|
||||||
"text/html",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r.URL.Path = s.Path
|
r.URL.Path = s.Path
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ func shareGetHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(s) == 0 {
|
||||||
|
return http.StatusNotFound, nil
|
||||||
|
}
|
||||||
|
|
||||||
return renderJSON(w, s)
|
return renderJSON(w, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Releasing version $1"
|
||||||
|
sed -i "s|(untracked version)|$1|g" filemanager.go
|
||||||
|
|
||||||
|
echo "Building assets"
|
||||||
|
./build.sh
|
||||||
|
|
||||||
|
echo "Commiting..."
|
||||||
|
git add -A
|
||||||
|
git commit -m "Version $1"
|
||||||
|
git push
|
||||||
|
|
||||||
|
echo "Creating the tag..."
|
||||||
|
git tag "v$1"
|
||||||
|
git push --tags
|
||||||
|
|
||||||
|
echo "Commiting untracked version notice..."
|
||||||
|
sed -i "s|$1|(untracked version)|g" filemanager.go
|
||||||
|
git add -A
|
||||||
|
git commit -m "untracked version `date`"
|
||||||
|
git push
|
||||||
|
|
||||||
|
echo "Done!"
|
||||||
@@ -1 +1 @@
|
|||||||
3b621522d90af10b96208b839db22160799540b3
|
ff1dc93e7042a5be07b719f0a1b7d1aca3f13b08
|
||||||
Reference in new issue
Block a user