Expect full downloadable file pathname (allow CDN)

This commit is contained in:
nemunaire 2016-02-26 01:31:00 +01:00 committed by Pierre-Olivier Mercier
parent da84a90b4f
commit ee67788d59
3 changed files with 3 additions and 5 deletions

View File

@ -2,6 +2,7 @@
BASEURL="http://localhost:8081"
BASEURI="https://srs.epita.fr/owncloud/remote.php/webdav/FIC 2016"
BASEFILE="/files"
CLOUDPASS=fic:'f>t\nV33R|(+?$i*'
new_theme() {
@ -29,7 +30,7 @@ new_file() {
EXERCICE="$2"
URI="$3"
curl -f -s -d "{\"URI\": \"$URI\"}" "${BASEURL}/api/themes/$THEME/$EXERCICE/files" |
curl -f -s -d "{\"URI\": \"${BASEFILE}${URI}\"}" "${BASEURL}/api/themes/$THEME/$EXERCICE/files" |
grep -Eo '"id":[0-9]+,' | grep -Eo "[0-9]+"
}

View File

@ -17,7 +17,6 @@ import (
var TeamsDir string
var SubmissionDir string
var BaseURL string
func watchsubdir(watcher *inotify.Watcher, pathname string) error {
log.Println("Watch new directory:", pathname)
@ -44,7 +43,6 @@ func watchsubdir(watcher *inotify.Watcher, pathname string) error {
func main() {
var dsn = flag.String("dsn", "fic:fic@/fic", "DSN to connect to the MySQL server")
flag.StringVar(&BaseURL, "baseurl", "http://fic.srs.epita.fr/", "URL prepended to each URL")
flag.StringVar(&SubmissionDir, "submission", "./submissions", "Base directory where save submissions")
flag.StringVar(&TeamsDir, "teams", "../TEAMS", "Base directory where save teams JSON files")
flag.Parse()

View File

@ -3,7 +3,6 @@ package fic
import (
"encoding/hex"
"fmt"
"path"
"time"
)
@ -87,7 +86,7 @@ func MyJSONTeam(t *Team, started bool) (interface{}, error) {
return nil, err
} else {
for _, f := range files {
exercice.Files = append(exercice.Files, myTeamFile{path.Join("/files", f.Path), f.Name, hex.EncodeToString(f.Checksum), f.Size})
exercice.Files = append(exercice.Files, myTeamFile{f.Path, f.Name, hex.EncodeToString(f.Checksum), f.Size})
}
}