This repository was archived by the owner on Dec 14, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -153,5 +153,42 @@ export default class ConfigRouter {
153
153
return res.redirect("back");
154
154
});
155
155
156
+ this.router.post("/edit/title", async (req, res) => {
157
+
158
+ const title = req.body.title;
159
+
160
+ if(!title)
161
+ {
162
+ req.flash("error", `Please include a title in the body`);
163
+ return res.redirect("back");
164
+ }
165
+
166
+ const [Config, C_Error] = await AW<IConfig[]>(ConfigModel.find());
167
+
168
+ if(!Config || C_Error)
169
+ {
170
+ if(C_Error)
171
+ log.error(C_Error);
172
+
173
+ req.flash("error", `Something went wrong, try again later.`);
174
+ return res.redirect("back");
175
+ };
176
+
177
+ let config = Config[0];
178
+
179
+ config.title = config.title === title ? config.title : title;
180
+
181
+ ConfigMap.set("title", title);
182
+
183
+ EditEnvFile({
184
+ TITLE: title
185
+ });
186
+
187
+ await config.save();
188
+
189
+ req.flash("success", "Succesfully changed domain settings, ensure to restart too.");
190
+ return res.redirect("back");
191
+ });
192
+
156
193
}
157
194
}
Original file line number Diff line number Diff line change 75
75
<button type="submit" class="btn btn-danger">Change Domain Settings</button>
76
76
</form>
77
77
</div>
78
+ <div>
79
+ <form action="/config/edit/title" method="POST">
80
+
81
+ <div class="mb-3">
82
+ <label for="password">Domain settings</label>
83
+ <input class="form-control mb-2" type="text" name="title" value="<%= title %>" placeholder="DMCD" required>
84
+ </div>
85
+
86
+ <button type="submit" class="btn btn-danger">Change Title</button>
87
+ </form>
88
+ </div>
78
89
</div>
79
90
</div>
80
91
<div>
You can’t perform that action at this time.
0 commit comments