profiles: "add jellyseerr" checkbox on profile creation

makes things clearer to new users. Fixes #438.
This commit is contained in:
Harvey Tindall
2025-11-28 20:37:45 +00:00
parent 0ecacc6064
commit cbff3085fa
7 changed files with 38 additions and 11 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ func (app *appContext) SetJellyseerrProfile(gc *gin.Context) {
} }
u, err := app.js.UserByID(jellyseerrID) u, err := app.js.UserByID(jellyseerrID)
if err != nil { if err != nil {
app.err.Printf(lm.FailedGetUsers, lm.Jellyseerr, err) app.err.Printf(lm.FailedGetUser, jellyseerrID, lm.Jellyseerr, err)
respond(500, "Couldn't get user", gc) respond(500, "Couldn't get user", gc)
return return
} }
+15
View File
@@ -196,6 +196,21 @@ func (app *appContext) CreateProfile(gc *gin.Context) {
return return
} }
} }
if req.Jellyseerr && app.config.Section("jellyseerr").Key("enabled").MustBool(false) {
user, err := app.js.MustGetUser(req.ID)
if err != nil {
app.err.Printf(lm.FailedGetUser, user.Name, lm.Jellyseerr, err)
} else {
profile.Jellyseerr.User = user.UserTemplate
n, err := app.js.GetNotificationPreferencesByID(user.ID)
if err != nil {
app.err.Printf(lm.FailedGetJellyseerrNotificationPrefs, user.ID, err)
} else {
profile.Jellyseerr.Notifications = n.NotificationsTemplate
profile.Jellyseerr.Enabled = true
}
}
}
app.storage.SetProfileKey(req.Name, profile) app.storage.SetProfileKey(req.Name, profile)
// Refresh discord bots, profile list // Refresh discord bots, profile list
if discordEnabled { if discordEnabled {
+1 -1
View File
@@ -459,7 +459,7 @@ section.section:not(.\~neutral) {
@layer components { @layer components {
.switch { .switch {
@apply flex flex-row gap-1 items-center; @apply flex flex-row gap-2 items-center;
} }
} }
+16 -9
View File
@@ -467,25 +467,32 @@
</form> </form>
</div> </div>
<div id="modal-add-profile" class="modal"> <div id="modal-add-profile" class="modal">
<form class="card relative mx-auto my-[10%] w-11/12 sm:w-4/5 lg:w-1/3" id="form-add-profile" href=""> <form class="card relative mx-auto my-[10%] w-11/12 sm:w-4/5 lg:w-1/3 flex flex-col gap-2" id="form-add-profile" href="">
<span class="heading">{{ .strings.addProfile }} <span class="modal-close">&times;</span></span> <h1 class="heading">{{ .strings.addProfile }} <span class="modal-close">&times;</span></h1>
<p class="content my-4">{{ .strings.addProfileDescription }}</p> <p class="content">{{ .strings.addProfileDescription }}</p>
<label> <label class="flex flex-col gap-2">
<span class="supra">{{ .strings.addProfileNameOf }} </span> <span class="supra">{{ .strings.addProfileNameOf }} </span>
<input type="text" class="field input ~neutral @high mt-4 mb-2" placeholder="{{ .strings.name }}" id="add-profile-name"> <input type="text" class="field input ~neutral @high" placeholder="{{ .strings.name }}" id="add-profile-name">
<label> </label>
<label class="flex flex-col gap-2">
<span class="supra">{{ .strings.user }}</span> <span class="supra">{{ .strings.user }}</span>
<div class="select ~neutral @low mt-4 mb-2"> <div class="select ~neutral @low">
<select id="add-profile-user"></select> <select id="add-profile-user"></select>
</div> </div>
</label> </label>
<label class="switch mb-4"> <label class="switch">
<input type="checkbox" id="add-profile-homescreen" checked> <input type="checkbox" id="add-profile-homescreen" checked>
<span>{{ .strings.addProfileStoreHomescreenLayout }}</span> <span>{{ .strings.addProfileStoreHomescreenLayout }}</span>
</label> </label>
{{ if .jellyseerrEnabled }}
<label class="switch">
<input type="checkbox" id="add-profile-jellyseerr" checked>
<span>{{ .strings.addProfileStoreJellyseerr }}</span>
</label>
{{ end }}
<label> <label>
<input type="submit" class="unfocused"> <input type="submit" class="unfocused">
<span class="button ~urge @low full-width center supra submit">{{ .strings.create }}</span> <span class="button ~urge @low w-full center supra submit">{{ .strings.create }}</span>
</label> </label>
</form> </form>
</div> </div>
+1
View File
@@ -117,6 +117,7 @@
"addProfileDescription": "Create a Jellyfin user and configure it, then select it below. When this profile is applied to an invite, new users will be created with the settings.", "addProfileDescription": "Create a Jellyfin user and configure it, then select it below. When this profile is applied to an invite, new users will be created with the settings.",
"addProfileNameOf": "Profile Name", "addProfileNameOf": "Profile Name",
"addProfileStoreHomescreenLayout": "Store homescreen layout", "addProfileStoreHomescreenLayout": "Store homescreen layout",
"addProfileStoreJellyseerr": "Create Jellyseerr profile",
"inviteNoUsersCreated": "None yet!", "inviteNoUsersCreated": "None yet!",
"inviteUsersCreated": "Created users", "inviteUsersCreated": "Created users",
"inviteNoProfile": "No Profile", "inviteNoProfile": "No Profile",
+1
View File
@@ -102,6 +102,7 @@ type newProfileDTO struct {
ID string `json:"id" example:"ZXhhbXBsZTEyMzQ1Njc4OQo" binding:"required"` // ID of user to source settings from ID string `json:"id" example:"ZXhhbXBsZTEyMzQ1Njc4OQo" binding:"required"` // ID of user to source settings from
Homescreen bool `json:"homescreen" example:"true"` // Whether to store homescreen layout or not Homescreen bool `json:"homescreen" example:"true"` // Whether to store homescreen layout or not
OmbiID string `json:"ombi_id" example:"ZXhhbXBsZTEyMzQ1Njc4OQo"` // ID of Ombi user to source settings from (optional) OmbiID string `json:"ombi_id" example:"ZXhhbXBsZTEyMzQ1Njc4OQo"` // ID of Ombi user to source settings from (optional)
Jellyseerr bool `json:"jellyseerr"` // Whether or not to generate Jellyseerr profile from user
} }
type inviteDTO struct { type inviteDTO struct {
+3
View File
@@ -199,6 +199,7 @@ export class ProfileEditor {
private _profileName = document.getElementById("add-profile-name") as HTMLInputElement; private _profileName = document.getElementById("add-profile-name") as HTMLInputElement;
private _userSelect = document.getElementById("add-profile-user") as HTMLSelectElement; private _userSelect = document.getElementById("add-profile-user") as HTMLSelectElement;
private _storeHomescreen = document.getElementById("add-profile-homescreen") as HTMLInputElement; private _storeHomescreen = document.getElementById("add-profile-homescreen") as HTMLInputElement;
private _createJellyseerrProfile = window.jellyseerrEnabled ? document.getElementById("add-profile-jellyseerr") as HTMLInputElement : null;
get empty(): boolean { return (Object.keys(this._table.children).length == 0) } get empty(): boolean { return (Object.keys(this._table.children).length == 0) }
set empty(state: boolean) { set empty(state: boolean) {
@@ -439,6 +440,7 @@ export class ProfileEditor {
} }
this._userSelect.innerHTML = innerHTML; this._userSelect.innerHTML = innerHTML;
this._storeHomescreen.checked = true; this._storeHomescreen.checked = true;
this._createJellyseerrProfile.checked = true;
window.modals.profiles.close(); window.modals.profiles.close();
window.modals.addProfile.show(); window.modals.addProfile.show();
} else { } else {
@@ -456,6 +458,7 @@ export class ProfileEditor {
"id": this._userSelect.value, "id": this._userSelect.value,
"name": this._profileName.value "name": this._profileName.value
} }
if (this._createJellyseerrProfile) send["jellyseerr"] = this._createJellyseerrProfile.checked;
_post("/profiles", send, (req: XMLHttpRequest) => { _post("/profiles", send, (req: XMLHttpRequest) => {
if (req.readyState == 4) { if (req.readyState == 4) {
toggleLoader(button); toggleLoader(button);