Send and receive SMS messages using your Android phone programmatically via a simple HTTP API
feat(web): port all pages to Nuxt 4 + Vue 3 + Vuetify 4
Acho Arnold51f3e660edb0
diff --git a/web/app/pages/billing/index.vue b/web/app/pages/billing/index.vuenew file mode 100644index 00000000..873da9e6--- /dev/null+++ b/web/app/pages/billing/index.vue@@ -0,0 +1,182 @@+<script setup lang="ts">+import { mdiArrowLeft, mdiCreditCard } from "@mdi/js";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Billing - httpSMS",+});++const config = useRuntimeConfig();+const { mdAndDown, lgAndUp } = useDisplay();+const authStore = useAuthStore();+const billingStore = useBillingStore();+const notificationsStore = useNotificationsStore();+const { useApi } = useApiComposable();++const loading = ref(true);+const usage = ref<any>(null);++async function loadBillingUsage() {+ loading.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: any }>("/v1/billing/usage");+ usage.value = response.data;+ } catch {+ // silently fail+ } finally {+ loading.value = false;+ }+}++function getCheckoutUrl() {+ window.open(config.public.checkoutUrl as string, "_blank");+}++function getEnterpriseCheckoutUrl() {+ window.open(config.public.enterpriseCheckoutUrl as string, "_blank");+}++onMounted(async () => {+ await authStore.loadUser();+ await loadBillingUsage();+});+</script>++<template>+ <VContainer fluid class="px-0 pt-0" :class="{ 'fill-height': lgAndUp }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>Billing</VToolbarTitle>+ </VAppBar>+ <VContainer class="mt-16">+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h4 class="text-h4 mb-3">Usage</h4>+ <p class="text-medium-emphasis">+ Your current billing period usage and limits.+ </p>++ <VProgressLinear v-if="loading" indeterminate class="mb-4" />++ <template v-else-if="usage">+ <VCard class="mb-6">+ <VCardText>+ <VRow>+ <VCol cols="6" md="3">+ <div class="text-center">+ <p class="text-h4 text-primary">+ {{ usage.sent_messages ?? 0 }}+ </p>+ <p class="text-medium-emphasis text-subtitle-2">+ Messages Sent+ </p>+ </div>+ </VCol>+ <VCol cols="6" md="3">+ <div class="text-center">+ <p class="text-h4 text-primary">+ {{ usage.received_messages ?? 0 }}+ </p>+ <p class="text-medium-emphasis text-subtitle-2">+ Messages Received+ </p>+ </div>+ </VCol>+ <VCol cols="6" md="3">+ <div class="text-center">+ <p class="text-h4">{{ usage.total_messages ?? 0 }}</p>+ <p class="text-medium-emphasis text-subtitle-2">+ Total Messages+ </p>+ </div>+ </VCol>+ <VCol cols="6" md="3">+ <div class="text-center">+ <p class="text-h4">{{ usage.message_limit ?? 200 }}</p>+ <p class="text-medium-emphasis text-subtitle-2">+ Monthly Limit+ </p>+ </div>+ </VCol>+ </VRow>+ <VProgressLinear+ :model-value="+ ((usage.total_messages ?? 0) /+ (usage.message_limit ?? 200)) *+ 100+ "+ color="primary"+ height="8"+ rounded+ class="mt-4"+ />+ </VCardText>+ </VCard>++ <h4 class="text-h4 mb-3 mt-8">Upgrade Plan</h4>+ <p class="text-medium-emphasis mb-4">+ Upgrade your plan to send and receive more SMS messages per+ month.+ </p>++ <VRow>+ <VCol cols="12" md="6">+ <VCard>+ <VCardTitle>Pro Plan</VCardTitle>+ <VCardSubtitle>Up to 5,000 messages/month</VCardSubtitle>+ <VCardText>+ <p class="text-h4 text-primary mb-2">+ $10<span class="text-body-1">/month</span>+ </p>+ <ul class="ml-4">+ <li>5,000 SMS messages per month</li>+ <li>Priority support</li>+ <li>Webhook integrations</li>+ </ul>+ </VCardText>+ <VCardActions>+ <VBtn color="primary" block @click="getCheckoutUrl">+ <VIcon start :icon="mdiCreditCard" />+ Upgrade to Pro+ </VBtn>+ </VCardActions>+ </VCard>+ </VCol>+ <VCol cols="12" md="6">+ <VCard>+ <VCardTitle>Enterprise Plan</VCardTitle>+ <VCardSubtitle>Custom message limits</VCardSubtitle>+ <VCardText>+ <p class="text-h4 mb-2">Custom</p>+ <ul class="ml-4">+ <li>Up to 200,000+ SMS messages per month</li>+ <li>Dedicated support</li>+ <li>Custom integrations</li>+ </ul>+ </VCardText>+ <VCardActions>+ <VBtn+ color="secondary"+ block+ @click="getEnterpriseCheckoutUrl"+ >+ Contact Sales+ </VBtn>+ </VCardActions>+ </VCard>+ </VCol>+ </VRow>+ </template>+ </VCol>+ </VRow>+ </VContainer>+ </div>+ </VContainer>+</template>diff --git a/web/app/pages/blog/end-to-end-encryption-to-sms-messages.vue b/web/app/pages/blog/end-to-end-encryption-to-sms-messages.vuenew file mode 100644index 00000000..1a8b97af--- /dev/null+++ b/web/app/pages/blog/end-to-end-encryption-to-sms-messages.vue@@ -0,0 +1,49 @@+<script setup lang="ts">+definePageMeta({ layout: "website" });+useHead({+ title: "How to Add End-to-End Encryption to SMS Messages - httpSMS",+});+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-2">+ How to Add End-to-End Encryption to SMS Messages+ </h1>+ <BlogInfo date="September 15, 2023" read-time="5 min read" />+ <VDivider class="my-6" />+ <p class="text-body-1 mb-4">+ Privacy is fundamental. With httpSMS, you can add end-to-end+ encryption to your SMS messages using military-grade AES-256+ encryption. This ensures that only you and the intended recipient can+ read the message content.+ </p>+ <h2 class="text-h5 mt-6 mb-3">How It Works</h2>+ <p class="text-body-1 mb-4">+ When you enable encryption in the httpSMS Android app, all messages+ are encrypted before being sent. The encryption key is derived from a+ passphrase that you set in the app settings. Both sender and receiver+ must use the same passphrase.+ </p>+ <h2 class="text-h5 mt-6 mb-3">Setup Steps</h2>+ <ol class="ml-6 mb-4">+ <li class="mb-2">Open the httpSMS app on your Android phone</li>+ <li class="mb-2">Go to Settings → Encryption</li>+ <li class="mb-2">Enable encryption and set your passphrase</li>+ <li class="mb-2">Share the passphrase securely with the recipient</li>+ <li class="mb-2">+ The recipient enables encryption with the same passphrase+ </li>+ </ol>+ <p class="text-body-1 mb-4">+ Messages are encrypted using AES-256 in CFB mode with a SHA-256+ derived key. The encryption happens on-device before the message is+ sent to the httpSMS API.+ </p>+ <BlogAuthorBio />+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/blog/forward-incoming-sms-from-phone-to-webhook.vue b/web/app/pages/blog/forward-incoming-sms-from-phone-to-webhook.vuenew file mode 100644index 00000000..e3b08dae--- /dev/null+++ b/web/app/pages/blog/forward-incoming-sms-from-phone-to-webhook.vue@@ -0,0 +1,35 @@+<script setup lang="ts">+definePageMeta({ layout: "website" });+useHead({ title: "Forward Incoming SMS from Phone to Webhook - httpSMS" });+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-2">Forward Incoming SMS from Phone to Webhook</h1>+ <BlogInfo date="August 20, 2023" read-time="4 min read" />+ <VDivider class="my-6" />+ <p class="text-body-1 mb-4">+ Configure httpSMS to automatically forward incoming SMS messages to+ your server via webhooks. This allows you to build powerful automation+ workflows.+ </p>+ <h2 class="text-h5 mt-6 mb-3">Setting Up a Webhook</h2>+ <ol class="ml-6 mb-4">+ <li class="mb-2">Log in to your httpSMS dashboard</li>+ <li class="mb-2">Navigate to Settings → Webhooks</li>+ <li class="mb-2">Click "Add Webhook"</li>+ <li class="mb-2">Enter your server's callback URL</li>+ <li class="mb-2">Select the "message.phone.received" event</li>+ <li class="mb-2">Save the webhook</li>+ </ol>+ <p class="text-body-1 mb-4">+ When an SMS is received on your phone, httpSMS will send a POST+ request to your callback URL with the message details in JSON format.+ </p>+ <BlogAuthorBio />+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/blog/grant-send-and-read-sms-permissions-on-android.vue b/web/app/pages/blog/grant-send-and-read-sms-permissions-on-android.vuenew file mode 100644index 00000000..6d66ffad--- /dev/null+++ b/web/app/pages/blog/grant-send-and-read-sms-permissions-on-android.vue@@ -0,0 +1,45 @@+<script setup lang="ts">+definePageMeta({ layout: "website" });+useHead({ title: "Grant Send and Read SMS Permissions on Android - httpSMS" });+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-2">+ Grant Send and Read SMS Permissions on Android+ </h1>+ <BlogInfo date="July 10, 2023" read-time="3 min read" />+ <VDivider class="my-6" />+ <p class="text-body-1 mb-4">+ The httpSMS Android app requires certain permissions to send and+ receive SMS messages. This guide walks you through granting the+ necessary permissions.+ </p>+ <h2 class="text-h5 mt-6 mb-3">Required Permissions</h2>+ <ul class="ml-6 mb-4">+ <li class="mb-2">+ <strong>SEND_SMS</strong> - Required to send SMS messages+ </li>+ <li class="mb-2">+ <strong>READ_SMS</strong> - Required to read incoming messages+ </li>+ <li class="mb-2">+ <strong>RECEIVE_SMS</strong> - Required to detect new messages+ </li>+ </ul>+ <h2 class="text-h5 mt-6 mb-3">How to Grant Permissions</h2>+ <ol class="ml-6 mb-4">+ <li class="mb-2">Open the httpSMS app</li>+ <li class="mb-2">When prompted, tap "Allow" for each permission</li>+ <li class="mb-2">+ If you denied earlier, go to Settings → Apps → httpSMS → Permissions+ </li>+ <li class="mb-2">Enable SMS permissions</li>+ </ol>+ <BlogAuthorBio />+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/blog/how-to-send-sms-messages-from-excel.vue b/web/app/pages/blog/how-to-send-sms-messages-from-excel.vuenew file mode 100644index 00000000..0f08bbbc--- /dev/null+++ b/web/app/pages/blog/how-to-send-sms-messages-from-excel.vue@@ -0,0 +1,36 @@+<script setup lang="ts">+definePageMeta({ layout: "website" });+useHead({ title: "How to Send SMS Messages from Excel - httpSMS" });+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-2">How to Send SMS Messages from Excel</h1>+ <BlogInfo date="June 5, 2023" read-time="4 min read" />+ <VDivider class="my-6" />+ <p class="text-body-1 mb-4">+ Send bulk SMS messages to multiple recipients using a simple Excel+ template. No coding required!+ </p>+ <h2 class="text-h5 mt-6 mb-3">Steps</h2>+ <ol class="ml-6 mb-4">+ <li class="mb-2">+ Download the+ <a href="/templates/httpsms-bulk.xlsx">Excel template</a>+ </li>+ <li class="mb-2">Fill in the phone numbers and messages</li>+ <li class="mb-2">Go to Bulk Messages in your httpSMS dashboard</li>+ <li class="mb-2">Upload the file and click Send</li>+ </ol>+ <p class="text-body-1 mb-4">+ The template has two columns: "to" (phone number in international+ format) and "content" (the message text). You can send to up to 1,000+ recipients per file.+ </p>+ <BlogAuthorBio />+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/blog/index.vue b/web/app/pages/blog/index.vuenew file mode 100644index 00000000..49a67cbd--- /dev/null+++ b/web/app/pages/blog/index.vue@@ -0,0 +1,84 @@+<script setup lang="ts">+definePageMeta({+ layout: "website",+});++useHead({+ title: "Blog - httpSMS",+});++const articles = [+ {+ slug: "end-to-end-encryption-to-sms-messages",+ title: "How to Add End-to-End Encryption to SMS Messages",+ description:+ "Learn how to encrypt your SMS messages using AES-256 encryption with the httpSMS platform.",+ date: "2023-09-15",+ },+ {+ slug: "forward-incoming-sms-from-phone-to-webhook",+ title: "Forward Incoming SMS from Phone to Webhook",+ description:+ "Setup automatic forwarding of incoming SMS messages to your server using webhooks.",+ date: "2023-08-20",+ },+ {+ slug: "grant-send-and-read-sms-permissions-on-android",+ title: "Grant Send and Read SMS Permissions on Android",+ description:+ "Step by step guide to grant the necessary SMS permissions on your Android phone.",+ date: "2023-07-10",+ },+ {+ slug: "how-to-send-sms-messages-from-excel",+ title: "How to Send SMS Messages from Excel",+ description: "Send bulk SMS messages using an Excel spreadsheet template.",+ date: "2023-06-05",+ },+ {+ slug: "send-bulk-sms-from-csv-file-with-no-code",+ title: "Send Bulk SMS from CSV File with No Code",+ description:+ "Upload a CSV file to send SMS messages to multiple recipients without writing code.",+ date: "2023-05-12",+ },+ {+ slug: "send-sms-from-android-phone-with-python",+ title: "Send SMS from Android Phone with Python",+ description:+ "Use Python to send SMS messages through your Android phone via the httpSMS API.",+ date: "2023-04-18",+ },+ {+ slug: "send-sms-when-new-row-is-added-to-google-sheets-using-zapier",+ title: "Send SMS When New Row is Added to Google Sheets Using Zapier",+ description:+ "Automate SMS sending with Zapier and Google Sheets integration.",+ date: "2023-03-22",+ },+];+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-6">Blog</h1>+ <p class="text-medium-emphasis mb-8">+ Guides and tutorials to help you get the most out of httpSMS.+ </p>+ <VCard+ v-for="article in articles"+ :key="article.slug"+ class="mb-4"+ :to="`/blog/${article.slug}`"+ variant="outlined"+ >+ <VCardTitle>{{ article.title }}</VCardTitle>+ <VCardSubtitle>{{ article.date }}</VCardSubtitle>+ <VCardText>{{ article.description }}</VCardText>+ </VCard>+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/blog/send-bulk-sms-from-csv-file-with-no-code.vue b/web/app/pages/blog/send-bulk-sms-from-csv-file-with-no-code.vuenew file mode 100644index 00000000..049e3a21--- /dev/null+++ b/web/app/pages/blog/send-bulk-sms-from-csv-file-with-no-code.vue@@ -0,0 +1,34 @@+<script setup lang="ts">+definePageMeta({ layout: "website" });+useHead({ title: "Send Bulk SMS from CSV File with No Code - httpSMS" });+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-2">Send Bulk SMS from CSV File with No Code</h1>+ <BlogInfo date="May 12, 2023" read-time="3 min read" />+ <VDivider class="my-6" />+ <p class="text-body-1 mb-4">+ Upload a simple CSV file to send SMS messages to hundreds of+ recipients at once.+ </p>+ <h2 class="text-h5 mt-6 mb-3">CSV Format</h2>+ <p class="text-body-1 mb-4">+ Your CSV file should have two columns: <code>to</code> and+ <code>content</code>. Download our+ <a href="/templates/httpsms-bulk.csv">CSV template</a> to get started.+ </p>+ <h2 class="text-h5 mt-6 mb-3">Upload and Send</h2>+ <ol class="ml-6 mb-4">+ <li class="mb-2">Navigate to the Bulk Messages page</li>+ <li class="mb-2">Click the file upload field</li>+ <li class="mb-2">Select your CSV file</li>+ <li class="mb-2">Click "Send Bulk Messages"</li>+ </ol>+ <BlogAuthorBio />+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/blog/send-sms-from-android-phone-with-python.vue b/web/app/pages/blog/send-sms-from-android-phone-with-python.vuenew file mode 100644index 00000000..32990391--- /dev/null+++ b/web/app/pages/blog/send-sms-from-android-phone-with-python.vue@@ -0,0 +1,48 @@+<script setup lang="ts">+definePageMeta({ layout: "website" });+useHead({ title: "Send SMS from Android Phone with Python - httpSMS" });+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-2">Send SMS from Android Phone with Python</h1>+ <BlogInfo date="April 18, 2023" read-time="5 min read" />+ <VDivider class="my-6" />+ <p class="text-body-1 mb-4">+ Use Python and the httpSMS API to send SMS messages through your+ Android phone.+ </p>+ <h2 class="text-h5 mt-6 mb-3">Prerequisites</h2>+ <ul class="ml-6 mb-4">+ <li class="mb-2">Python 3.7+</li>+ <li class="mb-2">httpSMS account with API key</li>+ <li class="mb-2">Android phone with httpSMS app installed</li>+ </ul>+ <h2 class="text-h5 mt-6 mb-3">Code Example</h2>+ <pre class="pa-4 bg-surface-variant rounded mb-4"><code>import requests+import json++api_key = "your-api-key"+url = 'https://api.httpsms.com/v1/messages/send'++headers = {+ 'x-api-key': api_key,+ 'Accept': 'application/json',+ 'Content-Type': 'application/json'+}++payload = {+ "content": "Hello from Python!",+ "from": "+18005550199",+ "to": "+18005550100"+}++response = requests.post(url, headers=headers, data=json.dumps(payload))+print(response.json())</code></pre>+ <BlogAuthorBio />+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/blog/send-sms-when-new-row-is-added-to-google-sheets-using-zapier.vue b/web/app/pages/blog/send-sms-when-new-row-is-added-to-google-sheets-using-zapier.vuenew file mode 100644index 00000000..7a25cbcd--- /dev/null+++ b/web/app/pages/blog/send-sms-when-new-row-is-added-to-google-sheets-using-zapier.vue@@ -0,0 +1,47 @@+<script setup lang="ts">+definePageMeta({ layout: "website" });+useHead({+ title:+ "Send SMS When New Row is Added to Google Sheets Using Zapier - httpSMS",+});+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-2">+ Send SMS When New Row is Added to Google Sheets Using Zapier+ </h1>+ <BlogInfo date="March 22, 2023" read-time="6 min read" />+ <VDivider class="my-6" />+ <p class="text-body-1 mb-4">+ Automate SMS sending by connecting Google Sheets to httpSMS through+ Zapier. Every time a new row is added to your spreadsheet, an SMS will+ be sent automatically.+ </p>+ <h2 class="text-h5 mt-6 mb-3">Setup Steps</h2>+ <ol class="ml-6 mb-4">+ <li class="mb-2">+ Create a Zapier account and connect Google Sheets+ </li>+ <li class="mb-2">Set the trigger to "New Spreadsheet Row"</li>+ <li class="mb-2">Add a Webhooks by Zapier action (POST request)</li>+ <li class="mb-2">+ Configure the URL as+ <code>https://api.httpsms.com/v1/messages/send</code>+ </li>+ <li class="mb-2">Add your API key in the headers</li>+ <li class="mb-2">+ Map the spreadsheet columns to the message fields+ </li>+ </ol>+ <p class="text-body-1 mb-4">+ Now every time a new row is added to your Google Sheet, Zapier will+ automatically send an SMS via httpSMS to the phone number in that row.+ </p>+ <BlogAuthorBio />+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/bulk-messages/index.vue b/web/app/pages/bulk-messages/index.vuenew file mode 100644index 00000000..e3deb340--- /dev/null+++ b/web/app/pages/bulk-messages/index.vue@@ -0,0 +1,235 @@+<script setup lang="ts">+import { mdiArrowLeft, mdiMicrosoftExcel, mdiSendCheck } from "@mdi/js";+import { ErrorMessages, getErrorMessages } from "~/utils/errors";+import capitalize from "~/utils/capitalize";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Send Bulk Messages - httpSMS",+});++const router = useRouter();+const { mdAndUp, mdAndDown } = useDisplay();+const authStore = useAuthStore();+const billingStore = useBillingStore();+const { useApi } = useApiComposable();++const formFile = ref<File | null>(null);+const loading = ref(true);+const loadingHistory = ref(true);+const errorTitle = ref("");+const errorMessages = ref(new ErrorMessages());+const bulkOrders = ref<any[]>([]);++function cleanName(requestId: string): string {+ if (requestId.startsWith("bulk-csv-"))+ return requestId.replace(/^bulk-csv-/, "") + ".csv";+ if (requestId.startsWith("bulk-xls-"))+ return requestId.replace(/^bulk-xls-/, "") + ".xlsx";+ const newFormatMatch = requestId.match(/^bulk-[0-9A-Za-z]+-(.+)$/);+ if (newFormatMatch) return newFormatMatch[1];+ return requestId.replace(/^bulk-/, "");+}++async function fetchBulkOrders() {+ loadingHistory.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: any[] }>("/v1/bulk-messages", {+ method: "GET",+ });+ bulkOrders.value = response.data ?? [];+ } catch {+ // silently fail+ } finally {+ loadingHistory.value = false;+ }+}++async function sendBulkMessages() {+ loading.value = true;+ errorMessages.value = new ErrorMessages();+ errorTitle.value = "";++ try {+ const api = useApi();+ const formData = new FormData();+ if (formFile.value) formData.append("document", formFile.value);+ await api("/v1/bulk-messages", { method: "POST", body: formData });+ loading.value = false;+ formFile.value = null;+ fetchBulkOrders();+ } catch (error: any) {+ errorTitle.value = capitalize(+ error?.data?.message ?? "Error while sending bulk messages",+ );+ errorMessages.value = getErrorMessages(error);+ loading.value = false;+ }+}++onMounted(async () => {+ await authStore.loadUser();+ loading.value = false;+ fetchBulkOrders();+});+</script>++<template>+ <VContainer fluid class="px-0 pt-0" :class="{ 'fill-height': true }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>+ <div class="py-16">Bulk Messages</div>+ </VToolbarTitle>+ <VProgressLinear+ :active="loading"+ :indeterminate="loading"+ location="bottom"+ absolute+ />+ </VAppBar>+ <VContainer>+ <VRow>+ <VCol cols="12">+ <h5 class="text-h4 mb-3 mt-3">Bulk Messages</h5>+ <p>+ Fill in our bulk SMS+ <a+ class="text-decoration-none"+ download+ href="/templates/httpsms-bulk.csv"+ >CSV template</a+ >+ or our+ <a+ class="text-decoration-none"+ download+ href="/templates/httpsms-bulk.xlsx"+ >Excel template</a+ >+ and upload it here to send your SMS messages to multiple+ recipients at once. You can also configure+ <NuxtLink+ class="text-decoration-none"+ to="/settings/#send-schedules"+ >send schedules</NuxtLink+ >+ on your phone to make sure messages are sent out at specific times+ of the day e.g+ <span class="text-medium-emphasis">Mon - Fri 9am - 5pm.</span>+ </p>+ <VAlert v-if="errorTitle" variant="tonal" type="warning" prominent>+ <h6 class="text-subtitle-1 font-weight-bold">{{ errorTitle }}</h6>+ <ul class="text-body-2">+ <li+ v-for="message in errorMessages.get('document')"+ :key="message"+ >+ {{ message }}+ </li>+ </ul>+ </VAlert>+ <form @submit.prevent="sendBulkMessages">+ <VFileInput+ v-model="formFile"+ label="File"+ :prepend-icon="undefined"+ accept=".csv,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"+ :error-messages="errorMessages.get('document')"+ persistent-placeholder+ placeholder="Click here to upload your bulk SMS file."+ :append-inner-icon="mdiMicrosoftExcel"+ variant="outlined"+ />+ <div class="d-flex">+ <VBtn+ color="primary"+ type="submit"+ :loading="loading"+ :disabled="loading"+ size="large"+ >+ <VIcon start :icon="mdiSendCheck" />+ Send Bulk Messages+ </VBtn>+ <VSpacer />+ <VBtn+ v-if="mdAndUp"+ variant="plain"+ color="info"+ href="mailto:[email protected]?subject=I'm having trouble with the bulk messages"+ >+ I Need Help+ </VBtn>+ </div>+ </form>+ </VCol>+ </VRow>+ <VRow class="mt-8">+ <VCol cols="12">+ <h4 class="text-h4 mb-3">Bulk Message History</h4>+ <p class="text-medium-emphasis">+ Your 10 most recent bulk SMS uploads are shown below, including a+ delivery status breakdown for each batch. Click on a row to see+ individual messages on the search page.+ </p>+ <VProgressLinear v-if="loadingHistory" indeterminate class="mb-4" />+ <VTable v-else>+ <thead>+ <tr class="text-uppercase text-subtitle-2">+ <th class="text-left">Name</th>+ <th class="text-center">Created At</th>+ <th class="text-center">Total</th>+ <th class="text-center">Pending</th>+ <th class="text-center">Scheduled</th>+ <th class="text-center">Sent</th>+ <th class="text-center">Delivered</th>+ <th class="text-center">Failed</th>+ <th class="text-center">Expired</th>+ </tr>+ </thead>+ <tbody>+ <tr+ v-for="order in bulkOrders"+ :key="order.request_id"+ class="clickable-row"+ @click="+ router.push(`/search-messages?query=${order.request_id}`)+ "+ >+ <td class="text-left">{{ cleanName(order.request_id) }}</td>+ <td class="text-center">+ {{ useFilters().timestamp(order.created_at) }}+ </td>+ <td class="text-center">{{ order.total }}</td>+ <td class="text-center">{{ order.pending_count }}</td>+ <td class="text-center">{{ order.scheduled_count }}</td>+ <td class="text-center">{{ order.sent_count }}</td>+ <td class="text-center">{{ order.delivered_count }}</td>+ <td class="text-center">{{ order.failed_count }}</td>+ <td class="text-center">{{ order.expired_count }}</td>+ </tr>+ </tbody>+ </VTable>+ </VCol>+ </VRow>+ </VContainer>+ </div>+ </VContainer>+</template>++<style scoped>+.clickable-row {+ cursor: pointer;+}+.clickable-row:hover {+ background-color: rgb(0 0 0 / 4%);+}+</style>diff --git a/web/app/pages/heartbeats/[id].vue b/web/app/pages/heartbeats/[id].vuenew file mode 100644index 00000000..e2b4bfba--- /dev/null+++ b/web/app/pages/heartbeats/[id].vue@@ -0,0 +1,99 @@+<script setup lang="ts">+import { mdiArrowLeft, mdiHeartPulse } from "@mdi/js";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Heartbeats - httpSMS",+});++const route = useRoute();+const { mdAndDown, lgAndUp } = useDisplay();+const authStore = useAuthStore();+const { useApi } = useApiComposable();++const loading = ref(true);+const heartbeats = ref<any[]>([]);+const phoneId = computed(() => route.params.id as string);++async function loadHeartbeats() {+ loading.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: any[] }>(+ `/v1/heartbeats?owner=${phoneId.value}`,+ );+ heartbeats.value = response.data ?? [];+ } finally {+ loading.value = false;+ }+}++onMounted(async () => {+ await authStore.loadUser();+ await loadHeartbeats();+});+</script>++<template>+ <VContainer fluid class="px-0 pt-0" :class="{ 'fill-height': lgAndUp }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>+ <VIcon :icon="mdiHeartPulse" class="mr-2" />+ Heartbeats+ </VToolbarTitle>+ </VAppBar>+ <VContainer class="mt-16">+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h4 class="text-h4 mb-3">Phone Heartbeats</h4>+ <p class="text-medium-emphasis">+ Monitor the connectivity status of your Android phones. Heartbeats+ are sent every 15 minutes when the phone is online.+ </p>+ <VProgressLinear v-if="loading" indeterminate class="mb-4" />+ <VTable v-else-if="heartbeats.length">+ <thead>+ <tr class="text-uppercase text-subtitle-2">+ <th class="text-left">Phone</th>+ <th class="text-center">Status</th>+ <th class="text-center">Last Heartbeat</th>+ <th class="text-center">Charging</th>+ </tr>+ </thead>+ <tbody>+ <tr v-for="heartbeat in heartbeats" :key="heartbeat.id">+ <td>{{ useFilters().phoneNumber(heartbeat.owner) }}</td>+ <td class="text-center">+ <VChip+ :color="heartbeat.is_online ? 'success' : 'error'"+ size="small"+ >+ {{ heartbeat.is_online ? "Online" : "Offline" }}+ </VChip>+ </td>+ <td class="text-center">+ {{ useFilters().timestamp(heartbeat.timestamp) }}+ </td>+ <td class="text-center">+ {{ heartbeat.charging ? "Yes" : "No" }}+ </td>+ </tr>+ </tbody>+ </VTable>+ <p v-else class="text-medium-emphasis text-center mt-8">+ No heartbeats found. Make sure the httpSMS app is running on your+ phone.+ </p>+ </VCol>+ </VRow>+ </VContainer>+ </div>+ </VContainer>+</template>diff --git a/web/app/pages/index.vue b/web/app/pages/index.vuenew file mode 100644index 00000000..19c16f1c--- /dev/null+++ b/web/app/pages/index.vue@@ -0,0 +1,1012 @@+<script setup lang="ts">+import {+ mdiGithub,+ mdiCheckCircle,+ mdiSend,+ mdiGift,+ mdiLightbulbOn60,+ mdiForum,+ mdiCreation,+ mdiNumeric1,+ mdiSale,+ mdiLanguagePython,+ mdiNumeric2,+ mdiNumeric3,+ mdiCellphoneKey,+ mdiTallyMark1,+ mdiTallyMark3,+ mdiTallyMark2,+ mdiLabel,+ mdiLanguageJavascript,+ mdiLanguagePhp,+ mdiPlus,+ mdiMinus,+ mdiLanguageCsharp,+ mdiLanguageJava,+ mdiMicrosoftExcel,+ mdiWebhook,+ mdiClockOutline,+ mdiArrowRightThin,+ mdiPowershell,+ mdiLanguageGo,+} from "@mdi/js";++definePageMeta({+ layout: "website",+});++useHead({+ title: "Convert your android phone into an SMS gateway - httpSMS",+});++const config = useRuntimeConfig();+const { lgAndUp, mdAndUp, mdAndDown, mdOnly, smAndDown, xl } = useDisplay();++const selectedTab = ref("javascript");+const yearlyPricing = ref(false);+const faqPanel = ref<number | undefined>(undefined);+const pricing = ref(0);++const pricingLabels = ["10K", "20K", "50K", "100K", "200K"];+const pricingLabelsFull = ["10,000", "20,000", "50,000", "100,000", "200,000"];++const planMessages = computed(() =>+ pricingLabels[pricing.value].replace("K", ",000"),+);+const planMonthlyPrice = computed(() => [20, 35, 89, 175, 350][pricing.value]);+const planYearlyPrice = computed(+ () => [200, 350, 1068, 2100, 4200][pricing.value],+);+const planYearlyMonthlyPrice = computed(+ () => [16.66, 29.16, 89, 175, 350][pricing.value],+);+</script>++<template>+ <div>+ <VContainer>+ <VRow :class="{ 'py-16': lgAndUp }">+ <VCol+ cols="12"+ md="6"+ :class="{+ 'text-center pt-16': mdAndDown,+ 'py-16': lgAndUp,+ }"+ >+ <h1+ class="text-h2 font-weight-bold pb-1 gradient-header"+ :class="{+ 'mt-16': lgAndUp,+ 'mt-10': mdOnly,+ 'mt-8': smAndDown,+ }"+ >+ Convert your Android phone into an SMS gateway.+ </h1>+ <h2 class="text-medium-emphasis text-h5 mt-8 mb-8">+ <span class="gradient-underline">Save money</span> by using your+ phone to send and receive SMS messages via a simple programmable API+ with end-to-end encryption.+ </h2>+ <div :class="{ 'text-center': mdAndDown }">+ <VBtn color="primary" size="large" class="mt-4 mb-4" to="/login">+ <VIcon v-if="lgAndUp" start :icon="mdiSend" />+ Get Started+ </VBtn>+ <VBtn+ size="large"+ color="secondary"+ class="mt-4 mb-4 ml-4"+ href="https://sandbox.httpsms.com"+ >+ <VIcon v-if="lgAndUp" start :icon="mdiCreation" color="#ffe500" />+ Live Demo+ </VBtn>+ </div>+ <p class="text-body-2 mt-2">+ ✅Trusted by <b>23,273+</b> users who send/receive more than+ <b>500,000</b> messages per month.+ </p>+ <div class="mt-4" :class="{ 'text-center': mdAndDown }">+ <VIcon color="success" :icon="mdiCheckCircle" />+ Free to use+ <VIcon class="ml-4" color="success" :icon="mdiCheckCircle" />+ 100% Open Source+ </div>+ <div v-if="xl" class="mt-4">+ <a href="https://www.uneed.best/tool/httpsmscom">+ <img+ src="https://www.uneed.best/POTD1A.png"+ style="width: 250px"+ alt="Uneed POTD1 Badge"+ />+ </a>+ </div>+ <VDivider+ v-if="mdAndDown"+ class="mt-6 mr-16 bg-success"+ :class="{ 'ml-16': mdAndDown }"+ />+ </VCol>+ <VCol v-if="mdAndUp" cols="12" md="6" class="py-16">+ <VImg+ class="mx-auto mb-4"+ max-height="700"+ max-width="98%"+ :src="'/img/writing-code-phone.svg'"+ />+ </VCol>+ </VRow>+ </VContainer>++ <!-- Features Section -->+ <VSheet class="py-16">+ <VContainer>+ <!-- Bulk SMS -->+ <VRow class="mb-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="2">+ <div>+ <h3 class="text-h3 mb-1">+ Bulk SMS+ <VChip class="ma-2" color="pink" label>+ <VIcon start :icon="mdiLabel" />+ No code+ </VChip>+ </h3>+ <h5 class="text-h6 font-weight-light">+ Fill in our bulk SMS+ <a+ class="text-decoration-none"+ download+ href="/templates/httpsms-bulk.csv"+ >CSV template</a+ >+ or our+ <a+ class="text-decoration-none"+ download+ href="/templates/httpsms-bulk.xlsx"+ >excel template</a+ >+ and upload it on httpSMS to send SMS messages to up to 1,000+ recipients at once without writing any code.+ </h5>+ <VBtn+ to="/blog/how-to-send-sms-messages-from-excel"+ color="primary"+ class="mt-4"+ >+ <VIcon start :icon="mdiMicrosoftExcel" />+ Integration Guide+ </VBtn>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="1">+ <VImg+ class="mb-4"+ max-height="400"+ :src="'/img/bulk-sms-template.png'"+ />+ </VCol>+ </VRow>++ <!-- Integrations -->+ <VRow class="mb-16 mt-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="1">+ <div>+ <h3 class="text-h3 mb-1">+ Integrations+ <VChip class="ma-2" color="pink" label>+ <VIcon start :icon="mdiLabel" />+ No code+ </VChip>+ </h3>+ <h5 class="text-h6 font-weight-light">+ Connect your workflow with thousands of other apps with the+ power of Zapier. For example you can setup an automation to send+ personalized SMS messages each time someone makes an order from+ your shopify store or each time a new row is added to a Google+ spreadsheet.+ </h5>+ <VBtn+ to="/blog/send-sms-when-new-row-is-added-to-google-sheets-using-zapier"+ color="primary"+ class="mt-4"+ >+ Zapier Integration Guide+ </VBtn>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="2">+ <VImg class="mb-4" max-height="400" :src="'/img/zapier-logo.svg'" />+ </VCol>+ </VRow>++ <!-- Webhooks -->+ <VRow class="mb-16 mt-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="2">+ <div>+ <h3 class="text-h3 mb-1">Webhooks</h3>+ <h5 class="text-h6 font-weight-light">+ If you want to build advanced integrations, we support callback+ URLs. The httpSMS platform can forward SMS messages received on+ your Android phone to your server using a callback URL which you+ provide.+ </h5>+ <VBtn+ target="_blank"+ href="https://docs.httpsms.com/webhooks/introduction"+ color="primary"+ class="mt-4"+ >+ <VIcon start :icon="mdiWebhook" />+ Documentation+ </VBtn>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="1">+ <VImg class="mb-4" max-height="300" :src="'/img/connection.svg'" />+ </VCol>+ </VRow>++ <!-- Control Sending -->+ <VRow class="mb-16 mt-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="1">+ <div>+ <h3 class="text-h3 mb-1">Control Sending</h3>+ <h5 class="text-h6 font-weight-light">+ Send SMS messages without going over your mobile carrier+ limitations. If you set a rate e.g 3 messages per minute, we+ will queue up your messages and send them at a rate of 1 message+ per 20 seconds.+ </h5>+ <VBtn+ href="https://docs.httpsms.com/features/control-sms-send-rate"+ color="primary"+ >+ <VIcon start :icon="mdiArrowRightThin" />+ Documentation+ </VBtn>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="2">+ <VImg class="mb-4" max-height="300" :src="'/img/queue.svg'" />+ </VCol>+ </VRow>++ <!-- Monitoring -->+ <VRow class="mb-16 mt-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="2">+ <div>+ <h3 class="text-h3 mb-1">Monitoring</h3>+ <h5 class="text-h6 font-weight-light">+ If your android phone goes offline for some reason and it can't+ send SMS messages, we will send you a notification immediately.+ </h5>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="1">+ <VImg class="mb-4" max-height="300" :src="'/img/alert.svg'" />+ </VCol>+ </VRow>++ <!-- Open Source -->+ <VRow class="mt-16 mb-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="1">+ <div>+ <h3 class="text-h3 mb-1">Open Source</h3>+ <h5 class="text-h6 mb-3 font-weight-light">+ httpSMS is transparent and fully open source. The source code is+ available on GitHub. Feel free to fork it, verify it or submit a+ pull request.+ </h5>+ <a+ class="text-decoration-none"+ :href="config.public.appGithubUrl"+ >+ <img+ alt="GitHub Repo stars"+ src="https://img.shields.io/github/stars/NdoleStudio/httpsms?style=social"+ />+ </a>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="2">+ <VImg+ class="mb-4"+ max-height="400"+ :src="'/img/httpsms-github.png'"+ />+ </VCol>+ </VRow>++ <!-- Encryption -->+ <VRow class="mt-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="2">+ <div>+ <h3 class="text-h3 mb-1">Encryption 🔐</h3>+ <h5 class="text-h6 mb-3 font-weight-light">+ Take control of your privacy with our end-to-end encrypted SMS+ feature. Safeguard your messages from prying eyes, ensuring+ absolute confidentiality using the military grade+ <a+ class="text-decoration-none"+ href="https://en.wikipedia.org/wiki/Advanced_Encryption_Standard"+ >AES-256 encryption</a+ >+ algorithm.+ </h5>+ <VBtn+ to="/blog/end-to-end-encryption-to-sms-messages"+ color="primary"+ >+ Setup end-to-end encryption+ </VBtn>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="1">+ <VImg+ class="mb-4"+ max-height="300"+ :src="'/img/mobile-encryption.svg'"+ />+ </VCol>+ </VRow>++ <!-- Multiple Phones -->+ <VRow class="mt-16">+ <VCol cols="12" md="6" class="d-flex align-center">+ <div>+ <h3 class="text-h3 mb-1">Multiple Phones</h3>+ <h5 class="text-h6 mb-3 font-weight-light">+ Setup the httpSMS gateway Android app on multiple phones+ independently and securely without sharing data under one+ account by creating unique phone API keys.+ </h5>+ <VBtn+ href="https://docs.httpsms.com/features/phone-api-keys"+ color="primary"+ >+ <VIcon start :icon="mdiCellphoneKey" />+ Documentation+ </VBtn>+ </div>+ </VCol>+ <VCol cols="12" md="6">+ <VImg+ class="mb-4"+ max-height="300"+ :src="'/img/manage-phones.svg'"+ />+ </VCol>+ </VRow>++ <!-- Schedule Messages -->+ <VRow class="mt-16">+ <VCol cols="12" md="6" class="d-flex align-center" order-lg="2">+ <div>+ <h3 class="text-h3 mb-1">Schedule Text Messages</h3>+ <h5 class="text-h6 mb-3 font-weight-light">+ Control when your SMS will reach your recipients, allowing you+ to perfectly time promotions, critical alerts etc by scheduling+ your messages in advance.+ </h5>+ <VBtn+ href="https://docs.httpsms.com/features/scheduling-sms-messages"+ color="primary"+ >+ <VIcon start :icon="mdiClockOutline" />+ Documentation+ </VBtn>+ </div>+ </VCol>+ <VCol cols="12" md="6" order-lg="1">+ <VImg+ class="mb-4"+ max-height="300"+ :src="'/img/schedule-messages.svg'"+ />+ </VCol>+ </VRow>+ </VContainer>+ </VSheet>++ <!-- Get Started Section -->+ <VContainer class="pb-16">+ <VRow class="mt-16">+ <VCol>+ <h2 class="text-h3 text-center">Get Started</h2>+ </VCol>+ </VRow>+ <VRow>+ <VCol cols="12">+ <VRow>+ <VCol cols="12" md="5" class="pr-4">+ <VTimeline density="compact" class="mt-10 ml-n4">+ <VTimelineItem dot-color="primary" :icon="mdiTallyMark1">+ <VCard variant="elevated">+ <VCardTitle class="text-h5">Step 1</VCardTitle>+ <VCardText class="text-subtitle-1">+ <NuxtLink+ class="font-weight-bold text-decoration-none"+ to="/login"+ >+ Create an account+ </NuxtLink>+ on httpsms.com and obtain your API key on the settings+ page.+ </VCardText>+ </VCard>+ </VTimelineItem>+ <VTimelineItem dot-color="primary" :icon="mdiTallyMark2">+ <VCard variant="elevated">+ <VCardTitle class="text-h5">Step 2</VCardTitle>+ <VCardText class="text-subtitle-1">+ <a+ download+ class="font-weight-bold text-decoration-none"+ :href="config.public.appDownloadUrl"+ >Download</a+ >+ and install the companion android application on your+ phone and sign in using your API Key.+ </VCardText>+ </VCard>+ </VTimelineItem>+ <VTimelineItem dot-color="primary" :icon="mdiTallyMark3">+ <VCard variant="elevated">+ <VCardTitle class="text-h5">Step 3</VCardTitle>+ <VCardText class="text-subtitle-1">+ Start sending and receiving SMS messages using our rich+ HTTP API. You can find the documentation on+ <a+ class="text-decoration-none"+ :href="config.public.appDocumentationUrl"+ >+ {{ config.public.appDocumentationUrl }}+ </a>+ </VCardText>+ </VCard>+ </VTimelineItem>+ </VTimeline>+ </VCol>+ <VCol cols="12" md="7" :class="{ 'pt-16 mb-16': mdAndUp }">+ <div class="w-100 mt-4">+ <VTabs v-model="selectedTab" show-arrows>+ <VTab value="javascript">+ <VIcon+ color="#efd81d"+ class="mr-1"+ :icon="mdiLanguageJavascript"+ />+ Javascript+ </VTab>+ <VTab value="php">+ <VIcon+ color="#777bb3"+ class="mr-2"+ :icon="mdiLanguagePhp"+ />+ PHP+ </VTab>+ <VTab value="python">+ <VIcon+ color="#ffffff"+ class="mr-2"+ :icon="mdiLanguagePython"+ />+ Python+ </VTab>+ <VTab value="go">+ <VIcon color="#00aed8" class="mr-2" :icon="mdiLanguageGo" />+ Go+ </VTab>+ <VTab value="java">+ <VIcon+ color="#0c89c7"+ class="mr-2"+ :icon="mdiLanguageJava"+ />+ Java+ </VTab>+ <VTab value="curl">+ <VIcon color="primary" class="mr-2" :icon="mdiPowershell" />+ cURL+ </VTab>+ <VTab value="c-sharp">+ <VIcon+ color="#68217a"+ class="mr-2"+ :icon="mdiLanguageCsharp"+ />+ C#+ </VTab>+ </VTabs>+ <VTabsWindow v-model="selectedTab">+ <VTabsWindowItem value="javascript">+ <pre+ class="pa-4 bg-surface-variant rounded mt-2"+ ><code>import HttpSms from 'httpsms'++const client = new HttpSms('' /* Get the API Key from https://httpsms.com/settings */);++client.messages.postSend({+ content: 'This is a sample text message',+ from: '+18005550199', // Put the correct phone number here+ to: '+18005550100', // Put the correct phone number here+})+.then((message) => {+ console.log(message.id); // log the ID of the sent message+})</code></pre>+ </VTabsWindowItem>+ <VTabsWindowItem value="php">+ <pre+ class="pa-4 bg-surface-variant rounded mt-2"+ ><code><?php+$apiKey = "Get API Key from https://httpsms.com/settings";++$options = array(+ 'http' => array(+ 'method' => 'POST',+ 'content' => json_encode( [+ 'content' => 'This is a sample text message',+ 'from' => "+18005550199",+ 'to' => "+18005550100"+ ]),+ 'header'=> "Content-Type: application/json\r\n" .+ "Accept: application/json\r\n" .+ "x-api-key: $apiKey\r\n"+ )+);++$context = stream_context_create( $options );+$result = file_get_contents( "https://api.httpsms.com/v1/messages/send", false, $context );++echo $result;</code></pre>+ </VTabsWindowItem>+ <VTabsWindowItem value="python">+ <pre+ class="pa-4 bg-surface-variant rounded mt-2"+ ><code>import requests+import json++api_key = "Get API Key from https://httpsms.com/settings"++url = 'https://api.httpsms.com/v1/messages/send'++headers = {+ 'x-api-key': api_key,+ 'Accept': 'application/json',+ 'Content-Type': 'application/json'+}++payload = {+ "content": "This is a sample text message",+ "from": "+18005550199",+ "to": "+18005550100"+}++response = requests.post(url, headers=headers, data=json.dumps(payload))++print(json.dumps(response.json(), indent=4))</code></pre>+ </VTabsWindowItem>+ <VTabsWindowItem value="go">+ <pre+ class="pa-4 bg-surface-variant rounded mt-2"+ ><code>import "github.com/NdoleStudio/httpsms-go"++client := htpsms.New(htpsms.WithAPIKey(/* API Key from https://httpsms.com/settings */))++client.Messages.Send(context.Background(), &httpsms.MessageSendParams{+ Content: "This is a sample text message",+ From: "+18005550199",+ To: "+18005550100",+})</code></pre>+ </VTabsWindowItem>+ <VTabsWindowItem value="java">+ <pre+ class="pa-4 bg-surface-variant rounded mt-2"+ ><code>var client = HttpClient.newHttpClient();+var apiKey = "Get API Key from https://httpsms.com/settings";++var payload = """+ {+ "content": "This is a sample text message",+ "from": "+18005550199",+ "to": "+18005550100"+ }+ """;++var request = HttpRequest.newBuilder()+ .uri(URI.create("https://api.httpsms.com/v1/messages/send"))+ .header("accept", "application/json")+ .header("Content-Type", "application/json")+ .header("x-api-key", apiKey)+ .POST(HttpRequest.BodyPublishers.ofString(payload))+ .build();++var response = client.send(request, HttpResponse.BodyHandlers.ofString());+System.out.println(response.body());</code></pre>+ </VTabsWindowItem>+ <VTabsWindowItem value="curl">+ <pre+ class="pa-4 bg-surface-variant rounded mt-2"+ ><code>curl --location --request POST 'https://api.httpsms.com/v1/messages/send' \+--header 'x-api-key: Get API Key from https://httpsms.com/settings' \+--header 'Content-Type: application/json' \+--data-raw '{+ "from": "+18005550199",+ "to": "+18005550100",+ "content": "This is a sample text message"+}'</code></pre>+ </VTabsWindowItem>+ <VTabsWindowItem value="c-sharp">+ <pre+ class="pa-4 bg-surface-variant rounded mt-2"+ ><code>var client = new HttpClient();+client.DefaultRequestHeaders.Add("x-api-key", ""/* Get API Key from https://httpsms.com/settings */);++var response = await client.PostAsync(+ "https://api.httpsms.com/v1/messages/send",+ new StringContent(+ JsonSerializer.Serialize(new {+ from = "+18005550199",+ To = "+18005550100",+ Content = "This is a sample text message",+ }),+ Encoding.UTF8,+ "application/json"+ )+);++Console.WriteLine(await response.Content.ReadAsStringAsync());</code></pre>+ </VTabsWindowItem>+ </VTabsWindow>+ </div>+ </VCol>+ </VRow>+ </VCol>+ </VRow>+ </VContainer>++ <!-- Pricing Section -->+ <VSheet class="mt-16 pb-16">+ <VContainer>+ <VRow>+ <VCol class="mt-16" md="6" offset-md="3">+ <h2+ id="pricing"+ class="text-center text-h2 mb-4 text-decoration-underline text-primary"+ >+ Pricing+ </h2>+ <h4 class="text-center text-h5 text-medium-emphasis">+ Most of the httpSMS features are completely+ <span class="text-primary">free</span> but if you want a little+ extra, you can go pro+ </h4>+ <div class="d-flex justify-center mt-4 align-center">+ <p class="text-h6 mr-3 mt-3">Monthly</p>+ <VSwitch v-model="yearlyPricing" hide-details />+ <p class="text-h6 ml-3 mt-3">+ Yearly+ <VChip color="primary" size="small">+ <VIcon start :icon="mdiGift" size="small" />+ 2 months free+ </VChip>+ </p>+ </div>+ </VCol>+ </VRow>+ <VRow>+ <VCol cols="12">+ <VSlider+ v-model="pricing"+ :tick-labels="lgAndUp ? pricingLabelsFull : pricingLabels"+ :max="4"+ step="1"+ thumb-label="always"+ thumb-size="32"+ show-ticks="always"+ >+ <template #thumb-label>+ {{ pricingLabels[pricing] }}+ </template>+ </VSlider>+ </VCol>+ </VRow>+ <VRow>+ <!-- Free Plan -->+ <VCol cols="12" lg="4">+ <VCard elevation="4" color="#121212">+ <VCardText>+ <h1 class="text-center text-h3">Free</h1>+ <p class="text-subtitle-1 text-center">+ Try sending and receiving SMS on your hobby websites and+ experiments.+ </p>+ <p class="text-center">+ <span class="text-h3">$0</span>+ </p>+ <p class="text-center mt-n3">No credit card required</p>+ <VBtn block to="/login" size="large">Get Started</VBtn>+ <p class="mt-8 text-subtitle-1">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Send or receive up to <b>200</b> SMS/month+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Offline notifications for your phone+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Forward received messages via webhook+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Basic email support+ </p>+ </VCardText>+ </VCard>+ </VCol>+ <!-- Pro Plan -->+ <VCol cols="12" lg="4">+ <VCard elevation="4" color="black">+ <VCardText>+ <h1 class="text-center text-h3 text-primary">Pro</h1>+ <p class="text-subtitle-1 text-center">+ Send and receive more SMS messages like a pro with advanced+ features.+ </p>+ <p v-if="!yearlyPricing" class="text-center">+ <span class="text-h3">$10</span>/month+ </p>+ <p v-else class="text-center">+ <span class="text-h3">$100</span>/year+ </p>+ <p v-if="!yearlyPricing" class="text-center mt-n3">+ or <b>$100</b> per year+ </p>+ <p v-else class="text-center mt-n3">+ or <b>$8.33</b> per month+ </p>+ <VBtn block color="primary" to="/login" size="large"+ >Try For Free</VBtn+ >+ <p class="mt-8 text-subtitle-1">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Send or receive up to <b>5,000</b> SMS/month+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Offline notifications for your phone+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Forward received messages via webhook+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Priority support+ </p>+ </VCardText>+ </VCard>+ </VCol>+ <!-- Custom Plan -->+ <VCol cols="12" lg="4">+ <VCard color="#121212" variant="outlined">+ <VCardText>+ <h1 class="text-center text-h3">+ {{ pricingLabels[pricing] }} Plan+ </h1>+ <p class="text-subtitle-1 text-center">+ Send and receive up to {{ planMessages }} SMS messages like a+ power user.+ </p>+ <p v-if="!yearlyPricing" class="text-center">+ <span class="text-h3">${{ planMonthlyPrice }}</span+ >/month+ </p>+ <p v-else class="text-center">+ <span class="text-h3">${{ planYearlyPrice }}</span+ >/year+ </p>+ <p v-if="!yearlyPricing" class="text-center mt-n3">+ or <b>${{ planYearlyPrice }}</b> per year+ </p>+ <p v-else class="text-center mt-n3">+ or <b>${{ planYearlyMonthlyPrice }}</b> per month+ </p>+ <VBtn block variant="tonal" to="/login" size="large"+ >Try For Free</VBtn+ >+ <p class="mt-8 text-subtitle-1">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Send or receive up to+ <b>{{ pricingLabels[pricing] }}</b> SMS/month+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Offline notifications for your phone+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Forward received messages via webhook+ </p>+ <p class="text-subtitle-1 mt-n4">+ <VIcon+ color="primary"+ class="mt-n1"+ start+ :icon="mdiCheckCircle"+ />+ Priority support+ </p>+ </VCardText>+ </VCard>+ </VCol>+ </VRow>+ <VRow>+ <VCol>+ <VAlert+ color="info"+ :icon="mdAndUp ? mdiLightbulbOn60 : undefined"+ :prominent="mdAndUp"+ variant="tonal"+ >+ Feel free to <a href="mailto:[email protected]">contact us</a> if+ you need a bigger plan, or if you want us to install the httpSMS+ API on your dedicated server. If you would still like to support+ us, please donate via+ <a href="https://github.com/sponsors/NdoleStudio"+ >GitHub Sponsors</a+ >.+ </VAlert>+ </VCol>+ </VRow>+ </VContainer>+ </VSheet>++ <!-- FAQ Section -->+ <VContainer class="pb-16 mt-16">+ <VRow>+ <VCol md="8" offset-md="2" class="mb-16">+ <VExpansionPanels v-model="faqPanel">+ <VExpansionPanel>+ <VExpansionPanelTitle class="text-h6">+ Can I install the app on my iPhone?+ <template #actions>+ <VIcon :icon="faqPanel === 0 ? mdiMinus : mdiPlus" />+ </template>+ </VExpansionPanelTitle>+ <VExpansionPanelText>+ <p class="mt-4">+ The httpSMS application works only on Android phones at the+ moment since Apple doesn't allow you to install a custom SMS+ messaging app.+ </p>+ </VExpansionPanelText>+ </VExpansionPanel>+ <VExpansionPanel>+ <VExpansionPanelTitle class="text-h6">+ What's the minimum supported Android version?+ <template #actions>+ <VIcon :icon="faqPanel === 1 ? mdiMinus : mdiPlus" />+ </template>+ </VExpansionPanelTitle>+ <VExpansionPanelText>+ <p class="mt-4">+ The httpSMS Android app works from Android 9 (Pie) and above.+ So you can install the application on your old Android phone+ which you don't use anymore.+ </p>+ </VExpansionPanelText>+ </VExpansionPanel>+ <VExpansionPanel>+ <VExpansionPanelTitle class="text-h6">+ Can I send unlimited number of messages per month?+ <template #actions>+ <VIcon :icon="faqPanel === 2 ? mdiMinus : mdiPlus" />+ </template>+ </VExpansionPanelTitle>+ <VExpansionPanelText>+ <p class="mt-4">+ We do have packages that allow up to 100,000 SMS messages per+ month but you can+ <a href="mailto:[email protected]">send us an email</a> if+ you will like to send more messages so we create a custom plan+ just for you.+ </p>+ </VExpansionPanelText>+ </VExpansionPanel>+ <VExpansionPanel>+ <VExpansionPanelTitle class="text-h6">+ Can I change the sender of the SMS message?+ <template #actions>+ <VIcon :icon="faqPanel === 3 ? mdiMinus : mdiPlus" />+ </template>+ </VExpansionPanelTitle>+ <VExpansionPanelText>+ <p class="mt-4">+ No you cannot. When you send an SMS message using the httpSMS+ app it uses your SIM card to send the message so the recipient+ will see your phone number as the sender of the SMS. You+ cannot use your brand name as the sender ID.+ </p>+ </VExpansionPanelText>+ </VExpansionPanel>+ </VExpansionPanels>+ </VCol>+ </VRow>+ </VContainer>+ </div>+</template>++<style lang="scss">+.gradient-header {+ color: #1ad37f;+ background-image: -webkit-linear-gradient(0deg, #1ad37f 14%, #329ef4 55%);+ -webkit-background-clip: text;+ -webkit-text-fill-color: transparent;+}++.gradient-underline {+ color: white;+}+</style>diff --git a/web/app/pages/login.vue b/web/app/pages/login.vuenew file mode 100644index 00000000..c910fe22--- /dev/null+++ b/web/app/pages/login.vue@@ -0,0 +1,45 @@+<script setup lang="ts">+import { mdiArrowLeft } from "@mdi/js";++definePageMeta({+ middleware: ["guest"],+ layout: "website",+});++useHead({+ title: "Login To Your Account - HTTP SMS",+});++const route = useRoute();+const to = computed(() => (route.query.to as string) || "/threads");+</script>++<template>+ <VContainer fluid class="fill-height">+ <VRow align="center" justify="center">+ <VCol cols="12" md="4" xl="3">+ <div class="text-center mb-5">+ <VAvatar size="45" class="mt-n8 mr-4">+ <VImg :src="'/img/logo.svg'" />+ </VAvatar>+ <span class="text-h3">Welcome</span>+ </div>+ <p class="text-subtitle-1 text-center text-medium-emphasis mt-1 mb-4">+ Join <b>23,273+</b> users who send/receive more than+ <br />+ <b>500,000</b> messages per month+ </p>+ <VCard max-width="360" class="mx-auto">+ <VCardText class="px-0">+ <ClientOnly>+ <FirebaseAuth :to="to" />+ </ClientOnly>+ </VCardText>+ </VCard>+ <div class="text-center mt-4">+ <BackButton />+ </div>+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/messages/index.vue b/web/app/pages/messages/index.vuenew file mode 100644index 00000000..e5091ca6--- /dev/null+++ b/web/app/pages/messages/index.vue@@ -0,0 +1,147 @@+<script setup lang="ts">+import { mdiArrowLeft, mdiSend, mdiCircle } from "@mdi/js";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "New Message - httpSMS",+});++const router = useRouter();+const { mdAndDown } = useDisplay();+const notificationsStore = useNotificationsStore();+const phonesStore = usePhonesStore();+const messagesStore = useMessagesStore();+const { useApi } = useApiComposable();++const sending = ref(false);+const formPhoneNumber = ref("");+const formContent = ref("");+const formAttachments = ref("");+const errors = ref(new Map<string, string[]>());++async function sendMessage() {+ errors.value = new Map();+ sending.value = true;++ try {+ const api = useApi();+ await api("/v1/messages/send", {+ method: "POST",+ body: {+ to: formPhoneNumber.value,+ from: phonesStore.owner,+ content: formContent.value,+ attachments: formAttachments.value+ .trim()+ .split(",")+ .filter((x) => x.trim() !== "")+ .map((x) => x.trim()),+ },+ });+ notificationsStore.addNotification({+ message: "Message Sent!",+ type: "success",+ });+ await router.push("/threads");+ } catch (err: any) {+ const data = err?.data?.data;+ if (data) {+ const newErrors = new Map<string, string[]>();+ if (data.content) newErrors.set("content", data.content);+ if (data.to)+ newErrors.set(+ "to",+ data.to.map((x: string) =>+ x.replace("to field", "phone number field"),+ ),+ );+ if (data.attachments) newErrors.set("attachments", data.attachments);+ if (data.from) {+ notificationsStore.addNotification({+ message: data.from[0],+ type: "error",+ });+ }+ errors.value = newErrors;+ }+ } finally {+ sending.value = false;+ }+}+</script>++<template>+ <VContainer fluid class="pa-0" :class="{ 'fill-height': true }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>+ New Message+ <VIcon+ size="x-small"+ class="mx-2"+ color="primary"+ :icon="mdiCircle"+ />+ {{ useFilters().phoneNumber(phonesStore.owner) }}+ </VToolbarTitle>+ </VAppBar>+ <VContainer class="mt-16">+ <VRow>+ <VCol cols="12" md="8" offset-md="2" xl="6" offset-xl="3">+ <form @submit.prevent="sendMessage">+ <VTextField+ v-model="formPhoneNumber"+ :disabled="sending"+ :error="errors.has('to')"+ :error-messages="errors.get('to')"+ variant="outlined"+ persistent-placeholder+ placeholder="Recipient phone number e.g +18005550199"+ label="Phone Number"+ />+ <VTextarea+ v-model="formContent"+ :error="errors.has('content')"+ :error-messages="errors.get('content')"+ :disabled="sending"+ variant="outlined"+ persistent-placeholder+ placeholder="Enter your message here"+ label="Content"+ />+ <VTextarea+ v-model="formAttachments"+ :error="errors.has('attachments')"+ :error-messages="errors.get('attachments')"+ :disabled="sending"+ variant="outlined"+ rows="2"+ class="mb-8"+ persistent-placeholder+ persistent-hint+ hint="The message will be sent as an MMS when a comma separated list of attachment URLs are present"+ placeholder="https://example.com/image.jpg, https://example.com/video.mp4"+ label="Attachment URLs (optional)"+ />+ <VBtn+ type="submit"+ color="primary"+ :disabled="sending"+ :block="mdAndDown"+ >+ <VIcon :icon="mdiSend" />+ Send Message+ </VBtn>+ </form>+ </VCol>+ </VRow>+ </VContainer>+ </div>+ </VContainer>+</template>diff --git a/web/app/pages/phone-api-keys/index.vue b/web/app/pages/phone-api-keys/index.vuenew file mode 100644index 00000000..153f3265--- /dev/null+++ b/web/app/pages/phone-api-keys/index.vue@@ -0,0 +1,186 @@+<script setup lang="ts">+import {+ mdiArrowLeft,+ mdiCellphoneKey,+ mdiPlus,+ mdiDelete,+ mdiContentCopy,+} from "@mdi/js";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Phone API Keys - httpSMS",+});++const { mdAndDown, lgAndUp } = useDisplay();+const authStore = useAuthStore();+const notificationsStore = useNotificationsStore();+const { useApi } = useApiComposable();++const loading = ref(true);+const phoneApiKeys = ref<any[]>([]);+const createDialog = ref(false);+const formName = ref("");+const creating = ref(false);++async function loadPhoneApiKeys() {+ loading.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: any[] }>("/v1/phone-api-keys");+ phoneApiKeys.value = response.data ?? [];+ } finally {+ loading.value = false;+ }+}++async function createPhoneApiKey() {+ creating.value = true;+ try {+ const api = useApi();+ await api("/v1/phone-api-keys", {+ method: "POST",+ body: { name: formName.value },+ });+ notificationsStore.addNotification({+ message: "Phone API Key created",+ type: "success",+ });+ createDialog.value = false;+ formName.value = "";+ await loadPhoneApiKeys();+ } catch {+ notificationsStore.addNotification({+ message: "Failed to create Phone API Key",+ type: "error",+ });+ } finally {+ creating.value = false;+ }+}++async function deletePhoneApiKey(id: string) {+ try {+ const api = useApi();+ await api(`/v1/phone-api-keys/${id}`, { method: "DELETE" });+ notificationsStore.addNotification({+ message: "Phone API Key deleted",+ type: "success",+ });+ await loadPhoneApiKeys();+ } catch {+ notificationsStore.addNotification({+ message: "Failed to delete Phone API Key",+ type: "error",+ });+ }+}++async function copyApiKey(key: string) {+ await navigator.clipboard.writeText(key);+ notificationsStore.addNotification({+ message: "API Key copied to clipboard",+ type: "success",+ });+}++onMounted(async () => {+ await authStore.loadUser();+ await loadPhoneApiKeys();+});+</script>++<template>+ <VContainer fluid class="px-0 pt-0" :class="{ 'fill-height': lgAndUp }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>+ <VIcon :icon="mdiCellphoneKey" class="mr-2" />+ Phone API Keys+ </VToolbarTitle>+ </VAppBar>+ <VContainer class="mt-16">+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h4 class="text-h4 mb-3">Phone API Keys</h4>+ <p class="text-medium-emphasis">+ Create separate API keys for each phone. This allows you to manage+ multiple phones independently and securely.+ </p>+ <VProgressLinear v-if="loading" indeterminate class="mb-4" />+ <VTable v-else-if="phoneApiKeys.length" class="mb-4">+ <thead>+ <tr class="text-uppercase text-subtitle-2">+ <th class="text-left">Name</th>+ <th class="text-left">API Key</th>+ <th class="text-center">Created</th>+ <th class="text-center">Actions</th>+ </tr>+ </thead>+ <tbody>+ <tr v-for="key in phoneApiKeys" :key="key.id">+ <td>{{ key.name }}</td>+ <td class="text-break">+ {{ key.api_key?.substring(0, 12) }}...+ </td>+ <td class="text-center">+ {{ useFilters().timestamp(key.created_at) }}+ </td>+ <td class="text-center">+ <VBtn icon size="small" @click="copyApiKey(key.api_key)">+ <VIcon size="small" :icon="mdiContentCopy" />+ </VBtn>+ <VBtn+ icon+ size="small"+ color="error"+ @click="deletePhoneApiKey(key.id)"+ >+ <VIcon size="small" :icon="mdiDelete" />+ </VBtn>+ </td>+ </tr>+ </tbody>+ </VTable>+ <VBtn color="primary" @click="createDialog = true">+ <VIcon start :icon="mdiPlus" />+ Create Phone API Key+ </VBtn>++ <VDialog v-model="createDialog" max-width="500">+ <VCard>+ <VCardTitle>Create Phone API Key</VCardTitle>+ <VCardText>+ <VTextField+ v-model="formName"+ variant="outlined"+ label="Name"+ placeholder="My Phone"+ />+ </VCardText>+ <VCardActions>+ <VBtn+ color="primary"+ :loading="creating"+ @click="createPhoneApiKey"+ >Create</VBtn+ >+ <VSpacer />+ <VBtn variant="text" @click="createDialog = false"+ >Cancel</VBtn+ >+ </VCardActions>+ </VCard>+ </VDialog>+ </VCol>+ </VRow>+ </VContainer>+ </div>+ </VContainer>+</template>diff --git a/web/app/pages/privacy-policy/index.vue b/web/app/pages/privacy-policy/index.vuenew file mode 100644index 00000000..9c752521--- /dev/null+++ b/web/app/pages/privacy-policy/index.vue@@ -0,0 +1,55 @@+<script setup lang="ts">+definePageMeta({+ layout: "website",+});++useHead({+ title: "Privacy Policy - httpSMS",+});+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-6">Privacy Policy</h1>+ <p class="text-medium-emphasis mb-4">Last updated: January 1, 2024</p>++ <h2 class="text-h5 mt-6 mb-3">1. Information We Collect</h2>+ <p>+ We collect information you provide directly to us, including your+ email address, phone number, and any SMS messages processed through+ our service. We also collect usage data such as IP address, browser+ type, and device information.+ </p>++ <h2 class="text-h5 mt-6 mb-3">2. How We Use Your Information</h2>+ <p>+ We use the information we collect to provide, maintain, and improve+ our services, process SMS messages, send you technical notices, and+ respond to your requests.+ </p>++ <h2 class="text-h5 mt-6 mb-3">3. Data Security</h2>+ <p>+ We take reasonable measures to protect your personal information. SMS+ messages can be encrypted end-to-end using AES-256 encryption when you+ enable the encryption feature.+ </p>++ <h2 class="text-h5 mt-6 mb-3">4. Data Retention</h2>+ <p>+ We retain your SMS messages and account data as long as your account+ is active. You can request deletion of your data at any time by+ contacting us.+ </p>++ <h2 class="text-h5 mt-6 mb-3">5. Contact Us</h2>+ <p>+ If you have questions about this Privacy Policy, please contact us at+ <a href="mailto:[email protected]">[email protected]</a>.+ </p>+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/search-messages/index.vue b/web/app/pages/search-messages/index.vuenew file mode 100644index 00000000..cc6c6a62--- /dev/null+++ b/web/app/pages/search-messages/index.vue@@ -0,0 +1,131 @@+<script setup lang="ts">+import { mdiArrowLeft, mdiMagnify } from "@mdi/js";+import type { Message } from "~/shared/types/message";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Search Messages - httpSMS",+});++const route = useRoute();+const { mdAndDown, lgAndUp } = useDisplay();+const messagesStore = useMessagesStore();+const authStore = useAuthStore();++const loading = ref(false);+const searchQuery = ref((route.query.query as string) || "");+const messages = ref<Message[]>([]);++async function searchMessages() {+ if (!searchQuery.value.trim()) return;+ loading.value = true;+ try {+ messages.value = await messagesStore.searchMessages(searchQuery.value);+ } finally {+ loading.value = false;+ }+}++onMounted(async () => {+ await authStore.loadUser();+ if (searchQuery.value) {+ await searchMessages();+ }+});+</script>++<template>+ <VContainer fluid class="px-0 pt-0" :class="{ 'fill-height': lgAndUp }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>+ <div class="py-16">Search Messages</div>+ </VToolbarTitle>+ <VProgressLinear+ :active="loading"+ :indeterminate="loading"+ location="bottom"+ absolute+ />+ </VAppBar>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <form @submit.prevent="searchMessages">+ <VTextField+ v-model="searchQuery"+ variant="outlined"+ persistent-placeholder+ placeholder="Search by message ID, request ID, or content"+ label="Search"+ :append-inner-icon="mdiMagnify"+ @click:append-inner="searchMessages"+ />+ </form>+ </VCol>+ </VRow>+ <VRow v-if="messages.length > 0">+ <VCol cols="12">+ <VTable>+ <thead>+ <tr class="text-uppercase text-subtitle-2">+ <th class="text-left">Contact</th>+ <th class="text-left">Content</th>+ <th class="text-center">Type</th>+ <th class="text-center">Status</th>+ <th class="text-center">Date</th>+ </tr>+ </thead>+ <tbody>+ <tr v-for="message in messages" :key="message.id">+ <td class="text-left">+ {{ useFilters().phoneNumber(message.contact) }}+ </td>+ <td class="text-left">+ {{ message.content?.substring(0, 50)+ }}{{ (message.content?.length ?? 0) > 50 ? "..." : "" }}+ </td>+ <td class="text-center">+ {{+ message.type === "mobile-terminated" ? "Sent" : "Received"+ }}+ </td>+ <td class="text-center">+ <VChip+ :color="+ message.status === 'delivered'+ ? 'success'+ : message.status === 'failed'+ ? 'error'+ : 'default'+ "+ size="small"+ >+ {{ message.status }}+ </VChip>+ </td>+ <td class="text-center">+ {{ useFilters().timestamp(message.order_timestamp) }}+ </td>+ </tr>+ </tbody>+ </VTable>+ </VCol>+ </VRow>+ <VRow v-else-if="!loading && searchQuery">+ <VCol cols="12" class="text-center">+ <p class="text-medium-emphasis mt-8">+ No messages found for "{{ searchQuery }}"+ </p>+ </VCol>+ </VRow>+ </VContainer>+ </div>+ </VContainer>+</template>diff --git a/web/app/pages/settings/index.vue b/web/app/pages/settings/index.vuenew file mode 100644index 00000000..b250177a--- /dev/null+++ b/web/app/pages/settings/index.vue@@ -0,0 +1,602 @@+<script setup lang="ts">+import {+ mdiArrowLeft,+ mdiAccountCircle,+ mdiShieldCheck,+ mdiEye,+ mdiEyeOff,+ mdiQrcode,+ mdiRefresh,+ mdiLinkVariant,+ mdiSquareEditOutline,+ mdiDelete,+ mdiContentSave,+} from "@mdi/js";+import QRCode from "qrcode";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Settings - httpSMS",+});++const config = useRuntimeConfig();+const { mdAndDown, mdAndUp, lgAndUp, xlAndUp } = useDisplay();+const authStore = useAuthStore();+const billingStore = useBillingStore();+const notificationsStore = useNotificationsStore();+const { useApi } = useApiComposable();++const apiKey = ref("");+const apiKeyShow = ref(false);+const showQrCodeDialog = ref(false);+const showRotateApiKey = ref(false);+const rotatingApiKey = ref(false);+const qrCodeCanvas = ref<HTMLCanvasElement | null>(null);++// Webhooks+const loadingWebhooks = ref(true);+const webhooks = ref<any[]>([]);+const updatingWebhook = ref(false);+const webhookDialog = ref(false);+const webhookForm = ref({+ id: "",+ url: "",+ events: [] as string[],+ phoneId: "",+});+const webhookEvents = [+ "message.phone.received",+ "message.phone.sent",+ "message.send.failed",+ "message.send.expired",+ "phone.heartbeat.offline",+];++// Discord+const loadingDiscordIntegrations = ref(true);+const discords = ref<any[]>([]);+const updatingDiscord = ref(false);+const discordDialog = ref(false);+const discordForm = ref({+ id: "",+ name: "",+ server_id: "",+ incoming_channel_id: "",+});++// Send Schedules+const loadingSendSchedules = ref(true);+const sendSchedules = ref<any[]>([]);++// Timezones+const timezones = Intl.supportedValuesOf("timeZone");++async function loadApiKey() {+ const key = await authStore.loadApiKey();+ apiKey.value = key;+}++async function rotateApiKey() {+ rotatingApiKey.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: { api_key: string } }>(+ "/v1/users/api-keys",+ { method: "PUT" },+ );+ apiKey.value = response.data.api_key;+ showRotateApiKey.value = false;+ notificationsStore.addNotification({+ message: "API Key rotated successfully",+ type: "success",+ });+ } catch {+ notificationsStore.addNotification({+ message: "Failed to rotate API Key",+ type: "error",+ });+ } finally {+ rotatingApiKey.value = false;+ }+}++function generateQrCode() {+ showQrCodeDialog.value = true;+ nextTick(() => {+ if (qrCodeCanvas.value) {+ QRCode.toCanvas(qrCodeCanvas.value, apiKey.value, {+ width: 300,+ margin: 2,+ });+ }+ });+}++async function loadWebhooks() {+ loadingWebhooks.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: any[] }>("/v1/webhooks");+ webhooks.value = response.data ?? [];+ } finally {+ loadingWebhooks.value = false;+ }+}++async function saveWebhook() {+ updatingWebhook.value = true;+ try {+ const api = useApi();+ if (webhookForm.value.id) {+ await api(`/v1/webhooks/${webhookForm.value.id}`, {+ method: "PUT",+ body: { url: webhookForm.value.url, events: webhookForm.value.events },+ });+ } else {+ await api("/v1/webhooks", {+ method: "POST",+ body: { url: webhookForm.value.url, events: webhookForm.value.events },+ });+ }+ webhookDialog.value = false;+ notificationsStore.addNotification({+ message: "Webhook saved",+ type: "success",+ });+ await loadWebhooks();+ } catch {+ notificationsStore.addNotification({+ message: "Failed to save webhook",+ type: "error",+ });+ } finally {+ updatingWebhook.value = false;+ }+}++async function deleteWebhook(id: string) {+ try {+ const api = useApi();+ await api(`/v1/webhooks/${id}`, { method: "DELETE" });+ notificationsStore.addNotification({+ message: "Webhook deleted",+ type: "success",+ });+ await loadWebhooks();+ } catch {+ notificationsStore.addNotification({+ message: "Failed to delete webhook",+ type: "error",+ });+ }+}++function onWebhookCreate() {+ webhookForm.value = { id: "", url: "", events: [], phoneId: "" };+ webhookDialog.value = true;+}++function onWebhookEdit(id: string) {+ const webhook = webhooks.value.find((w) => w.id === id);+ if (webhook) {+ webhookForm.value = {+ id: webhook.id,+ url: webhook.url,+ events: webhook.events ?? [],+ phoneId: "",+ };+ webhookDialog.value = true;+ }+}++async function loadDiscord() {+ loadingDiscordIntegrations.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: any[] }>("/v1/discord-integrations");+ discords.value = response.data ?? [];+ } finally {+ loadingDiscordIntegrations.value = false;+ }+}++async function loadSendSchedules() {+ loadingSendSchedules.value = true;+ try {+ const api = useApi();+ const response = await api<{ data: any[] }>("/v1/message-send-schedules");+ sendSchedules.value = response.data ?? [];+ } finally {+ loadingSendSchedules.value = false;+ }+}++async function updateTimezone(timezone: string) {+ try {+ const api = useApi();+ await api("/v1/users", { method: "PUT", body: { timezone } });+ notificationsStore.addNotification({+ message: "Timezone updated",+ type: "success",+ });+ } catch {+ notificationsStore.addNotification({+ message: "Failed to update timezone",+ type: "error",+ });+ }+}++onMounted(async () => {+ await authStore.loadUser();+ await loadApiKey();+ loadWebhooks();+ loadDiscord();+ loadSendSchedules();+});+</script>++<template>+ <VContainer fluid class="px-0 pt-0" :class="{ 'fill-height': lgAndUp }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>Settings</VToolbarTitle>+ </VAppBar>+ <VContainer class="mt-16">+ <VRow>+ <VCol cols="12" md="9" offset-md="1" xl="8" offset-xl="2">+ <!-- Profile -->+ <div v-if="authStore.firebaseUser" class="text-center">+ <VAvatar size="100" color="indigo" class="mx-auto">+ <img+ v-if="authStore.firebaseUser.photoURL"+ :src="authStore.firebaseUser.photoURL"+ :alt="authStore.firebaseUser.displayName ?? ''"+ />+ <VIcon v-else size="70" :icon="mdiAccountCircle" />+ </VAvatar>+ <h3 v-if="authStore.firebaseUser.displayName">+ {{ authStore.firebaseUser.displayName }}+ </h3>+ <h4 class="text-medium-emphasis">+ {{ authStore.firebaseUser.email }}+ <VIcon+ v-if="authStore.firebaseUser.emailVerified"+ size="small"+ color="primary"+ :icon="mdiShieldCheck"+ />+ </h4>+ <VAutocomplete+ v-if="authStore.user"+ density="compact"+ variant="outlined"+ :model-value="authStore.user.timezone"+ class="mx-auto mt-2"+ style="max-width: 250px"+ label="Timezone"+ :items="timezones"+ @update:model-value="updateTimezone"+ />+ </div>++ <!-- API Key -->+ <h5 class="text-h4 mb-3 mt-3">API Key</h5>+ <p class="text-medium-emphasis">+ Use your API Key in the <code>x-api-key</code> HTTP Header when+ sending requests to+ <code>https://api.httpsms.com</code> endpoints.+ </p>+ <div v-if="apiKey === ''" class="mb-n9 pl-3 pt-5">+ <VProgressCircular+ :size="20"+ :width="2"+ color="primary"+ indeterminate+ />+ </div>+ <VTextField+ v-else+ :append-inner-icon="apiKeyShow ? mdiEye : mdiEyeOff"+ :type="apiKeyShow ? 'text' : 'password'"+ :model-value="apiKey"+ readonly+ name="api-key"+ variant="outlined"+ class="mb-n2"+ @click:append-inner="apiKeyShow = !apiKeyShow"+ />+ <div class="d-flex flex-wrap">+ <CopyButton+ :value="apiKey"+ color="primary"+ copy-text="Copy API Key"+ notification-text="API Key copied successfully"+ />+ <VBtn+ v-if="mdAndUp"+ color="primary"+ class="ml-4"+ @click="generateQrCode"+ >+ <VIcon start :icon="mdiQrcode" />+ Show QR Code+ </VBtn>+ <VDialog v-model="showQrCodeDialog" max-width="400px">+ <VCard>+ <VCardTitle class="text-center">API Key QR Code</VCardTitle>+ <VCardSubtitle class="mt-2 text-center">+ Scan this QR code with the+ <a :href="config.public.appDownloadUrl">httpSMS app</a>+ on your Android phone to login.+ </VCardSubtitle>+ <VCardText class="text-center">+ <canvas ref="qrCodeCanvas" />+ </VCardText>+ <VCardActions>+ <VBtn+ color="primary"+ block+ class="mb-4"+ @click="showQrCodeDialog = false"+ >Close</VBtn+ >+ </VCardActions>+ </VCard>+ </VDialog>+ <VBtn+ v-if="lgAndUp"+ class="ml-4"+ :href="config.public.appDocumentationUrl"+ >Documentation</VBtn+ >+ <VSpacer />+ <VDialog v-model="showRotateApiKey" max-width="550">+ <template #activator="{ props }">+ <VBtn+ :size="mdAndDown ? 'small' : 'default'"+ :variant="lgAndUp ? 'text' : 'elevated'"+ color="warning"+ v-bind="props"+ >+ <VIcon start :icon="mdiRefresh" />+ Rotate API Key+ </VBtn>+ </template>+ <VCard>+ <VCardTitle class="text-h5 text-break"+ >Are you sure you want to rotate your API Key?</VCardTitle+ >+ <VCardText>+ You will have to logout and login again on the+ <b>httpSMS</b> Android app with your new API key after you+ rotate it.+ </VCardText>+ <VCardActions class="pb-4">+ <VBtn+ color="primary"+ :loading="rotatingApiKey"+ @click="rotateApiKey"+ >+ <VIcon start :icon="mdiRefresh" />+ Yes Rotate Key+ </VBtn>+ <VSpacer />+ <VBtn variant="text" @click="showRotateApiKey = false"+ >Close</VBtn+ >+ </VCardActions>+ </VCard>+ </VDialog>+ </div>++ <!-- Webhooks -->+ <h5 id="webhook-settings" class="text-h4 mb-3 mt-12">Webhooks</h5>+ <p class="text-medium-emphasis">+ Webhooks allow us to send events to your server for example when+ the android phone receives an SMS message we can forward the+ message to your server.+ </p>+ <div v-if="loadingWebhooks">+ <VProgressCircular+ :size="60"+ :width="2"+ color="primary"+ class="mb-4"+ indeterminate+ />+ </div>+ <VTable v-else-if="webhooks.length" class="mb-4">+ <thead>+ <tr class="text-uppercase text-subtitle-2">+ <th v-if="xlAndUp" class="text-left">ID</th>+ <th class="text-left text-break">Callback URL</th>+ <th v-if="lgAndUp" class="text-center">Events</th>+ <th class="text-center">Action</th>+ </tr>+ </thead>+ <tbody>+ <tr v-for="webhook in webhooks" :key="webhook.id">+ <td v-if="xlAndUp" class="text-left">{{ webhook.id }}</td>+ <td class="text-break">{{ webhook.url }}</td>+ <td v-if="lgAndUp" class="text-center">+ <VChip+ v-for="event in webhook.events"+ :key="event"+ class="ma-1"+ size="small"+ >{{ event }}</VChip+ >+ </td>+ <td class="text-center">+ <VBtn+ :icon="mdAndDown"+ size="small"+ color="info"+ :disabled="updatingWebhook"+ @click.prevent="onWebhookEdit(webhook.id)"+ >+ <VIcon size="small" :icon="mdiSquareEditOutline" />+ <span v-if="!mdAndDown" class="ml-1">Edit</span>+ </VBtn>+ </td>+ </tr>+ </tbody>+ </VTable>+ <div class="d-flex">+ <VBtn color="primary" @click="onWebhookCreate">+ <VIcon start :icon="mdiLinkVariant" />+ Add webhook+ </VBtn>+ <VBtn+ v-if="lgAndUp"+ class="ml-4"+ href="https://docs.httpsms.com/webhooks/introduction"+ >Documentation</VBtn+ >+ </div>++ <!-- Webhook Dialog -->+ <VDialog v-model="webhookDialog" max-width="600">+ <VCard>+ <VCardTitle+ >{{ webhookForm.id ? "Edit" : "Add" }} Webhook</VCardTitle+ >+ <VCardText>+ <VTextField+ v-model="webhookForm.url"+ variant="outlined"+ label="Callback URL"+ placeholder="https://example.com/webhook"+ />+ <VSelect+ v-model="webhookForm.events"+ :items="webhookEvents"+ variant="outlined"+ label="Events"+ multiple+ chips+ />+ </VCardText>+ <VCardActions>+ <VBtn+ color="primary"+ :loading="updatingWebhook"+ @click="saveWebhook"+ >+ <VIcon start :icon="mdiContentSave" />+ Save+ </VBtn>+ <VSpacer />+ <VBtn+ v-if="webhookForm.id"+ color="error"+ variant="text"+ @click="deleteWebhook(webhookForm.id)"+ >+ <VIcon start :icon="mdiDelete" />+ Delete+ </VBtn>+ <VBtn variant="text" @click="webhookDialog = false"+ >Close</VBtn+ >+ </VCardActions>+ </VCard>+ </VDialog>++ <!-- Discord Integration -->+ <h5 id="discord-settings" class="text-h4 mb-3 mt-12">+ Discord Integration+ </h5>+ <p class="text-medium-emphasis">+ Send and receive SMS messages without leaving your discord server+ with the httpSMS discord app using the+ <code>/httpsms</code> command.+ </p>+ <div v-if="loadingDiscordIntegrations">+ <VProgressCircular+ :size="60"+ :width="2"+ color="primary"+ class="mb-4"+ indeterminate+ />+ </div>+ <VTable v-else-if="discords.length" class="mb-4">+ <thead>+ <tr class="text-uppercase text-subtitle-2">+ <th class="text-left">Name</th>+ <th class="text-left">Server ID</th>+ <th class="text-left">Channel ID</th>+ <th class="text-center">Action</th>+ </tr>+ </thead>+ <tbody>+ <tr v-for="discord in discords" :key="discord.id">+ <td class="text-left">{{ discord.name }}</td>+ <td class="text-left">{{ discord.server_id }}</td>+ <td class="text-left">{{ discord.incoming_channel_id }}</td>+ <td class="text-center">+ <VBtn size="small" color="info">+ <VIcon size="small" :icon="mdiSquareEditOutline" />+ <span v-if="!mdAndDown" class="ml-1">Edit</span>+ </VBtn>+ </td>+ </tr>+ </tbody>+ </VTable>+ <VBtn+ color="primary"+ href="https://discord.com/api/oauth2/authorize?client_id=1049492914743599124&permissions=2048&scope=bot%20applications.commands"+ >+ Add Discord Integration+ </VBtn>++ <!-- Send Schedules -->+ <h5 id="send-schedules" class="text-h4 mb-3 mt-12">+ Send Schedules+ </h5>+ <p class="text-medium-emphasis">+ Configure when your phone should send SMS messages. Messages sent+ outside the schedule will be queued and sent during the next+ active window.+ </p>+ <div v-if="loadingSendSchedules">+ <VProgressCircular+ :size="60"+ :width="2"+ color="primary"+ class="mb-4"+ indeterminate+ />+ </div>+ <VTable v-else-if="sendSchedules.length" class="mb-4">+ <thead>+ <tr class="text-uppercase text-subtitle-2">+ <th class="text-left">Phone</th>+ <th class="text-center">Days</th>+ <th class="text-center">Start</th>+ <th class="text-center">End</th>+ </tr>+ </thead>+ <tbody>+ <tr v-for="schedule in sendSchedules" :key="schedule.id">+ <td>{{ useFilters().phoneNumber(schedule.phone_number) }}</td>+ <td class="text-center">{{ schedule.days?.join(", ") }}</td>+ <td class="text-center">{{ schedule.start_time }}</td>+ <td class="text-center">{{ schedule.end_time }}</td>+ </tr>+ </tbody>+ </VTable>+ </VCol>+ </VRow>+ </VContainer>+ </div>+ </VContainer>+</template>diff --git a/web/app/pages/terms-and-conditions/index.vue b/web/app/pages/terms-and-conditions/index.vuenew file mode 100644index 00000000..71c5f4d2--- /dev/null+++ b/web/app/pages/terms-and-conditions/index.vue@@ -0,0 +1,54 @@+<script setup lang="ts">+definePageMeta({+ layout: "website",+});++useHead({+ title: "Terms and Conditions - httpSMS",+});+</script>++<template>+ <VContainer>+ <VRow>+ <VCol cols="12" md="8" offset-md="2">+ <h1 class="text-h3 mb-6">Terms and Conditions</h1>+ <p class="text-medium-emphasis mb-4">Last updated: January 1, 2024</p>++ <h2 class="text-h5 mt-6 mb-3">1. Acceptance of Terms</h2>+ <p>+ By accessing or using the httpSMS service, you agree to be bound by+ these Terms and Conditions. If you do not agree to these terms, do not+ use the service.+ </p>++ <h2 class="text-h5 mt-6 mb-3">2. Service Description</h2>+ <p>+ httpSMS provides a platform that converts your Android phone into an+ SMS gateway, allowing you to send and receive SMS messages+ programmatically via an HTTP API.+ </p>++ <h2 class="text-h5 mt-6 mb-3">3. Acceptable Use</h2>+ <p>+ You agree not to use the service for spam, illegal activities, or any+ purpose that violates applicable laws. We reserve the right to suspend+ accounts that violate these terms.+ </p>++ <h2 class="text-h5 mt-6 mb-3">4. Limitations of Liability</h2>+ <p>+ httpSMS is provided "as is" without warranties of any kind. We are not+ liable for any damages resulting from the use or inability to use the+ service.+ </p>++ <h2 class="text-h5 mt-6 mb-3">5. Contact</h2>+ <p>+ For questions about these terms, contact us at+ <a href="mailto:[email protected]">[email protected]</a>.+ </p>+ </VCol>+ </VRow>+ </VContainer>+</template>diff --git a/web/app/pages/threads/[id]/index.vue b/web/app/pages/threads/[id]/index.vuenew file mode 100644index 00000000..8fd86960--- /dev/null+++ b/web/app/pages/threads/[id]/index.vue@@ -0,0 +1,530 @@+<script setup lang="ts">+import {+ mdiSend,+ mdiDotsVertical,+ mdiArrowLeft,+ mdiCheckAll,+ mdiDelete,+ mdiCallMissed,+ mdiPaperclip,+ mdiCheck,+ mdiAlert,+ mdiPackageUp,+ mdiPackageDown,+ mdiAccount,+ mdiRefresh,+ mdiContentCopy,+} from "@mdi/js";+import Pusher from "pusher-js";+import type { Channel } from "pusher-js";+import { isValidPhoneNumber } from "libphonenumber-js";+import type { Message } from "~/shared/types/message";++definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Messages - httpSMS",+});++const route = useRoute();+const router = useRouter();+const config = useRuntimeConfig();+const { lgAndUp, mdAndDown, mdAndUp } = useDisplay();+const notificationsStore = useNotificationsStore();+const authStore = useAuthStore();+const phonesStore = usePhonesStore();+const threadsStore = useThreadsStore();+const messagesStore = useMessagesStore();++const formMessage = ref("");+const submitting = ref(false);+const loadingMessages = ref(false);+const hideMessages = ref(true);+const messages = ref<Message[]>([]);+const selectedMenuItem = ref(-1);+const messageBody = ref<HTMLElement | null>(null);++let webhookChannel: Channel | null = null;++const contactIsPhoneNumber = computed(() => {+ const thread = threadsStore.currentThread;+ if (!thread) return false;+ return isValidPhoneNumber(thread.contact) || !isNaN(Number(thread.contact));+});++const messageVisibility = computed(() =>+ hideMessages.value ? "hidden" : "visible",+);+const contact = computed(() => threadsStore.currentThread?.contact ?? "");++function isMT(message: Message): boolean {+ return message.type === "mobile-terminated";+}++function isMo(message: Message): boolean {+ return message.type === "mobile-originated";+}++function isMissedCall(message: Message): boolean {+ return message.type === "call/missed";+}++function isPending(message: Message): boolean {+ return ["sending", "pending", "scheduled"].includes(message.status);+}++function statusColor(message: Message): string {+ if (message.status === "sending") return "warning";+ if (message.status === "scheduled") return "teal";+ return "primary";+}++function canResend(message: Message): boolean {+ return (+ isMT(message) &&+ (message.status === "expired" || message.status === "failed")+ );+}++function formatAttachmentName(url: string): string {+ const parts = url.split("/");+ if (parts.length >= 2) return "/" + parts.slice(-2).join("/");+ return url;+}++function scrollToElement() {+ const el = messageBody.value;+ if (el) {+ el.scrollTop = el.scrollHeight + 120;+ }+ hideMessages.value = false;+}++function loadMessages(hide = true) {+ loadingMessages.value = true;+ const threadId = route.params.id as string;+ messagesStore+ .loadThreadMessages(threadId)+ .then((msgs: Message[]) => {+ messages.value = [...msgs].reverse();+ })+ .finally(() => {+ setTimeout(() => {+ loadingMessages.value = false;+ }, 1100);+ });+ hideMessages.value = hide;+ setTimeout(() => {+ scrollToElement();+ }, 950);+}++async function loadData() {+ await authStore.loadUser();+ await phonesStore.loadPhones();+ await threadsStore.loadThreads();++ if (!threadsStore.hasThreadId(route.params.id as string)) {+ await router.push("/threads");+ return;+ }+ loadMessages();+}++async function archiveThread() {+ await threadsStore.updateThread(threadsStore.currentThread!.id, true);+ setTimeout(() => {+ selectedMenuItem.value = -1;+ }, 1000);+}++async function unArchiveThread() {+ await threadsStore.updateThread(threadsStore.currentThread!.id, false);+ setTimeout(() => {+ selectedMenuItem.value = -1;+ }, 1000);+}++async function resendMessage(message: Message) {+ await messagesStore.sendMessage({+ from: message.owner,+ to: message.contact,+ content: message.content,+ });+ setTimeout(() => {+ selectedMenuItem.value = -1;+ }, 1000);+ loadMessages(false);+}++async function deleteMessage(message: Message) {+ await messagesStore.deleteMessage(message.id);+ setTimeout(() => {+ selectedMenuItem.value = -1;+ }, 1000);+ loadMessages(false);+}++async function copyMessageId(message: Message) {+ await navigator.clipboard.writeText(message.id);+ notificationsStore.addNotification({+ message: "Message ID copied to clipboard",+ type: "success",+ });+ setTimeout(() => {+ selectedMenuItem.value = -1;+ }, 1000);+}++async function deleteThread(threadID: string) {+ await threadsStore.deleteThread(threadID);+ await router.push("/threads");+}++async function sendMessage(event: KeyboardEvent | Event) {+ if (event instanceof KeyboardEvent && event.shiftKey) return;+ if (!formMessage.value.trim()) return;++ submitting.value = true;+ await messagesStore.sendMessage({+ from: phonesStore.owner,+ to: threadsStore.currentThread!.contact,+ content: formMessage.value,+ });+ loadMessages(false);+ formMessage.value = "";+ submitting.value = false;+}++onMounted(async () => {+ await loadData();++ const pusher = new Pusher(config.public.pusherKey as string, {+ cluster: config.public.pusherCluster as string,+ });+ webhookChannel = pusher.subscribe(authStore.user!.id);+ webhookChannel.bind("message.phone.sent", () => {+ if (!loadingMessages.value) loadMessages(false);+ });+ webhookChannel.bind("message.send.failed", () => {+ if (!loadingMessages.value) loadMessages(false);+ });+ webhookChannel.bind("message.phone.received", () => {+ if (!loadingMessages.value) loadMessages(false);+ });+});++onBeforeUnmount(() => {+ if (webhookChannel) webhookChannel.unsubscribe();+});+</script>++<template>+ <VContainer fluid class="px-0 pt-0 pb-0" :class="{ 'fill-height': lgAndUp }">+ <div class="w-100 h-100">+ <VAppBar height="60" :density="mdAndDown ? 'compact' : 'default'">+ <VBtn v-if="mdAndDown" icon to="/threads">+ <VIcon :icon="mdiArrowLeft" />+ </VBtn>+ <VToolbarTitle>+ <span v-if="threadsStore.currentThread">+ {{ useFilters().phoneNumber(threadsStore.currentThread.contact) }}+ </span>+ </VToolbarTitle>+ <VSpacer />+ <VMenu>+ <template #activator="{ props }">+ <VBtn icon variant="text" class="mt-2" v-bind="props">+ <VIcon :icon="mdiDotsVertical" />+ </VBtn>+ </template>+ <VList class="px-2" nav :density="mdAndDown ? 'compact' : 'default'">+ <VListItem+ v-if="+ threadsStore.currentThread &&+ !threadsStore.currentThread.is_archived+ "+ @click.prevent="archiveThread"+ >+ <template #prepend>+ <VIcon :icon="mdiPackageDown" />+ </template>+ <VListItemTitle>Archive</VListItemTitle>+ </VListItem>+ <VListItem+ v-if="+ threadsStore.currentThread &&+ threadsStore.currentThread.is_archived+ "+ @click.prevent="unArchiveThread"+ >+ <template #prepend>+ <VIcon :icon="mdiPackageUp" />+ </template>+ <VListItemTitle>Unarchive</VListItemTitle>+ </VListItem>+ <VListItem+ v-if="threadsStore.currentThread"+ @click.prevent="deleteThread(threadsStore.currentThread.id)"+ >+ <template #prepend>+ <VIcon :icon="mdiDelete" color="error" />+ </template>+ <VListItemTitle>Delete Thread</VListItemTitle>+ </VListItem>+ </VList>+ </VMenu>+ </VAppBar>+ <VProgressLinear v-if="loadingMessages" color="primary" indeterminate />+ <VContainer v-if="threadsStore.currentThread">+ <div+ ref="messageBody"+ class="messages-body no-scrollbar"+ :class="{ 'pr-7': lgAndUp }"+ >+ <VRow+ v-for="message in messages"+ :key="message.id"+ :style="{ visibility: messageVisibility }"+ >+ <VCol+ class="d-flex"+ :class="{+ 'pr-12': mdAndDown && !isMT(message),+ 'pl-12 pr-8': mdAndDown && isMT(message),+ 'pl-16 ml-16': lgAndUp && isMT(message),+ 'pr-16 mr-16': lgAndUp && !isMT(message),+ }"+ >+ <VSpacer v-if="isMT(message)" />+ <VAvatar+ v-if="isMo(message)"+ :color="threadsStore.currentThread!.color"+ >+ <VIcon :icon="mdiAccount" />+ </VAvatar>+ <VAvatar v-if="isMissedCall(message)" color="#1e1e1e">+ <VIcon size="large" color="red" :icon="mdiCallMissed" />+ </VAvatar>+ <!-- MT message menu -->+ <VMenu v-if="isMT(message)">+ <template #activator="{ props }">+ <VBtn icon variant="text" class="mt-2" v-bind="props">+ <VIcon :icon="mdiDotsVertical" />+ </VBtn>+ </template>+ <VList class="px-2" nav density="compact">+ <VListItem+ v-if="canResend(message)"+ @click.prevent="resendMessage(message)"+ >+ <template #prepend><VIcon :icon="mdiRefresh" /></template>+ <VListItemTitle>Resend Message</VListItemTitle>+ </VListItem>+ <VListItem @click.prevent="copyMessageId(message)">+ <template #prepend+ ><VIcon :icon="mdiContentCopy"+ /></template>+ <VListItemTitle>Copy Message ID</VListItemTitle>+ </VListItem>+ <VListItem @click.prevent="deleteMessage(message)">+ <template #prepend+ ><VIcon :icon="mdiDelete" color="error"+ /></template>+ <VListItemTitle>Delete Message</VListItemTitle>+ </VListItem>+ </VList>+ </VMenu>+ <div>+ <VCard+ class="ml-2"+ rounded="shaped"+ :color="isMT(message) ? 'primary' : undefined"+ >+ <VCardText+ v-if="message.content"+ class="text-break"+ style="white-space: pre-line"+ >+ <span v-if="!isMissedCall(message)">{{+ message.content+ }}</span>+ <span v-else class="text-medium-emphasis"+ >Missed phone call</span+ >+ </VCardText>+ </VCard>+ <VCard v-if="message.attachments?.length">+ <VCardText class="pb-2">+ <a+ v-for="(attachment, index) in message.attachments"+ :key="index"+ target="_blank"+ rel="noopener noreferrer"+ :href="attachment"+ class="text-decoration-none text-body-2 mb-2 d-flex w-100"+ >+ <VIcon+ size="x-small"+ class="text-medium-emphasis mt-1"+ :icon="mdiPaperclip"+ />+ {{ formatAttachmentName(attachment) }}+ </a>+ </VCardText>+ </VCard>+ <div class="d-flex">+ <p class="ml-2 text-medium-emphasis text-caption mr-2">+ {{ new Date(message.order_timestamp).toLocaleString() }}+ </p>+ <VSpacer />+ <VTooltip location="bottom">+ <template #activator="{ props }">+ <div v-bind="props">+ <VIcon+ v-if="message.status === 'expired'"+ color="warning"+ class="mt-n2"+ :icon="mdiAlert"+ />+ <VProgressCircular+ v-else-if="isPending(message)"+ indeterminate+ :size="14"+ :width="1"+ class="mt-n2"+ :color="statusColor(message)"+ />+ <VIcon+ v-else-if="message.status === 'delivered'"+ color="primary"+ class="mt-n6"+ :icon="mdiCheckAll"+ />+ <VIcon+ v-else-if="message.status === 'sent'"+ class="mt-n6"+ :icon="mdiCheck"+ />+ <VIcon+ v-else-if="message.status === 'failed'"+ color="error"+ class="mt-n2"+ :icon="mdiAlert"+ />+ </div>+ </template>+ <span>{{ message.failure_reason || message.status }}</span>+ </VTooltip>+ </div>+ </div>+ <!-- MO message menu -->+ <VMenu v-if="!isMT(message)">+ <template #activator="{ props }">+ <VBtn icon variant="text" class="mt-2" v-bind="props">+ <VIcon :icon="mdiDotsVertical" />+ </VBtn>+ </template>+ <VList class="px-2" nav density="compact">+ <VListItem+ v-if="canResend(message)"+ @click.prevent="resendMessage(message)"+ >+ <template #prepend><VIcon :icon="mdiRefresh" /></template>+ <VListItemTitle>Resend Message</VListItemTitle>+ </VListItem>+ <VListItem @click.prevent="copyMessageId(message)">+ <template #prepend+ ><VIcon :icon="mdiContentCopy"+ /></template>+ <VListItemTitle>Copy Message ID</VListItemTitle>+ </VListItem>+ <VListItem @click.prevent="deleteMessage(message)">+ <template #prepend+ ><VIcon :icon="mdiDelete" color="error"+ /></template>+ <VListItemTitle>Delete Message</VListItemTitle>+ </VListItem>+ </VList>+ </VMenu>+ </VCol>+ </VRow>+ </div>+ <VFooter app color="#121212">+ <VContainer class="pb-0">+ <form class="d-flex" @submit.prevent="sendMessage">+ <VTextField+ v-model="formMessage"+ :disabled="submitting || !contactIsPhoneNumber"+ variant="solo"+ class="no-scrollbar ml-2"+ :placeholder="+ contactIsPhoneNumber+ ? 'Type your message here'+ : 'You cannot send messages to ' + contact+ "+ rounded+ @keydown.enter="sendMessage"+ />+ <VBtn+ :disabled="submitting || !contactIsPhoneNumber"+ type="submit"+ color="primary"+ class="ml-2"+ icon+ size="large"+ >+ <VProgressCircular+ v-if="submitting"+ indeterminate+ :size="20"+ :width="3"+ color="pink"+ />+ <VIcon :icon="mdiSend" />+ </VBtn>+ </form>+ </VContainer>+ </VFooter>+ </VContainer>+ </div>+ </VContainer>+</template>++<style lang="scss">+.messages-body {+ padding-top: 50px;+ max-height: calc(100vh - 200px);+ position: absolute;+ width: 100%;+ bottom: 120px;+}++@media (min-width: 960px) {+ .messages-body {+ max-width: 900px;+ }+}+@media (min-width: 1264px) {+ .messages-body {+ max-width: 1185px;+ }+}+@media (min-width: 1904px) {+ .messages-body {+ max-width: 1785px;+ }+}++.no-scrollbar,+.no-scrollbar textarea {+ overflow-x: hidden;+ -ms-overflow-style: none;+ overflow-y: scroll;+ &::-webkit-scrollbar {+ display: none;+ }+}+</style>diff --git a/web/app/pages/threads/index.vue b/web/app/pages/threads/index.vuenew file mode 100644index 00000000..7fa69970--- /dev/null+++ b/web/app/pages/threads/index.vue@@ -0,0 +1,54 @@+<script setup lang="ts">+definePageMeta({+ middleware: ["auth"],+});++useHead({+ title: "Threads - httpSMS",+});++const { lgAndUp } = useDisplay();+const authStore = useAuthStore();+const phonesStore = usePhonesStore();+const threadsStore = useThreadsStore();++onMounted(async () => {+ await authStore.loadUser();+ await phonesStore.loadPhones();+ await threadsStore.loadThreads();+});+</script>++<template>+ <VContainer fluid :class="{ 'fill-height': lgAndUp }">+ <VRow v-if="lgAndUp" align="center" justify="center">+ <div>+ <VImg+ class="mx-auto mb-4"+ max-height="400"+ max-width="90%"+ :src="'/img/person-texting.svg'"+ />+ <div class="text-center">+ <h3 class="text-h5 mt-4">Select a Message</h3>+ <p class="text-medium-emphasis">+ Don't hesitate to+ <a+ href="https://discord.gg/kGk8HVqeEZ"+ target="_blank"+ class="text-decoration-none"+ >message us on Discord</a+ >+ if you have any questions+ </p>+ </div>+ </div>+ </VRow>+ <VRow v-else justify="end">+ <VCol class="px-0 py-0">+ <MessageThreadHeader />+ <MessageThread />+ </VCol>+ </VRow>+ </VContainer>+</template>