File tree Expand file tree Collapse file tree
apps/dokploy/components/proprietary/whitelabeling Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,15 +30,21 @@ import { Textarea } from "@/components/ui/textarea";
3030import { api } from "@/utils/api" ;
3131import { WhitelabelingPreview } from "./whitelabeling-preview" ;
3232
33+ const safeUrlField = z
34+ . string ( )
35+ . refine ( ( val ) => val === "" || / ^ h t t p s ? : \/ \/ / i. test ( val ) , {
36+ message : "Only http:// and https:// URLs are allowed" ,
37+ } ) ;
38+
3339const formSchema = z . object ( {
3440 appName : z . string ( ) ,
3541 appDescription : z . string ( ) ,
36- logoUrl : z . string ( ) ,
37- faviconUrl : z . string ( ) ,
42+ logoUrl : safeUrlField ,
43+ faviconUrl : safeUrlField ,
3844 customCss : z . string ( ) ,
39- loginLogoUrl : z . string ( ) ,
40- supportUrl : z . string ( ) ,
41- docsUrl : z . string ( ) ,
45+ loginLogoUrl : safeUrlField ,
46+ supportUrl : safeUrlField ,
47+ docsUrl : safeUrlField ,
4248 errorPageTitle : z . string ( ) ,
4349 errorPageDescription : z . string ( ) ,
4450 metaTitle : z . string ( ) ,
Original file line number Diff line number Diff line change @@ -187,16 +187,23 @@ export const apiUpdateDockerCleanup = z.object({
187187} ) ;
188188
189189// Whitelabeling validation schemas
190+ const safeUrl = z
191+ . string ( )
192+ . refine ( ( url ) => / ^ h t t p s ? : \/ \/ / i. test ( url ) , {
193+ message : "Only http:// and https:// URLs are allowed" ,
194+ } )
195+ . nullable ( ) ;
196+
190197export const whitelabelingConfigSchema = z . object ( {
191198 appName : z . string ( ) . nullable ( ) ,
192199 appDescription : z . string ( ) . nullable ( ) ,
193- logoUrl : z . string ( ) . nullable ( ) ,
194- faviconUrl : z . string ( ) . nullable ( ) ,
200+ logoUrl : safeUrl ,
201+ faviconUrl : safeUrl ,
195202 primaryColor : z . string ( ) . nullable ( ) ,
196203 customCss : z . string ( ) . nullable ( ) ,
197- loginLogoUrl : z . string ( ) . nullable ( ) ,
198- supportUrl : z . string ( ) . nullable ( ) ,
199- docsUrl : z . string ( ) . nullable ( ) ,
204+ loginLogoUrl : safeUrl ,
205+ supportUrl : safeUrl ,
206+ docsUrl : safeUrl ,
200207 errorPageTitle : z . string ( ) . nullable ( ) ,
201208 errorPageDescription : z . string ( ) . nullable ( ) ,
202209 metaTitle : z . string ( ) . nullable ( ) ,
Original file line number Diff line number Diff line change 1- import {
2- sendDiscordNotification ,
3- sendEmailNotification ,
4- } from "../utils/notifications/utils" ;
1+ import { sendEmailNotification } from "../utils/notifications/utils" ;
52export const sendEmail = async ( {
63 email,
74 subject,
@@ -26,26 +23,3 @@ export const sendEmail = async ({
2623
2724 return true ;
2825} ;
29-
30- export const sendDiscordNotificationWelcome = async ( email : string ) => {
31- await sendDiscordNotification (
32- {
33- webhookUrl : process . env . DISCORD_WEBHOOK_URL || "" ,
34- } ,
35- {
36- title : "New User Registered" ,
37- color : 0x00ff00 ,
38- fields : [
39- {
40- name : "Email" ,
41- value : email ,
42- inline : true ,
43- } ,
44- ] ,
45- timestamp : new Date ( ) ,
46- footer : {
47- text : "Dokploy User Registration Notification" ,
48- } ,
49- } ,
50- ) ;
51- } ;
You can’t perform that action at this time.
0 commit comments