mirror of
https://github.com/aunefyren/wrapperr
synced 2025-01-10 08:38:43 +00:00
Merge branch 'main' of https://github.com/aunefyren/wrapperr
This commit is contained in:
commit
198a995a42
16 changed files with 169 additions and 129 deletions
2
.github/workflows/docker-image-beta.yml
vendored
2
.github/workflows/docker-image-beta.yml
vendored
|
@ -20,7 +20,7 @@ jobs:
|
|||
tags: |
|
||||
type-raw,value=beta
|
||||
flavor: |
|
||||
latest=true
|
||||
latest=false
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
with:
|
||||
|
|
1
.github/workflows/docker-image.yml
vendored
1
.github/workflows/docker-image.yml
vendored
|
@ -33,7 +33,6 @@ jobs:
|
|||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
registry: docker.io
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
|
|
48
main.go
48
main.go
|
@ -24,22 +24,18 @@ func main() {
|
|||
// Create and define file for logging
|
||||
file, err := os.OpenFile("config/wrapperr.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0666)
|
||||
if err != nil {
|
||||
log.Println("Failed to load configuration file. Error: ")
|
||||
log.Println(err)
|
||||
log.Println("Failed to load configuration file. Error: " + err.Error())
|
||||
|
||||
fmt.Println("Failed to load configuration file. Error: ")
|
||||
fmt.Println(err)
|
||||
fmt.Println("Failed to load configuration file. Error: " + err.Error())
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
config, err := files.GetConfig()
|
||||
if err != nil {
|
||||
log.Println("Failed to load configuration file. Error: ")
|
||||
log.Println(err)
|
||||
log.Println("Failed to load configuration file. Error: " + err.Error())
|
||||
|
||||
fmt.Println("Failed to load configuration file. Error: ")
|
||||
fmt.Println(err)
|
||||
fmt.Println("Failed to load configuration file. Error: " + err.Error())
|
||||
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -48,19 +44,16 @@ func main() {
|
|||
if config.Timezone != "" {
|
||||
loc, err := time.LoadLocation(config.Timezone)
|
||||
if err != nil {
|
||||
fmt.Println("Failed to set time zone from config. Error: ")
|
||||
fmt.Println(err)
|
||||
fmt.Println("Failed to set time zone from config. Error: " + err.Error())
|
||||
fmt.Println("Removing value...")
|
||||
|
||||
log.Println("Failed to set time zone from config. Error: ")
|
||||
log.Println(err)
|
||||
log.Println("Failed to set time zone from config. Error: " + err.Error())
|
||||
log.Println("Removing value...")
|
||||
|
||||
config.Timezone = ""
|
||||
err = files.SaveConfig(config)
|
||||
if err != nil {
|
||||
log.Println("Failed to set new time zone in the config. Error: ")
|
||||
log.Println(err)
|
||||
log.Println("Failed to set new time zone in the config. Error: " + err.Error())
|
||||
log.Println("Exiting...")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
@ -124,8 +117,31 @@ func main() {
|
|||
// Get stats route
|
||||
router.HandleFunc(root+"/api/get/statistics", routes.ApiWrapperGetStatistics)
|
||||
|
||||
// Static routes
|
||||
router.PathPrefix(root).Handler(http.StripPrefix(root, http.FileServer(http.Dir("./web/"))))
|
||||
// Assets route
|
||||
assetsFileServer := http.FileServer(http.Dir("./web/assets/"))
|
||||
router.PathPrefix(root + "/assets").Handler(http.StripPrefix(root+"/assets", assetsFileServer))
|
||||
|
||||
// JS route
|
||||
jsFileServer := http.FileServer(http.Dir("./web/js/"))
|
||||
router.PathPrefix(root + "/js").Handler(http.StripPrefix(root+"/js", jsFileServer))
|
||||
|
||||
// HTML frontpage route
|
||||
router.HandleFunc(root+"/", func(w http.ResponseWriter, r *http.Request) {
|
||||
// Using the http.ServeFile function to serve the frontpage.html file
|
||||
http.ServeFile(w, r, "./web/html/frontpage.html")
|
||||
})
|
||||
|
||||
// HTML admin route
|
||||
router.HandleFunc(root+"/admin", func(w http.ResponseWriter, r *http.Request) {
|
||||
// Using the http.ServeFile function to serve the admin.html file
|
||||
http.ServeFile(w, r, "./web/html/admin.html")
|
||||
})
|
||||
|
||||
// TXT robots route
|
||||
router.HandleFunc(root+"/robots.txt", func(w http.ResponseWriter, r *http.Request) {
|
||||
// Using the http.ServeFile function to serve the robots.txt file
|
||||
http.ServeFile(w, r, "./web/txt/robots.txt")
|
||||
})
|
||||
|
||||
// Start web-server
|
||||
log.Fatal(http.ListenAndServe(":"+strconv.Itoa(port), router))
|
||||
|
|
|
@ -440,6 +440,7 @@ type TautulliEntry struct {
|
|||
User string `json:"user"`
|
||||
UserID int `json:"user_id"`
|
||||
Year int `json:"year"`
|
||||
OriginallyAvailableAt string `json:"originally_available_at"`
|
||||
Plays int `json:"plays"`
|
||||
}
|
||||
|
||||
|
|
|
@ -15,39 +15,56 @@ import (
|
|||
|
||||
func TautulliTestConnection(TautulliPort int, TautulliIP string, TautulliHttps bool, TautulliRoot string, TautulliApiKey string) (bool, error) {
|
||||
|
||||
url_string, err := utilities.BuildURL(TautulliPort, TautulliIP, TautulliHttps, TautulliRoot)
|
||||
urlString, err := utilities.BuildURL(TautulliPort, TautulliIP, TautulliHttps, TautulliRoot)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
errString := strings.Replace(err.Error(), TautulliApiKey, "REDACTED", -1)
|
||||
log.Println("Failed to build Tautulli connection URL. Error: " + errString)
|
||||
return false, errors.New("Failed to build Tautulli connection URL.")
|
||||
}
|
||||
|
||||
url_string = url_string + "api/v2/" + "?apikey=" + TautulliApiKey + "&cmd=status"
|
||||
urlString = urlString + "api/v2/" + "?apikey=" + TautulliApiKey + "&cmd=status"
|
||||
|
||||
params := url.Values{}
|
||||
payload := strings.NewReader(params.Encode())
|
||||
|
||||
req, err := http.NewRequest("GET", url_string, payload)
|
||||
req, err := http.NewRequest("GET", urlString, payload)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return false, errors.New("Failed to reach Tautulli server.")
|
||||
errString := strings.Replace(err.Error(), TautulliApiKey, "REDACTED", -1)
|
||||
log.Println("Failed to reach Tautulli server. Error: " + errString)
|
||||
return false, errors.New("Failed to reach Tautulli server. Error: " + errString)
|
||||
}
|
||||
|
||||
req.Header.Add("Accept", "application/json")
|
||||
|
||||
res, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return false, errors.New("Failed to reach Tautulli server.")
|
||||
errString := strings.Replace(err.Error(), TautulliApiKey, "REDACTED", -1)
|
||||
log.Println("Failed to reach Tautulli server. Error: " + errString)
|
||||
return false, errors.New("Failed to reach Tautulli server. Error: " + errString)
|
||||
}
|
||||
|
||||
defer res.Body.Close()
|
||||
body, err := ioutil.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
errString := strings.Replace(err.Error(), TautulliApiKey, "REDACTED", -1)
|
||||
log.Println("Failed to read Tautulli server response. Error: " + errString)
|
||||
return false, errors.New("Failed to read Tautulli response. Error: " + errString)
|
||||
} else if res.StatusCode != 200 {
|
||||
errString := "Tautulli didn't respond with status code 200, got: " + res.Status + " instead."
|
||||
reply := string(body)
|
||||
replyString := strings.Replace(reply, TautulliApiKey, "REDACTED", -1)
|
||||
log.Println("Failed to connect to Tautulli server. \n\nReply: " + replyString + ". +n\nError: " + errString)
|
||||
return false, errors.New("Failed to connect to Tautulli server. \n\nReply: " + replyString + ". \n\nError: " + errString)
|
||||
}
|
||||
|
||||
var body_reply models.TautulliStatusReply
|
||||
json.Unmarshal(body, &body_reply)
|
||||
err = json.Unmarshal(body, &body_reply)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return false, errors.New("Failed to parse Tautulli response.")
|
||||
errString := strings.Replace(err.Error(), TautulliApiKey, "REDACTED", -1)
|
||||
reply := string(body)
|
||||
replyString := strings.Replace(reply, TautulliApiKey, "REDACTED", -1)
|
||||
log.Println("Failed to parse Tautulli server response. \n\nReply: " + replyString + ". +n\nError: " + errString)
|
||||
return false, errors.New("Failed to parse Tautulli server response. \n\nReply: " + replyString + ". \n\nError: " + errString)
|
||||
}
|
||||
|
||||
var tautulli_status bool = false
|
||||
|
@ -56,6 +73,12 @@ func TautulliTestConnection(TautulliPort int, TautulliIP string, TautulliHttps b
|
|||
|
||||
tautulli_status = true
|
||||
|
||||
} else if body_reply.Response.Result == "error" {
|
||||
|
||||
errString := strings.Replace(body_reply.Response.Message, TautulliApiKey, "REDACTED", -1)
|
||||
log.Println("Tautulli server responsed with an error. Error: " + errString)
|
||||
return false, errors.New("Tautulli server responsed with an error. Error: " + errString)
|
||||
|
||||
}
|
||||
|
||||
return tautulli_status, nil
|
||||
|
|
|
@ -304,8 +304,7 @@ func ApiGetTautulliConncection(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
tautulli_state, err := modules.TautulliTestConnection(tautulli_connection.TautulliPort, tautulli_connection.TautulliIP, tautulli_connection.TautulliHttps, tautulli_connection.TautulliRoot, tautulli_connection.TautulliApiKey)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
utilities.RespondDefaultError(w, r, errors.New("Failed to reach Tautulli server."), 500)
|
||||
utilities.RespondDefaultError(w, r, err, 500)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -376,6 +376,7 @@ func WrapperrDownloadDays(ID int, wrapperr_data []models.WrapperrDay, loop_inter
|
|||
// Loop through retrieved data from Tautulli
|
||||
for j := 0; j < len(tautulli_data); j++ {
|
||||
if tautulli_data[j].MediaType == "movie" || tautulli_data[j].MediaType == "episode" || tautulli_data[j].MediaType == "track" {
|
||||
|
||||
tautulli_entry := models.TautulliEntry{
|
||||
Date: tautulli_data[j].Date,
|
||||
RowID: tautulli_data[j].RowID,
|
||||
|
@ -395,6 +396,7 @@ func WrapperrDownloadDays(ID int, wrapperr_data []models.WrapperrDay, loop_inter
|
|||
User: tautulli_data[j].User,
|
||||
UserID: tautulli_data[j].UserID,
|
||||
Year: tautulli_data[j].Year,
|
||||
OriginallyAvailableAt: tautulli_data[j].OriginallyAvailableAt,
|
||||
}
|
||||
|
||||
// Append to day data
|
||||
|
@ -490,7 +492,7 @@ func WrapperrLoopData(user_id int, config *models.WrapperrConfig, wrapperr_data
|
|||
|
||||
// Look for movie within pre-defined array
|
||||
for d := 0; d < len(wrapperr_user_movie); d++ {
|
||||
if wrapperr_user_movie[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_user_movie[d].Title == wrapperr_data[i].Data[j].Title {
|
||||
if ((wrapperr_user_movie[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_data[i].Data[j].OriginallyAvailableAt == "") || wrapperr_user_movie[d].OriginallyAvailableAt == wrapperr_data[i].Data[j].OriginallyAvailableAt) && wrapperr_user_movie[d].Title == wrapperr_data[i].Data[j].Title {
|
||||
wrapperr_user_movie[d].Plays += 1
|
||||
wrapperr_user_movie[d].Duration += wrapperr_data[i].Data[j].Duration
|
||||
wrapperr_user_movie[d].PausedCounter += wrapperr_data[i].Data[j].PausedCounter
|
||||
|
@ -515,7 +517,8 @@ func WrapperrLoopData(user_id int, config *models.WrapperrConfig, wrapperr_data
|
|||
|
||||
// Look for episode within pre-defined array
|
||||
for d := 0; d < len(wrapperr_user_episode); d++ {
|
||||
if wrapperr_user_episode[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_user_episode[d].Title == wrapperr_data[i].Data[j].Title {
|
||||
|
||||
if ((wrapperr_user_episode[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_data[i].Data[j].OriginallyAvailableAt == "") || wrapperr_user_episode[d].OriginallyAvailableAt == wrapperr_data[i].Data[j].OriginallyAvailableAt) && wrapperr_user_episode[d].Title == wrapperr_data[i].Data[j].Title && wrapperr_user_episode[d].ParentTitle == wrapperr_data[i].Data[j].ParentTitle && wrapperr_user_episode[d].GrandparentTitle == wrapperr_data[i].Data[j].GrandparentTitle {
|
||||
wrapperr_user_episode[d].Plays += 1
|
||||
wrapperr_user_episode[d].Duration += wrapperr_data[i].Data[j].Duration
|
||||
wrapperr_user_episode[d].PausedCounter += wrapperr_data[i].Data[j].PausedCounter
|
||||
|
@ -558,7 +561,7 @@ func WrapperrLoopData(user_id int, config *models.WrapperrConfig, wrapperr_data
|
|||
|
||||
// Look for track within pre-defined array
|
||||
for d := 0; d < len(wrapperr_user_track); d++ {
|
||||
if wrapperr_user_track[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_user_track[d].Title == wrapperr_data[i].Data[j].Title {
|
||||
if ((wrapperr_user_track[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_data[i].Data[j].OriginallyAvailableAt == "") || wrapperr_user_track[d].OriginallyAvailableAt == wrapperr_data[i].Data[j].OriginallyAvailableAt) && wrapperr_user_track[d].Title == wrapperr_data[i].Data[j].Title {
|
||||
wrapperr_user_track[d].Plays += 1
|
||||
wrapperr_user_track[d].Duration += wrapperr_data[i].Data[j].Duration
|
||||
wrapperr_user_track[d].PausedCounter += wrapperr_data[i].Data[j].PausedCounter
|
||||
|
@ -580,7 +583,7 @@ func WrapperrLoopData(user_id int, config *models.WrapperrConfig, wrapperr_data
|
|||
|
||||
// Look for album within pre-defined array
|
||||
for d := 0; d < len(wrapperr_user_album); d++ {
|
||||
if wrapperr_user_album[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_user_album[d].ParentTitle == wrapperr_data[i].Data[j].ParentTitle {
|
||||
if ((wrapperr_user_album[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_data[i].Data[j].OriginallyAvailableAt == "") || wrapperr_user_album[d].OriginallyAvailableAt == wrapperr_data[i].Data[j].OriginallyAvailableAt) && wrapperr_user_album[d].ParentTitle == wrapperr_data[i].Data[j].ParentTitle {
|
||||
wrapperr_user_album[d].Plays += 1
|
||||
wrapperr_user_album[d].Duration += wrapperr_data[i].Data[j].Duration
|
||||
wrapperr_user_album[d].PausedCounter += wrapperr_data[i].Data[j].PausedCounter
|
||||
|
@ -627,7 +630,7 @@ func WrapperrLoopData(user_id int, config *models.WrapperrConfig, wrapperr_data
|
|||
|
||||
// Look for movie within pre-defined array
|
||||
for d := 0; d < len(wrapperr_year_movie); d++ {
|
||||
if wrapperr_year_movie[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_year_movie[d].Title == wrapperr_data[i].Data[j].Title {
|
||||
if ((wrapperr_year_movie[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_data[i].Data[j].OriginallyAvailableAt == "") || wrapperr_year_movie[d].OriginallyAvailableAt == wrapperr_data[i].Data[j].OriginallyAvailableAt) && wrapperr_year_movie[d].Title == wrapperr_data[i].Data[j].Title {
|
||||
wrapperr_year_movie[d].Plays += 1
|
||||
wrapperr_year_movie[d].Duration += wrapperr_data[i].Data[j].Duration
|
||||
wrapperr_year_movie[d].PausedCounter += wrapperr_data[i].Data[j].PausedCounter
|
||||
|
@ -677,7 +680,7 @@ func WrapperrLoopData(user_id int, config *models.WrapperrConfig, wrapperr_data
|
|||
|
||||
// Look for show within pre-defined array
|
||||
for d := 0; d < len(wrapperr_year_show); d++ {
|
||||
if wrapperr_year_show[d].Year == wrapperr_data[i].Data[j].Year && wrapperr_year_show[d].GrandparentTitle == wrapperr_data[i].Data[j].GrandparentTitle {
|
||||
if wrapperr_year_show[d].GrandparentTitle == wrapperr_data[i].Data[j].GrandparentTitle {
|
||||
wrapperr_year_show[d].Plays += 1
|
||||
wrapperr_year_show[d].Duration += wrapperr_data[i].Data[j].Duration
|
||||
wrapperr_year_show[d].PausedCounter += wrapperr_data[i].Data[j].PausedCounter
|
||||
|
@ -859,7 +862,7 @@ func WrapperrLoopData(user_id int, config *models.WrapperrConfig, wrapperr_data
|
|||
count += 1
|
||||
}
|
||||
|
||||
// Find longest pause
|
||||
// Find the longest duration spent on a certain episode
|
||||
sortutil.DescByField(wrapperr_user_episode, "Duration")
|
||||
wrapperr_reply.User.UserShows.Data.EpisodeDurationLongest.Duration = wrapperr_user_episode[0].Duration
|
||||
wrapperr_reply.User.UserShows.Data.EpisodeDurationLongest.GrandparentTitle = wrapperr_user_episode[0].GrandparentTitle
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
<title>Wrapperr</title>
|
||||
|
||||
<!-- Bootstrap 4 CSS and custom CSS -->
|
||||
<link rel="stylesheet" type="text/css" href="../assets/css/admin.css" />
|
||||
<link rel="shortcut icon" href="../assets/img/favicons/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="./assets/css/admin.css" />
|
||||
<link rel="shortcut icon" href="./assets/img/favicons/favicon.ico" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script src="../functions.js"></script>
|
||||
<script src="../admin.js"></script>
|
||||
<script src="./js/functions.js"></script>
|
||||
<script src="./js/admin.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
|
@ -38,8 +38,8 @@
|
|||
|
||||
<div class="footer">
|
||||
<div class="footer-elements">
|
||||
<a style="color: white; font-weight: normal; font-size: 0.75em; text-decoration: none;" href="../">Wrapperr</a> |
|
||||
<a style="color: white; font-weight: normal; font-size: 0.75em; text-decoration: none;" href="../admin">Admin</a> |
|
||||
<a style="color: white; font-weight: normal; font-size: 0.75em; text-decoration: none;" href="./">Wrapperr</a> |
|
||||
<a style="color: white; font-weight: normal; font-size: 0.75em; text-decoration: none;" href="./admin">Admin</a> |
|
||||
<a style="color: white; font-weight: normal; font-size: 0.75em; text-decoration: none;" id="github_link" href="https://github.com/aunefyren/wrapperr" target="_blank">GitHub</a>
|
||||
</div>
|
||||
</div>
|
|
@ -12,10 +12,10 @@
|
|||
<link rel="shortcut icon" href="./assets/img/favicons/favicon.ico" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script src="./functions.js"></script>
|
||||
<script src="./index.js"></script>
|
||||
<script src="./get_stats.js"></script>
|
||||
<script src="./get_functions.js"></script>
|
||||
<script src="./js/functions.js"></script>
|
||||
<script src="./js/index.js"></script>
|
||||
<script src="./js/get_stats.js"></script>
|
||||
<script src="./js/get_functions.js"></script>
|
||||
|
||||
</head>
|
||||
<body id='body'>
|
|
@ -24,7 +24,7 @@ function login_menu() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button type="submit" class="form-control btn" id="log_in_button"><img src="../assets/done.svg" class="btn_logo"><p2>Log in</p2></button>';
|
||||
html += '<button type="submit" class="form-control btn" id="log_in_button"><img src="./assets/done.svg" class="btn_logo"><p2>Log in</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</form>';
|
||||
|
@ -103,7 +103,7 @@ function set_password_form() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button type="submit" class="form-control btn" id="create_admin_button"><img src="../assets/done.svg" class="btn_logo"><p2>Create account</p2></button>';
|
||||
html += '<button type="submit" class="form-control btn" id="create_admin_button"><img src="./assets/done.svg" class="btn_logo"><p2>Create account</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</form>';
|
||||
|
@ -168,7 +168,7 @@ function update_password_form() {
|
|||
topFunction();
|
||||
|
||||
var html = '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="../assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="./assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -197,7 +197,7 @@ function update_password_form() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button type="submit" class="form-control btn" onclick="update_password();" id="update_admin_button"><img src="../assets/done.svg" class="btn_logo"><p2>Update account</p2></button>';
|
||||
html += '<button type="submit" class="form-control btn" onclick="update_password();" id="update_admin_button"><img src="./assets/done.svg" class="btn_logo"><p2>Update account</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</form>';
|
||||
|
@ -303,11 +303,11 @@ function sign_out() {
|
|||
function admin_menu() {
|
||||
|
||||
var html = '<div class="form-group">';
|
||||
html += '<button class="form-control btn" onclick="update_password_form()"><img src="../assets/config.svg" class="btn_logo"><p2>Admin settings</p2></button>';
|
||||
html += '<button class="form-control btn" onclick="update_password_form()"><img src="./assets/config.svg" class="btn_logo"><p2>Admin settings</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group">';
|
||||
html += '<button class="form-control btn" name="plex_signout_button" id="plex_signout_button" onclick="sign_out()"><img src="../assets/close.svg" class="btn_logo"></img><p2 id="plex_signout_button_text">Sign Out</p2></button>';
|
||||
html += '<button class="form-control btn" name="plex_signout_button" id="plex_signout_button" onclick="sign_out()"><img src="./assets/close.svg" class="btn_logo"></img><p2 id="plex_signout_button_text">Sign Out</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -315,23 +315,23 @@ function admin_menu() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" onclick="set_tautulli_settings()" id="set_tautulli_settings"><img src="../assets/config.svg" class="btn_logo"><p2>Tautulli settings</p2></button>';
|
||||
html += '<button class="form-control btn" onclick="set_tautulli_settings()" id="set_tautulli_settings"><img src="./assets/config.svg" class="btn_logo"><p2>Tautulli settings</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" onclick="set_wrapperr_settings()" id="set_wrapperr_settings"><img src="../assets/config.svg" class="btn_logo"><p2>Wrapperr settings</p2></button>';
|
||||
html += '<button class="form-control btn" onclick="set_wrapperr_settings()" id="set_wrapperr_settings"><img src="./assets/config.svg" class="btn_logo"><p2>Wrapperr settings</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" onclick="set_wrapperr_customization()" id="set_wrapperr_customization"><img src="../assets/config.svg" class="btn_logo"><p2>Wrapperr customization</p2></button>';
|
||||
html += '<button class="form-control btn" onclick="set_wrapperr_customization()" id="set_wrapperr_customization"><img src="./assets/config.svg" class="btn_logo"><p2>Wrapperr customization</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" onclick="caching_menu()" id="caching_menu"><img src="../assets/download.svg" class="btn_logo"><p2>Caching</p2></button>';
|
||||
html += '<button class="form-control btn" onclick="caching_menu()" id="caching_menu"><img src="./assets/download.svg" class="btn_logo"><p2>Caching</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" onclick="log_menu()" id="log_menu"><img src="../assets/document.svg" class="btn_logo"><p2>Log</p2></button>';
|
||||
html += '<button class="form-control btn" onclick="log_menu()" id="log_menu"><img src="./assets/document.svg" class="btn_logo"><p2>Log</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
document.getElementById("setup").innerHTML = html;
|
||||
|
@ -366,7 +366,7 @@ function set_tautulli_settings() {
|
|||
|
||||
var html = '<div>';
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="../assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="./assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -379,7 +379,7 @@ function set_tautulli_settings() {
|
|||
|
||||
if(tautulli.length > 1) {
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button style="" type="button" class="form-control btn" id="remove_tautulli_ ' + i + '" onclick="remove_tautulli_server(' + i + ');"><img src="../assets/trash.svg" class="btn_logo"><p2 id="test_tautulli_text">Remove Tautulli server</p2></button>';
|
||||
html += '<button style="" type="button" class="form-control btn" id="remove_tautulli_ ' + i + '" onclick="remove_tautulli_server(' + i + ');"><img src="./assets/trash.svg" class="btn_logo"><p2 id="test_tautulli_text">Remove Tautulli server</p2></button>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
|
@ -440,7 +440,7 @@ function set_tautulli_settings() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button style="background-color: lightgrey;" type="button" class="form-control btn" id="test_connection_' + i + '" onclick="test_tautulli_connection(' + i + ')"><img src="../assets/synchronize.svg" class="btn_logo"><p2 id="test_tautulli_text">Test Tautulli connection</p2></button>';
|
||||
html += '<button style="background-color: lightgrey;" type="button" class="form-control btn" id="test_connection_' + i + '" onclick="test_tautulli_connection(' + i + ')"><img src="./assets/synchronize.svg" class="btn_logo"><p2 id="test_tautulli_text">Test Tautulli connection</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -450,7 +450,7 @@ function set_tautulli_settings() {
|
|||
}
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button style="" type="button" class="form-control btn" id="add_tautulli_server" onclick="additional_tautulli_server();"><img src="../assets/plus.svg" class="btn_logo"><p2 id="test_tautulli_text">Add Tautulli server</p2></button>';
|
||||
html += '<button style="" type="button" class="form-control btn" id="add_tautulli_server" onclick="additional_tautulli_server();"><img src="./assets/plus.svg" class="btn_logo"><p2 id="test_tautulli_text">Add Tautulli server</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -467,7 +467,7 @@ function set_tautulli_settings() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button type="submit" class="form-control btn" onclick="set_tautulli_settings_call();" id="set_tautulli_form_button"><img src="../assets/done.svg" class="btn_logo"></img><p2 id="set_tautulli_form_button_text">Save</p2></button>';
|
||||
html += '<button type="submit" class="form-control btn" onclick="set_tautulli_settings_call();" id="set_tautulli_form_button"><img src="./assets/done.svg" class="btn_logo"></img><p2 id="set_tautulli_form_button_text">Save</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</form>';
|
||||
|
@ -684,7 +684,7 @@ function set_wrapperr_settings() {
|
|||
topFunction();
|
||||
|
||||
var html = '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="../assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="./assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -732,7 +732,7 @@ function set_wrapperr_settings() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group">';
|
||||
html += '<label for="timezone" title="The timezone the data is located in, like \'Europe/Oslo\'. Type it exactly as it is specified in the PHP documentation.">Timezone: <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" target="_blank">(List)</a></label>';
|
||||
html += '<label for="timezone" title="The timezone the data is located in, like \'Europe/Oslo\'. Type it exactly as it is specified in the IANA Time Zone database.">Timezone: <a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones" target="_blank">(List)</a></label>';
|
||||
html += '<input type="text" class="form-control" id="timezone" value="' + timezone + '" autocomplete="off" placeholder="" required /><br>';
|
||||
html += '</div>';
|
||||
|
||||
|
@ -817,7 +817,7 @@ function set_wrapperr_settings() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button type="submit" class="form-control btn" onclick="set_wrapperr_settings_call();" id="set_wrapperr_settings_form_button"><img src="../assets/done.svg" class="btn_logo"></img><p2 id="set_wrapperr_settings_form_button_text">Save</p2></button>';
|
||||
html += '<button type="submit" class="form-control btn" onclick="set_wrapperr_settings_call();" id="set_wrapperr_settings_form_button"><img src="./assets/done.svg" class="btn_logo"></img><p2 id="set_wrapperr_settings_form_button_text">Save</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</form>';
|
||||
|
@ -954,7 +954,7 @@ function set_wrapperr_customization() {
|
|||
topFunction();
|
||||
|
||||
var html = '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="../assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="./assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -1196,7 +1196,7 @@ function set_wrapperr_customization() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="get_user_movie_stats_custom_button" id="get_user_movie_stats_custom_button" onclick="toggle_hidden_form(\'get_user_movie_stats_custom\')"><img src="../assets/tweak.svg" class="btn_logo"></img><p2 id="get_user_movie_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '<button class="form-control btn" name="get_user_movie_stats_custom_button" id="get_user_movie_stats_custom_button" onclick="toggle_hidden_form(\'get_user_movie_stats_custom\')"><img src="./assets/tweak.svg" class="btn_logo"></img><p2 id="get_user_movie_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -1342,7 +1342,7 @@ function set_wrapperr_customization() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="get_user_show_stats_custom_button" id="get_user_show_stats_custom_button" onclick="toggle_hidden_form(\'get_user_show_stats_custom\')"><img src="../assets/tweak.svg" class="btn_logo"></img><p2 id="get_user_show_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '<button class="form-control btn" name="get_user_show_stats_custom_button" id="get_user_show_stats_custom_button" onclick="toggle_hidden_form(\'get_user_show_stats_custom\')"><img src="./assets/tweak.svg" class="btn_logo"></img><p2 id="get_user_show_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -1466,7 +1466,7 @@ function set_wrapperr_customization() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="get_user_music_stats_custom_button" id="get_user_music_stats_custom_button" onclick="toggle_hidden_form(\'get_user_music_stats_custom\')"><img src="../assets/tweak.svg" class="btn_logo"></img><p2 id="get_user_music_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '<button class="form-control btn" name="get_user_music_stats_custom_button" id="get_user_music_stats_custom_button" onclick="toggle_hidden_form(\'get_user_music_stats_custom\')"><img src="./assets/tweak.svg" class="btn_logo"></img><p2 id="get_user_music_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -1593,7 +1593,7 @@ function set_wrapperr_customization() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="get_year_stats_custom_button" id="get_year_stats_custom_button" onclick="toggle_hidden_form(\'get_year_stats_custom\')"><img src="../assets/tweak.svg" class="btn_logo"></img><p2 id="get_year_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '<button class="form-control btn" name="get_year_stats_custom_button" id="get_year_stats_custom_button" onclick="toggle_hidden_form(\'get_year_stats_custom\')"><img src="./assets/tweak.svg" class="btn_logo"></img><p2 id="get_year_stats_custom_button_text">Custom text</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -1712,7 +1712,7 @@ function set_wrapperr_customization() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="wrapperr_language_button" id="get_user_show_stats_custom_button" onclick="toggle_hidden_form(\'wrapperr_language\')"><img src="../assets/tweak.svg" class="btn_logo"></img><p2 id="wrapperr_language_button_text">Custom language</p2></button>';
|
||||
html += '<button class="form-control btn" name="wrapperr_language_button" id="get_user_show_stats_custom_button" onclick="toggle_hidden_form(\'wrapperr_language\')"><img src="./assets/tweak.svg" class="btn_logo"></img><p2 id="wrapperr_language_button_text">Custom language</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -1729,7 +1729,7 @@ function set_wrapperr_customization() {
|
|||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
html += '<button type="submit" class="form-control btn" onclick="set_wrapperr_customization_call();" id="set_wrapperr_customization_form_button"><img src="../assets/done.svg" class="btn_logo"></img><p2 id="set_wrapperr_customization_form_button_text">Save</p2></button>';
|
||||
html += '<button type="submit" class="form-control btn" onclick="set_wrapperr_customization_call();" id="set_wrapperr_customization_form_button"><img src="./assets/done.svg" class="btn_logo"></img><p2 id="set_wrapperr_customization_form_button_text">Save</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</form>';
|
||||
|
@ -2071,7 +2071,7 @@ function set_wrapperr_customization_call() {
|
|||
function caching_menu() {
|
||||
|
||||
var html = '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="../assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="./assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -2106,7 +2106,7 @@ function caching_menu() {
|
|||
</div>
|
||||
|
||||
<div class="form-group newline">
|
||||
<button class="form-control btn" name="get_user_show_stats_custom_button" id="get_user_show_stats_custom_button" onclick="toggle_hidden_form(\'caching_desc\')"><img src="../assets/about.svg" class="btn_logo"></img><p2 id="get_user_show_stats_custom_button_text">Info</p2></button>
|
||||
<button class="form-control btn" name="get_user_show_stats_custom_button" id="get_user_show_stats_custom_button" onclick="toggle_hidden_form(\'caching_desc\')"><img src="./assets/about.svg" class="btn_logo"></img><p2 id="get_user_show_stats_custom_button_text">Info</p2></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -2118,7 +2118,7 @@ function caching_menu() {
|
|||
</div>
|
||||
|
||||
<div class="form-group newline">
|
||||
<button class="form-control btn" type="submit" name="cache_button" id="cache_button"><img src="../assets/download.svg" class="btn_logo"></img><p2 id="cache_button_text">Cache</p2></button>
|
||||
<button class="form-control btn" type="submit" name="cache_button" id="cache_button"><img src="./assets/download.svg" class="btn_logo"></img><p2 id="cache_button_text">Cache</p2></button>
|
||||
</div>
|
||||
|
||||
<div id="cache"></div>
|
||||
|
@ -2158,7 +2158,7 @@ function cache_initiate() {
|
|||
<form id='stats_form' class='form' onsubmit='return false' action="" method="post">
|
||||
|
||||
<div class='form-group newline'>
|
||||
<img id="loading_icon" src="../assets/loading.gif" style="border-radius: 25px; background-color: white; padding: 1em; width: 4em; height: 4em; display: inline;">
|
||||
<img id="loading_icon" src="./assets/loading.gif" style="border-radius: 25px; background-color: white; padding: 1em; width: 4em; height: 4em; display: inline;">
|
||||
</div>
|
||||
|
||||
<h3>Caching log:</h3>
|
||||
|
@ -2268,7 +2268,7 @@ function get_stats(days) {
|
|||
function log_menu() {
|
||||
|
||||
var html = '<div class="form-group newline">';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="../assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '<button class="form-control btn" name="admin_menu_return_button" id="admin_menu_return_button" onclick="get_config(get_cookie(\'wrapperr-admin\'));"><img src="./assets/trash.svg" class="btn_logo"></img><p2 id="admin_menu_return_button_text">Return</p2></button>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="form-group newline">';
|
||||
|
@ -2303,7 +2303,7 @@ function log_menu() {
|
|||
</div>
|
||||
|
||||
<div class="form-group newline">
|
||||
<button class="form-control btn" name="log_button" id="log_button" onclick="get_log();" style="opacity: 0.5;" disabled><img src="../assets/synchronize.svg" class="btn_logo"></img><p2 id="cache_button_text">Refresh</p2></button>
|
||||
<button class="form-control btn" name="log_button" id="log_button" onclick="get_log();" style="opacity: 0.5;" disabled><img src="./assets/synchronize.svg" class="btn_logo"></img><p2 id="cache_button_text">Refresh</p2></button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
@ -2475,9 +2475,17 @@ function get_wrapper_version() {
|
|||
};
|
||||
xhttp.withCredentials = true;
|
||||
|
||||
// Get the root without "/admin"
|
||||
root = window.location.pathname.replace('/admin', '')
|
||||
|
||||
xhttp.open("post", window.location.origin + "/" + root + "api/get/wrapperr-version");
|
||||
// Maybe add trailing slash depending on the end of "window.location.origin"
|
||||
var trailingslash = ""
|
||||
if(window.location.origin.charAt(window.location.origin.length-1) != "/") {
|
||||
trailingslash = "/"
|
||||
}
|
||||
|
||||
// Reach the API to get URL base
|
||||
xhttp.open("post", window.location.origin + "/" + root + trailingslash + "api/get/wrapperr-version");
|
||||
xhttp.send();
|
||||
return;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
# Folders
|
||||
User-agent: *
|
||||
Disallow: /api/
|
||||
Disallow: /assets/
|
||||
Disallow: /config/
|
||||
Disallow: /docker/
|
||||
# File types
|
||||
Disallow: /*.json
|
||||
Disallow: /*.php
|
||||
Disallow: /*.js
|
||||
Disallow: /*.md
|
2
web/txt/robots.txt
Normal file
2
web/txt/robots.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
User-agent: *
|
||||
Disallow: /
|
Loading…
Reference in a new issue