feat: rename frontend url config to public url

This commit is contained in:
kolaente 2024-02-09 14:41:55 +01:00
parent 78df83ee69
commit 119c68be9d
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
9 changed files with 30 additions and 30 deletions

View File

@ -16,8 +16,8 @@ service:
unixsocket:
# Permission bits for the Unix socket. Note that octal values must be prefixed by "0o", e.g. 0o660
unixsocketmode:
# The URL of the frontend, used to send password reset emails.
frontendurl: ""
# The public facing URL where your users can reach Vikunja. Used in emails and for the communication between api and frontend.
publicurl: ""
# The base path on the file system where the binary and assets are.
# Vikunja will also look in this path for a config file, so you could provide only this variable to point to a folder
# with a config file which will then be used.
@ -132,7 +132,7 @@ cors:
# Whether to enable or disable cors headers.
# Note: If you want to put the frontend and the api on separate domains or ports, you will need to enable this.
# Otherwise the frontend won't be able to make requests to the api through the browser.
enable: true
enable: false
# A list of origins which may access the api. These need to include the protocol (`http://` or `https://`) and port, if any.
origins:
- "*"

View File

@ -47,7 +47,7 @@ var testmailCmd = &cobra.Command{
Subject("Test from Vikunja").
Line("This is a test mail!").
Line("If you received this, Vikunja is correctly set up to send emails.").
Action("Go to your instance", config.ServiceFrontendurl.GetString())
Action("Go to your instance", config.ServicePublicURL.GetString())
opts, err := notifications.RenderMail(message)
if err != nil {

View File

@ -44,7 +44,7 @@ const (
ServiceInterface Key = `service.interface`
ServiceUnixSocket Key = `service.unixsocket`
ServiceUnixSocketMode Key = `service.unixsocketmode`
ServiceFrontendurl Key = `service.frontendurl`
ServicePublicURL Key = `service.publicurl`
ServiceEnableCaldav Key = `service.enablecaldav`
ServiceRootpath Key = `service.rootpath`
ServiceMaxItemsPerPage Key = `service.maxitemsperpage`
@ -294,7 +294,7 @@ func InitDefaultConfig() {
ServiceJWTTTLLong.setDefault(2592000) // 30 days
ServiceInterface.setDefault(":3456")
ServiceUnixSocket.setDefault("")
ServiceFrontendurl.setDefault("")
ServicePublicURL.setDefault("")
ServiceEnableCaldav.setDefault(true)
ServiceRootpath.setDefault(getBinaryDirLocation())
@ -381,7 +381,7 @@ func InitDefaultConfig() {
FilesBasePath.setDefault("files")
FilesMaxSize.setDefault("20MB")
// Cors
CorsEnable.setDefault(true)
CorsEnable.setDefault(false)
CorsOrigins.setDefault([]string{"*"})
CorsMaxAge.setDefault(0)
// Migration
@ -455,20 +455,20 @@ func InitConfig() {
RateLimitStore.Set(KeyvalueType.GetString())
}
if ServiceFrontendurl.GetString() != "" && !strings.HasSuffix(ServiceFrontendurl.GetString(), "/") {
ServiceFrontendurl.Set(ServiceFrontendurl.GetString() + "/")
if ServicePublicURL.GetString() != "" && !strings.HasSuffix(ServicePublicURL.GetString(), "/") {
ServicePublicURL.Set(ServicePublicURL.GetString() + "/")
}
if MigrationTodoistRedirectURL.GetString() == "" {
MigrationTodoistRedirectURL.Set(ServiceFrontendurl.GetString() + "migrate/todoist")
MigrationTodoistRedirectURL.Set(ServicePublicURL.GetString() + "migrate/todoist")
}
if MigrationTrelloRedirectURL.GetString() == "" {
MigrationTrelloRedirectURL.Set(ServiceFrontendurl.GetString() + "migrate/trello")
MigrationTrelloRedirectURL.Set(ServicePublicURL.GetString() + "migrate/trello")
}
if MigrationMicrosoftTodoRedirectURL.GetString() == "" {
MigrationMicrosoftTodoRedirectURL.Set(ServiceFrontendurl.GetString() + "migrate/microsoft-todo")
MigrationMicrosoftTodoRedirectURL.Set(ServicePublicURL.GetString() + "migrate/microsoft-todo")
}
if DefaultSettingsTimezone.GetString() == "" {

View File

@ -44,7 +44,7 @@ func (n *ReminderDueNotification) ToMail() *notifications.Mail {
Subject(`Reminder for "`+n.Task.Title+`" (`+n.Project.Title+`)`).
Greeting("Hi "+n.User.GetName()+",").
Line(`This is a friendly reminder of the task "`+n.Task.Title+`" (`+n.Project.Title+`).`).
Action("Open Task", config.ServiceFrontendurl.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Action("Open Task", config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Line("Have a nice day!")
}
@ -173,7 +173,7 @@ func (n *ProjectCreatedNotification) ToMail() *notifications.Mail {
return notifications.NewMail().
Subject(n.Doer.GetName()+` created the project "`+n.Project.Title+`"`).
Line(n.Doer.GetName()+` created the project "`+n.Project.Title+`"`).
Action("View Project", config.ServiceFrontendurl.GetString()+"projects/")
Action("View Project", config.ServicePublicURL.GetString()+"projects/")
}
// ToDB returns the ProjectCreatedNotification notification in a format which can be saved in the db
@ -200,7 +200,7 @@ func (n *TeamMemberAddedNotification) ToMail() *notifications.Mail {
From(n.Doer.GetNameAndFromEmail()).
Greeting("Hi "+n.Member.GetName()+",").
Line(n.Doer.GetName()+" has just added you to the "+n.Team.Name+" team in Vikunja.").
Action("View Team", config.ServiceFrontendurl.GetString()+"teams/"+strconv.FormatInt(n.Team.ID, 10)+"/edit")
Action("View Team", config.ServicePublicURL.GetString()+"teams/"+strconv.FormatInt(n.Team.ID, 10)+"/edit")
}
// ToDB returns the TeamMemberAddedNotification notification in a format which can be saved in the db
@ -227,7 +227,7 @@ func (n *UndoneTaskOverdueNotification) ToMail() *notifications.Mail {
Subject(`Task "`+n.Task.Title+`" (`+n.Project.Title+`) is overdue`).
Greeting("Hi "+n.User.GetName()+",").
Line(`This is a friendly reminder of the task "`+n.Task.Title+`" (`+n.Project.Title+`) which is overdue since `+utils.HumanizeDuration(until)+` and not yet done.`).
Action("Open Task", config.ServiceFrontendurl.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Action("Open Task", config.ServicePublicURL.GetString()+"tasks/"+strconv.FormatInt(n.Task.ID, 10)).
Line("Have a nice day!")
}
@ -263,7 +263,7 @@ func (n *UndoneTasksOverdueNotification) ToMail() *notifications.Mail {
overdueLine := ""
for _, task := range sortedTasks {
until := time.Until(task.DueDate).Round(1*time.Hour) * -1
overdueLine += `* [` + task.Title + `](` + config.ServiceFrontendurl.GetString() + "tasks/" + strconv.FormatInt(task.ID, 10) + `) (` + n.Projects[task.ProjectID].Title + `), overdue since ` + utils.HumanizeDuration(until) + "\n"
overdueLine += `* [` + task.Title + `](` + config.ServicePublicURL.GetString() + "tasks/" + strconv.FormatInt(task.ID, 10) + `) (` + n.Projects[task.ProjectID].Title + `), overdue since ` + utils.HumanizeDuration(until) + "\n"
}
return notifications.NewMail().
@ -271,7 +271,7 @@ func (n *UndoneTasksOverdueNotification) ToMail() *notifications.Mail {
Greeting("Hi "+n.User.GetName()+",").
Line("You have the following overdue tasks:").
Line(overdueLine).
Action("Open Vikunja", config.ServiceFrontendurl.GetString()).
Action("Open Vikunja", config.ServicePublicURL.GetString()).
Line("Have a nice day!")
}
@ -338,7 +338,7 @@ func (n *DataExportReadyNotification) ToMail() *notifications.Mail {
Subject("Your Vikunja Data Export is ready").
Greeting("Hi "+n.User.GetName()+",").
Line("Your Vikunja Data Export is ready for you to download. Click the button below to download it:").
Action("Download", config.ServiceFrontendurl.GetString()+"user/export/download").
Action("Download", config.ServicePublicURL.GetString()+"user/export/download").
Line("The download will be available for the next 7 days.").
Line("Have a nice day!")
}

View File

@ -156,7 +156,7 @@ func (t *Task) GetFullIdentifier() string {
}
func (t *Task) GetFrontendURL() string {
return config.ServiceFrontendurl.GetString() + "tasks/" + strconv.FormatInt(t.ID, 10)
return config.ServicePublicURL.GetString() + "tasks/" + strconv.FormatInt(t.ID, 10)
}
type taskFilterConcatinator string

View File

@ -36,7 +36,7 @@ func (n *MigrationDoneNotification) ToMail() *notifications.Mail {
return notifications.NewMail().
Subject("The migration from "+kind+" to Vikunja was completed").
Line("Vikunja has imported all lists/projects, tasks, notes, reminders and files from "+kind+" you have access to.").
Action("View your imported projects in Vikunja", config.ServiceFrontendurl.GetString()).
Action("View your imported projects in Vikunja", config.ServicePublicURL.GetString()).
Line("Have fun with your new (old) projects!")
}

View File

@ -115,7 +115,7 @@ func RenderMail(m *Mail) (mailOpts *mail.Opts, err error) {
data["ActionText"] = m.actionText
data["ActionURL"] = m.actionURL
data["Boundary"] = boundary
data["FrontendURL"] = config.ServiceFrontendurl.GetString()
data["FrontendURL"] = config.ServicePublicURL.GetString()
var introLinesHTML []templatehtml.HTML
for _, line := range m.introLines {

View File

@ -82,7 +82,7 @@ type legalInfo struct {
func Info(c echo.Context) error {
info := vikunjaInfos{
Version: version.Version,
FrontendURL: config.ServiceFrontendurl.GetString(),
FrontendURL: config.ServicePublicURL.GetString(),
Motd: config.ServiceMotd.GetString(),
LinkSharingEnabled: config.ServiceEnableLinkSharing.GetBool(),
MaxFileSize: config.FilesMaxSize.GetString(),

View File

@ -48,7 +48,7 @@ func (n *EmailConfirmNotification) ToMail() *notifications.Mail {
return nn.
Line("To confirm your email address, click the link below:").
Action("Confirm your email address", config.ServiceFrontendurl.GetString()+"?userEmailConfirm="+n.ConfirmToken).
Action("Confirm your email address", config.ServicePublicURL.GetString()+"?userEmailConfirm="+n.ConfirmToken).
Line("Have a nice day!")
}
@ -98,7 +98,7 @@ func (n *ResetPasswordNotification) ToMail() *notifications.Mail {
Subject("Reset your password on Vikunja").
Greeting("Hi "+n.User.GetName()+",").
Line("To reset your password, click the link below:").
Action("Reset your password", config.ServiceFrontendurl.GetString()+"?userPasswordReset="+n.Token.Token).
Action("Reset your password", config.ServicePublicURL.GetString()+"?userPasswordReset="+n.Token.Token).
Line("This link will be valid for 24 hours.").
Line("Have a nice day!")
}
@ -125,7 +125,7 @@ func (n *InvalidTOTPNotification) ToMail() *notifications.Mail {
Greeting("Hi "+n.User.GetName()+",").
Line("Someone just tried to log in into your account with correct username and password but a wrong TOTP passcode.").
Line("**If this was not you, someone else knows your password. You should set a new one immediately!**").
Action("Reset your password", config.ServiceFrontendurl.GetString()+"get-password-reset")
Action("Reset your password", config.ServicePublicURL.GetString()+"get-password-reset")
}
// ToDB returns the InvalidTOTPNotification notification in a format which can be saved in the db
@ -150,7 +150,7 @@ func (n *PasswordAccountLockedAfterInvalidTOTOPNotification) ToMail() *notificat
Greeting("Hi " + n.User.GetName() + ",").
Line("Someone tried to log in with your credentials but failed to provide a valid TOTP passcode.").
Line("After 10 failed attempts, we've disabled your account and reset your password. To set a new one, follow the instructions in the reset email we just sent you.").
Line("If you did not receive an email with reset instructions, you can always request a new one at [" + config.ServiceFrontendurl.GetString() + "get-password-reset](" + config.ServiceFrontendurl.GetString() + "get-password-reset).")
Line("If you did not receive an email with reset instructions, you can always request a new one at [" + config.ServicePublicURL.GetString() + "get-password-reset](" + config.ServicePublicURL.GetString() + "get-password-reset).")
}
// ToDB returns the PasswordAccountLockedAfterInvalidTOTOPNotification notification in a format which can be saved in the db
@ -176,7 +176,7 @@ func (n *FailedLoginAttemptNotification) ToMail() *notifications.Mail {
Line("Someone just tried to log in into your account with a wrong password three times in a row.").
Line("If this was not you, this could be someone else trying to break into your account.").
Line("To enhance the security of you account you may want to set a stronger password or enable TOTP authentication in the settings:").
Action("Go to settings", config.ServiceFrontendurl.GetString()+"user/settings")
Action("Go to settings", config.ServicePublicURL.GetString()+"user/settings")
}
// ToDB returns the FailedLoginAttemptNotification notification in a format which can be saved in the db
@ -201,7 +201,7 @@ func (n *AccountDeletionConfirmNotification) ToMail() *notifications.Mail {
Subject("Please confirm the deletion of your Vikunja account").
Greeting("Hi "+n.User.GetName()+",").
Line("You have requested the deletion of your account. To confirm this, please click the link below:").
Action("Confirm the deletion of my account", config.ServiceFrontendurl.GetString()+"?accountDeletionConfirm="+n.ConfirmToken).
Action("Confirm the deletion of my account", config.ServicePublicURL.GetString()+"?accountDeletionConfirm="+n.ConfirmToken).
Line("This link will be valid for 24 hours.").
Line("Once you confirm the deletion we will schedule the deletion of your account in three days and send you another email until then.").
Line("If you proceed with the deletion of your account, we will remove all of your projects and tasks you created. Everything you shared with another user or team will transfer ownership to them.").
@ -239,7 +239,7 @@ func (n *AccountDeletionNotification) ToMail() *notifications.Mail {
Line("You recently requested the deletion of your Vikunja account.").
Line("We will delete your account "+durationString+".").
Line("If you changed your mind, simply click the link below to cancel the deletion and follow the instructions there:").
Action("Abort the deletion", config.ServiceFrontendurl.GetString()).
Action("Abort the deletion", config.ServicePublicURL.GetString()).
Line("Have a nice day!")
}