Skip to content

Commit

Permalink
Merge pull request #2681 from threefoldtech/development_enable_ipvs_smtp
Browse files Browse the repository at this point in the history
Enable SMTP only with public ipv4
  • Loading branch information
AlaaElattar authored May 14, 2024
2 parents 3bb13b1 + ac3ac68 commit 1c67d82
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 8 deletions.
4 changes: 4 additions & 0 deletions packages/playground/src/components/smtp_server.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<p v-else>Configure your SMTP Server.</p>
</v-alert>

<v-alert variant="tonal" type="warning" class="mt-3">
SMTP functionality requires IPv4. Enabling SMTP will automatically activate IPv4.
</v-alert>
<input-tooltip
v-if="!persistent"
inline
Expand All @@ -31,6 +34,7 @@
v-model="$props.modelValue.username"
v-bind="props"
autofocus
class="mt-3"
/>
</input-tooltip>
</input-validator>
Expand Down
21 changes: 19 additions & 2 deletions packages/playground/src/weblets/tf_discourse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
:medium="{ cpu: 2, memory: 4, disk: 50 }"
:large="{ cpu: 4, memory: 16, disk: 100 }"
/>
<Networks v-model:mycelium="mycelium" />
<Networks v-model:mycelium="mycelium" v-model:ipv4="ipv4" />

<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch color="primary" inset label="Dedicated" v-model="dedicated" hide-details />
Expand Down Expand Up @@ -101,7 +101,7 @@
import type { GridClient } from "@threefold/grid_client";
import { Buffer } from "buffer";
import TweetNACL from "tweetnacl";
import { computed, type Ref, ref } from "vue";
import { computed, type Ref, ref, watch } from "vue";
import { manual } from "@/utils/manual";
Expand Down Expand Up @@ -236,6 +236,23 @@ function generatePubKey(): string {
function updateSSHkeyEnv(selectedKeys: string) {
selectedSSHKeys.value = selectedKeys;
}
watch(
() => smtp.value.enabled,
newValue => {
if (newValue) {
ipv4.value = true;
}
},
);
watch(
() => ipv4.value,
newValue => {
if (!newValue && smtp.value.enabled) {
smtp.value.enabled = false;
}
},
);
</script>

<script lang="ts">
Expand Down
22 changes: 19 additions & 3 deletions packages/playground/src/weblets/tf_mattermost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
:medium="{ cpu: 2, memory: 4, disk: 50 }"
:large="{ cpu: 4, memory: 16, disk: 100 }"
/>
<Networks v-model:mycelium="mycelium" />
<Networks v-model:mycelium="mycelium" v-model:ipv4="ipv4" />

<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch color="primary" inset label="Dedicated" v-model="dedicated" hide-details />
Expand All @@ -68,7 +68,6 @@

<manage-ssh-deployemnt @selected-keys="updateSSHkeyEnv($event)" />
</template>

<template #smtp>
<SmtpServer v-model="smtp" />
</template>
Expand All @@ -82,7 +81,7 @@

<script lang="ts" setup>
import type { GridClient } from "@threefold/grid_client";
import { computed, type Ref, ref } from "vue";
import { computed, type Ref, ref, watch } from "vue";
import { manual } from "@/utils/manual";
Expand Down Expand Up @@ -218,6 +217,23 @@ async function deploy() {
function updateSSHkeyEnv(selectedKeys: string) {
selectedSSHKeys.value = selectedKeys;
}
watch(
() => smtp.value.enabled,
newValue => {
if (newValue) {
ipv4.value = true;
}
},
);
watch(
() => ipv4.value,
newValue => {
if (!newValue && smtp.value.enabled) {
smtp.value.enabled = false;
}
},
);
</script>

<script lang="ts">
Expand Down
18 changes: 17 additions & 1 deletion packages/playground/src/weblets/tf_owncloud.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

<script lang="ts" setup>
import type { GridClient } from "@threefold/grid_client";
import { computed, type Ref, ref } from "vue";
import { computed, type Ref, ref, watch } from "vue";
import { manual } from "@/utils/manual";
Expand Down Expand Up @@ -264,6 +264,22 @@ async function deploy() {
function updateSSHkeyEnv(selectedKeys: string) {
selectedSSHKeys.value = selectedKeys;
}
watch(
() => smtp.value.enabled,
newValue => {
if (newValue) {
ipv4.value = true;
}
},
);
watch(
() => ipv4.value,
newValue => {
if (!newValue && smtp.value.enabled) {
smtp.value.enabled = false;
}
},
);
</script>

<script lang="ts">
Expand Down
21 changes: 19 additions & 2 deletions packages/playground/src/weblets/tf_taiga.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
:small="{ cpu: 2, memory: 4, disk: 100 }"
:medium="{ cpu: 4, memory: 8, disk: 150 }"
/>
<Networks v-model:mycelium="mycelium" />
<Networks v-model:mycelium="mycelium" v-model:ipv4="ipv4" />

<input-tooltip inline tooltip="Click to know more about dedicated machines." :href="manual.dedicated_machines">
<v-switch color="primary" inset label="Dedicated" v-model="dedicated" hide-details />
Expand Down Expand Up @@ -132,7 +132,7 @@

<script lang="ts" setup>
import type { GridClient } from "@threefold/grid_client";
import { computed, type Ref, ref } from "vue";
import { computed, type Ref, ref, watch } from "vue";
import { manual } from "@/utils/manual";
Expand Down Expand Up @@ -274,6 +274,23 @@ async function deploy() {
function updateSSHkeyEnv(selectedKeys: string) {
selectedSSHKeys.value = selectedKeys;
}
watch(
() => smtp.value.enabled,
newValue => {
if (newValue) {
ipv4.value = true;
}
},
);
watch(
() => ipv4.value,
newValue => {
if (!newValue && smtp.value.enabled) {
smtp.value.enabled = false;
}
},
);
</script>

<script lang="ts">
Expand Down

0 comments on commit 1c67d82

Please sign in to comment.