Skip to content

Commit

Permalink
Merge pull request #367 from Notifiarr/unstable
Browse files Browse the repository at this point in the history
Unstable
  • Loading branch information
davidnewhall authored Nov 18, 2022
2 parents 11c2eb0 + 4d98eb8 commit f02e1d8
Show file tree
Hide file tree
Showing 39 changed files with 112 additions and 115 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ else
ITERATION:=$(_ITERATION)
endif

# rpm is wierd and changes - to _ in versions.
# rpm is weird and changes - to _ in versions.
RPMVERSION:=$(shell echo $(VERSION) | tr -- - _)
# used for freebsd packages.
BINARYU:=$(shell echo $(BINARY) | tr -- - _)
Expand Down Expand Up @@ -517,7 +517,7 @@ docker:

# This builds a Homebrew formula file that can be used to install this app from source.
# The source used comes from the released version on GitHub. This will not work with local source.
# This target is used by Travis CI to update the released Forumla when a new tag is created.
# This target is used by Travis CI to update the released Formula when a new tag is created.
formula: $(BINARY).rb
v$(VERSION).tar.gz.sha256:
# Calculate the SHA from the Github source file.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ A sample docker compose file is [found in Examples](https://github.com/Notifiarr

**Unraid Users** - You must configure a Notifiarr API Key in the Unraid Template. If you wish to use Plex then you'll also need to set the Plex Token and Plex URL in the template as well.

**Docker Users** - Note that Docker Enviormental Variables - and thus the Unraid Template - override the Config file.
**Docker Users** - Note that Docker Environmental Variables - and thus the Unraid Template - override the Config file.

#### Docker Config File

Expand Down Expand Up @@ -450,7 +450,7 @@ You can also create ad-hoc service checks for things like Bazarr.
#### Ping and ICMP Service Checks

When `type` is set to `ping` a UDP ping check is performed, and when type is `icmp` an ICMP ping check is performed.
With both settings, the `expect` parameter must be three integers seperated by colons. ie. `3:2:500`.
With both settings, the `expect` parameter must be three integers separated by colons. ie. `3:2:500`.
This example means send 3 packets every 500 milliseconds, and expect at least 2 in return.

To enable unprivileged UDP pings on Linux you must run this command:
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ require (
howett.net/plist v1.0.0 // indirect
)

// zip extraction for databsae corruption checks.
// zip extraction for database corruption checks.
require (
github.com/nwaples/rardecode v1.1.3 // indirect
github.com/saracen/go7z v0.0.0-20191010121135-9c09b6bd7fda // indirect
Expand All @@ -83,7 +83,7 @@ require (
github.com/ulikunitz/xz v0.5.10 // indirect
)

// sqlite3 abstraction for databsae corruption checks.
// sqlite3 abstraction for database corruption checks.
require (
github.com/google/uuid v1.3.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
Expand Down
2 changes: 1 addition & 1 deletion init/archlinux/PKGBUILD.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ package() {
"${pkgdir}/usr/share/licenses/${pkgname}" "${pkgdir}/etc/${pkgname}"
# Man file.
install -Dm644 "${pkgname}.1.gz" "${pkgdir}/share/man/man1/${pkgname}.1.gz"
# Config file, ane example config file.
# Config file, and example config file.
install -m644 "examples/${configfile}.example" "${pkgdir}/etc/$pkgname/${configfile}.example"
install -m644 "examples/${configfile}.example" "${pkgdir}/etc/${pkgname}/${configfile}"
# Extra documentation.
Expand Down
2 changes: 1 addition & 1 deletion init/buildinfo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if git status > /dev/null 2>&1; then
# Dynamic. Recommend not changing.
VVERSION=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1) 2>/dev/null)
VERSION="$(echo $VVERSION | tr -d v | grep -E '^\S+$' || echo development)"
# This produces a 0 in some envirnoments (like Homebrew), but it's only used for packages.
# This produces a 0 in some environments (like Homebrew), but it's only used for packages.
ITERATION=$(git rev-list --count --all || echo 0)
COMMIT="$(git rev-parse --short HEAD || echo 0)"

Expand Down
2 changes: 1 addition & 1 deletion pkg/apps/apppkg/plex/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
)

// GetInfo retreives Plex Server Info. This also sets the friendly name, so s.Name() works.
// GetInfo retrieves Plex Server Info. This also sets the friendly name, so s.Name() works.
func (s *Server) GetInfo(ctx context.Context) (*PMSInfo, error) {
data, err := s.getPlexURL(ctx, s.config.URL, nil)
if err != nil {
Expand Down
64 changes: 31 additions & 33 deletions pkg/apps/apppkg/tautulli/tautulli.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"io"
"net/http"
"net/url"
"strings"
)

// Config is the Tautulli configuration.
Expand All @@ -18,26 +19,33 @@ type Config struct {

// GetURLInto gets a url and unmarshals the contents into the provided interface pointer.
func (c *Config) GetURLInto(ctx context.Context, params url.Values, into interface{}) error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.URL+"/api/v2", nil)
if err != nil {
return fmt.Errorf("creating request: %w", err)
}
err := func() error {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.URL+"/api/v2", nil)
if err != nil {
return fmt.Errorf("creating request: %w", err)
}

req.URL.RawQuery = params.Encode()
req.URL.RawQuery = params.Encode()

resp, err := c.Client.Do(req)
if err != nil {
return fmt.Errorf("making request: %w", err)
}
defer resp.Body.Close()
resp, err := c.Client.Do(req)
if err != nil {
return fmt.Errorf("making request: %w", err)
}
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("reading response (%s): %w: %s", resp.Status, err, string(body))
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return fmt.Errorf("reading response (%s): %w: %s", resp.Status, err, string(body))
}

if err := json.Unmarshal(body, into); err != nil {
return fmt.Errorf("decoding response (%s): %w: %s", resp.Status, err, string(body))
}

if err := json.Unmarshal(body, into); err != nil {
return fmt.Errorf("decoding response (%s): %w: %s", resp.Status, err, string(body))
return nil
}()
if err != nil {
return fmt.Errorf("%s", strings.ReplaceAll(err.Error(), c.APIKey, "<redacted>")) //nolint:goerr113
}

return nil
Expand Down Expand Up @@ -139,29 +147,19 @@ type User struct {
AllowGuest int `json:"allow_guest"` // 1,0 (bool)
}

// MapEmailName returns a map of email => name for Tautulli users.
func (u *Users) MapEmailName() map[string]string {
// MapIDName returns a map of plex user ID => Feiendly Name (or username) for Tautulli users.
func (u *Users) MapIDName() map[int64]string {
if u == nil {
return nil
}

nameMap := map[string]string{}
nameMap := map[int64]string{}

for _, user := range u.Response.Data {
// user.FriendlyName always seems to be set, so this first if-block is safety only.
if user.FriendlyName == "" && user.Email != "" && user.Username != "" {
nameMap[user.Email] = user.Username
continue
} else if user.FriendlyName == "" {
// This user has no mapability.
continue
}

// We only need username or email, not both, but in the order username then email.
if user.Username != "" {
nameMap[user.Username] = user.FriendlyName
} else if user.Email != "" {
nameMap[user.Email] = user.FriendlyName
if user.FriendlyName == "" {
nameMap[user.UserID] = user.Username
} else {
nameMap[user.UserID] = user.FriendlyName
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/apps/lidarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (a *Apps) setupLidarr() error {
// @Accept json
// @Success 201 {object} apps.Respond.apiResponse{message=lidarr.Album} "created"
// @Failure 400 {object} apps.Respond.apiResponse{message=string} "bad json payload"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item alrady exists"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item already exists"
// @Failure 422 {object} apps.Respond.apiResponse{message=string} "no item ID provided"
// @Failure 503 {object} apps.Respond.apiResponse{message=string} "instance error during check"
// @Failure 500 {object} apps.Respond.apiResponse{message=string} "instance error during add"
Expand Down
4 changes: 2 additions & 2 deletions pkg/apps/radarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (a *Apps) setupRadarr() error {
// @Accept json
// @Success 201 {object} apps.Respond.apiResponse{message=radarr.Movie} "created"
// @Failure 400 {object} apps.Respond.apiResponse{message=string} "bad json payload"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item alrady exists"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item already exists"
// @Failure 422 {object} apps.Respond.apiResponse{message=string} "no item ID provided"
// @Failure 503 {object} apps.Respond.apiResponse{message=string} "instance error during check"
// @Failure 500 {object} apps.Respond.apiResponse{message=string} "instance error during add"
Expand Down Expand Up @@ -164,7 +164,7 @@ func radarrData(movie *radarr.Movie) map[string]interface{} {
// @Param instance path int64 true "instance ID"
// @Param tmdbid path int64 true "TMDB ID"
// @Success 201 {object} apps.Respond.apiResponse{message=string} "movie does not exist"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item alrady exists"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item already exists"
// @Failure 503 {object} apps.Respond.apiResponse{message=string} "instance error"
// @Failure 404 {object} string "bad token or api key"
// @Router /api/radarr/{instance}/check/{tmdbid} [get]
Expand Down
2 changes: 1 addition & 1 deletion pkg/apps/readarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (a *Apps) setupReadarr() error {
// @Accept json
// @Success 201 {object} apps.Respond.apiResponse{message=readarr.Book} "created"
// @Failure 400 {object} apps.Respond.apiResponse{message=string} "bad json payload"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item alrady exists"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item already exists"
// @Failure 422 {object} apps.Respond.apiResponse{message=string} "no valid editions provided"
// @Failure 503 {object} apps.Respond.apiResponse{message=string} "instance error during check"
// @Failure 500 {object} apps.Respond.apiResponse{message=string} "instance error during add"
Expand Down
6 changes: 3 additions & 3 deletions pkg/apps/sonarr.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (a *Apps) setupSonarr() error {
// @Param POST body sonarr.AddSeriesInput true "new item content"
// @Success 201 {object} apps.Respond.apiResponse{message=sonarr.Series} "series content"
// @Failure 400 {object} apps.Respond.apiResponse{message=string} "bad json payload"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item alrady exists"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item already exists"
// @Failure 422 {object} apps.Respond.apiResponse{message=string} "no item ID provided"
// @Failure 503 {object} apps.Respond.apiResponse{message=string} "instance error during check"
// @Failure 500 {object} apps.Respond.apiResponse{message=string} "instance error during add"
Expand Down Expand Up @@ -157,14 +157,14 @@ func sonarrData(series *sonarr.Series) map[string]interface{} {
}
}

// @Description Checks if a Sonarr Series alrady exists.
// @Description Checks if a Sonarr Series already exists.
// @Summary Check Sonarr Series Existence
// @Tags Sonarr
// @Produce json
// @Param instance path int64 true "instance ID"
// @Param tvdbid path int64 true "TVDB ID"
// @Success 201 {object} apps.Respond.apiResponse{message=string} "series does not exist"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item alrady exists"
// @Failure 409 {object} apps.Respond.apiResponse{message=string} "item already exists"
// @Failure 503 {object} apps.Respond.apiResponse{message=string} "instance error"
// @Failure 404 {object} string "bad token or api key"
// @Router /api/sonarr/{instance}/check/{tvdbid} [get]
Expand Down
16 changes: 8 additions & 8 deletions pkg/bindata/docs/api_docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const docTemplateapi = `{
}
},
"409": {
"description": "item alrady exists",
"description": "item already exists",
"schema": {
"allOf": [
{
Expand Down Expand Up @@ -2043,7 +2043,7 @@ const docTemplateapi = `{
}
},
"409": {
"description": "item alrady exists",
"description": "item already exists",
"schema": {
"allOf": [
{
Expand Down Expand Up @@ -2174,7 +2174,7 @@ const docTemplateapi = `{
}
},
"409": {
"description": "item alrady exists",
"description": "item already exists",
"schema": {
"allOf": [
{
Expand Down Expand Up @@ -4831,7 +4831,7 @@ const docTemplateapi = `{
}
},
"409": {
"description": "item alrady exists",
"description": "item already exists",
"schema": {
"allOf": [
{
Expand Down Expand Up @@ -6251,7 +6251,7 @@ const docTemplateapi = `{
}
},
"409": {
"description": "item alrady exists",
"description": "item already exists",
"schema": {
"allOf": [
{
Expand Down Expand Up @@ -6332,7 +6332,7 @@ const docTemplateapi = `{
"ApiKeyAuth": []
}
],
"description": "Checks if a Sonarr Series alrady exists.",
"description": "Checks if a Sonarr Series already exists.",
"produces": [
"application/json"
],
Expand Down Expand Up @@ -6382,7 +6382,7 @@ const docTemplateapi = `{
}
},
"409": {
"description": "item alrady exists",
"description": "item already exists",
"schema": {
"allOf": [
{
Expand Down Expand Up @@ -10926,7 +10926,7 @@ const docTemplateapi = `{
"type": "object",
"properties": {
"users": {
"description": "Tautulli user -\u003e email map.",
"description": "Tautulli userID -\u003e email map.",
"type": "object",
"additionalProperties": {
"type": "string"
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindata/files/js/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function shutDownApp()
error: function (request, status, error) {
if (response.status == 0) {
toast('Web Server Error',
'Notifiarr client appears to be down aleady.', 'error', 30000);
'Notifiarr client appears to be down already.', 'error', 30000);
} else {
toast('Shutdown Error', (error!=''?error:'Bad Request')+': '+response.responseText, 'error', 10000);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindata/templates/commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ <h2 style="margin-left:5px;display:inline;">Custom Commands</h2>
<span class="dialogTitle">Shell</span>
</td>
<td style="min-width:100px;width:100px;">
<div style="display:none;" class="dialogText">Enable this option to log the command's output in the applicaton log.</div>
<div style="display:none;" class="dialogText">Enable this option to log the command's output in the application log.</div>
<a onClick="dialog($(this), 'right')" class="help-icon far fa-question-circle"></a>
<span class="dialogTitle">Log</span>
</td>
Expand Down
6 changes: 3 additions & 3 deletions pkg/bindata/templates/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h2 class="mb-3">General</h2>
<tr>
<td>
<div style="display:none;" class="dialogText">
If Notifiarr client is behind a reverse proxy (swag, nginx, etc), then you sould add that proxy IP here. You can also specify full networks.
If Notifiarr client is behind a reverse proxy (swag, nginx, etc), then you should add that proxy IP here. You can also specify full networks.
This controls which IP is written to the web server log file (requestor or <span class="text-warning">x-forwarded-for</span> header).
It also allows the <span class="text-warning">x-webauth-user</span> header for proxy authentication. Separate with spaces or new lines.<br>
<b>Current Values</b>:<br>
Expand Down Expand Up @@ -228,7 +228,7 @@ <h2 class="mb-3">General</h2>
<div style="display:none;" class="dialogText">
The Host ID parameter is used to uniquely identify this client installation.
Changing this value is discouraged; it should be found automatically.
Do not copy this value to another Notifiarr client insallation.
Do not copy this value to another Notifiarr client installation.
</div>
<a onClick="dialog($(this), 'left')" class="help-icon far fa-question-circle"></a>
<span class="dialogTitle">Host ID</span>
Expand Down Expand Up @@ -446,7 +446,7 @@ <h2 class="mb-3">SSL</h2>
<td>
<div style="display:none;" class="dialogText">
This application can serve HTTPS. Enable that by specifying a certificate file path and key file path.
The certificate file should have the full CA chain inclued.<br>
The certificate file should have the full CA chain included.<br>
<b>Current Value</b>: <i>{{ .Config.SSLCrtFile }}</i>
</div>
<a onClick="dialog($(this), 'left')" class="help-icon far fa-question-circle"></a>
Expand Down
2 changes: 1 addition & 1 deletion pkg/bindata/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h4 class="text-uppercase text-white" style="margin:10px 0px 0px 10px">
<span style="margin:0;font-size:0.8em;float:right;" class="mobile-hide tablet-hide"><i class="fas fa-desktop"></i></span>
{{- if .Username }}
<a class="nav-button text-danger fas fa-power-off" title="Shut down application (quit)." onClick="shutDownApp();" style="margin-right:0;"></a>
<a class="nav-button text-success fas fa-recycle" title="Reload application configuraton and refresh." onClick="reloadConfig();"></a>
<a class="nav-button text-success fas fa-recycle" title="Reload application configuration and refresh." onClick="reloadConfig();"></a>
{{- end}}
<span class="menu-btn pull-left" style="font-size:1.3em;">
<i class="fa fa-bars">
Expand Down
Loading

0 comments on commit f02e1d8

Please sign in to comment.