Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Integrate config.js on the frontend

Kailash Nadh1bcd350b20ac
diff --git a/admin.go b/admin.go
index 8d7aa44b..51214a00 100644
--- a/admin.go
+++ b/admin.go
@@ -12,7 +12,6 @@ import (
type configScript struct {
RootURL string `json:"rootURL"`
- UploadURI string `json:"uploadURI"`
FromEmail string `json:"fromEmail"`
Messengers []string `json:"messengers"`
}
diff --git a/frontend/public/index.html b/frontend/public/index.html
index 98fe807d..97699fe6 100644
--- a/frontend/public/index.html
+++ b/frontend/public/index.html
@@ -7,6 +7,7 @@
<link rel="icon" href="<%= BASE_URL %>frontend/favicon.png" />
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,600" rel="stylesheet" />
<title><%= htmlWebpackPlugin.options.title %></title>
+ <script src="<%= BASE_URL %>api/config.js"></script>
</head>
<body>
<noscript>
diff --git a/frontend/src/App.vue b/frontend/src/App.vue
index dfb9cc27..55f3be80 100644
--- a/frontend/src/App.vue
+++ b/frontend/src/App.vue
@@ -77,6 +77,16 @@
<div class="main">
<router-view :key="$route.fullPath" />
</div>
+
+ <b-loading v-if="!isLoaded" active>
+ <div class="has-text-centered">
+ <h1 class="title">Oops</h1>
+ <p>
+ Can't connect to the listmonk backend.<br />
+ Make sure it is running and refresh this page.
+ </p>
+ </div>
+ </b-loading>
</div>
</template>
@@ -90,6 +100,7 @@ export default Vue.extend({
return {
activeItem: {},
activeGroup: {},
+ isLoaded: window.CONFIG,
};
},
diff --git a/frontend/src/views/Campaign.vue b/frontend/src/views/Campaign.vue
index 2103874f..7d7c23fd 100644
--- a/frontend/src/views/Campaign.vue
+++ b/frontend/src/views/Campaign.vue
@@ -159,7 +159,7 @@ export default Vue.extend({
form: {
name: '',
subject: '',
- fromEmail: '',
+ fromEmail: window.CONFIG.fromEmail,
templateId: 0,
lists: [],
tags: [],