Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
Visible Terms and Privacy links on the auth screens (#317)
Grigory Frolov0db9e0706d13
diff --git a/app/Http/Middleware/App/HandleInertiaRequests.php b/app/Http/Middleware/App/HandleInertiaRequests.phpindex 77a875e4e..1978e0a4e 100644--- a/app/Http/Middleware/App/HandleInertiaRequests.php+++ b/app/Http/Middleware/App/HandleInertiaRequests.php@@ -51,6 +51,10 @@ class HandleInertiaRequests extends Middleware'hasActiveSubscription' => $account ? $account->hasActiveSubscription() : false,'subscriptionPastDue' => $account ? $account->isPastDue() : false,],+ 'legal' => [+ 'terms' => (string) config('trypost.legal.terms_url'),+ 'privacy' => (string) config('trypost.legal.privacy_url'),+ ],'usage' => $account && ! $isSelfHosted ? $account->usage() : null,'features' => $account && ! $isSelfHosted ? $account->featureLimits() : null,'onboardingProgress' => $this->onboardingProgress($request, $user),diff --git a/config/trypost.php b/config/trypost.phpindex f9d038e4d..bfad557d0 100644--- a/config/trypost.php+++ b/config/trypost.php@@ -16,6 +16,22 @@ return ['self_hosted' => env('SELF_HOSTED', true),+ /*+ |--------------------------------------------------------------------------+ | Legal pages+ |--------------------------------------------------------------------------+ |+ | Linked from the auth screens. Platform app reviews (TikTok explicitly)+ | require Terms and Privacy links to be clearly visible; self-hosted+ | installs point these at wherever they publish their own documents.+ |+ */++ 'legal' => [+ 'terms_url' => env('LEGAL_TERMS_URL', 'https://trypost.it/terms'),+ 'privacy_url' => env('LEGAL_PRIVACY_URL', 'https://trypost.it/privacy'),+ ],+/*|--------------------------------------------------------------------------| Meta page walk budgetdiff --git a/lang/ar/auth.php b/lang/ar/auth.phpindex 180f90dd2..e02c18e70 100644--- a/lang/ar/auth.php+++ b/lang/ar/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'مرحبًا بك في TryPost! لقد بدأت فترتك التجريبية.',],- 'legal' => 'بمتابعتك، فإنك توافق على <a href="https://trypost.it/terms" target="_blank">شروط الخدمة</a> و<a href="https://trypost.it/privacy" target="_blank">سياسة الخصوصية</a>.',+ 'legal' => 'بمتابعتك، فإنك توافق على <a href=":terms_url" target="_blank">شروط الخدمة</a> و<a href=":privacy_url" target="_blank">سياسة الخصوصية</a>.','slides' => ['calendar' => [diff --git a/lang/de/auth.php b/lang/de/auth.phpindex 33733248f..1be25cf6e 100644--- a/lang/de/auth.php+++ b/lang/de/auth.php@@ -24,7 +24,7 @@ return ['welcome_trial' => 'Willkommen bei TryPost! Deine Testphase hat begonnen.',],- 'legal' => 'Indem du fortfährst, stimmst du unseren <a href="https://trypost.it/terms" target="_blank">Nutzungsbedingungen</a> und unserer <a href="https://trypost.it/privacy" target="_blank">Datenschutzerklärung</a> zu.',+ 'legal' => 'Indem du fortfährst, stimmst du unseren <a href=":terms_url" target="_blank">Nutzungsbedingungen</a> und unserer <a href=":privacy_url" target="_blank">Datenschutzerklärung</a> zu.','slides' => ['calendar' => [diff --git a/lang/el/auth.php b/lang/el/auth.phpindex 2b480cda7..7f92bd018 100644--- a/lang/el/auth.php+++ b/lang/el/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Καλώς ήρθατε στο TryPost! Η δοκιμαστική σας περίοδος ξεκίνησε.',],- 'legal' => 'Συνεχίζοντας, συμφωνείτε με τους <a href="https://trypost.it/terms" target="_blank">Όρους Χρήσης</a> και την <a href="https://trypost.it/privacy" target="_blank">Πολιτική Απορρήτου</a> μας.',+ 'legal' => 'Συνεχίζοντας, συμφωνείτε με τους <a href=":terms_url" target="_blank">Όρους Χρήσης</a> και την <a href=":privacy_url" target="_blank">Πολιτική Απορρήτου</a> μας.','slides' => ['calendar' => [diff --git a/lang/en/auth.php b/lang/en/auth.phpindex 637a94412..4fa03da6c 100644--- a/lang/en/auth.php+++ b/lang/en/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Welcome to TryPost! Your trial has started.',],- 'legal' => 'By continuing, you agree to our <a href="https://trypost.it/terms" target="_blank">Terms of Service</a> and <a href="https://trypost.it/privacy" target="_blank">Privacy Policy</a>.',+ 'legal' => 'By continuing, you agree to our <a href=":terms_url" target="_blank">Terms of Service</a> and <a href=":privacy_url" target="_blank">Privacy Policy</a>.','slides' => ['calendar' => [diff --git a/lang/es/auth.php b/lang/es/auth.phpindex 77445a992..61bec34b8 100644--- a/lang/es/auth.php+++ b/lang/es/auth.php@@ -10,7 +10,7 @@ return ['welcome_trial' => '¡Bienvenido a TryPost! Tu prueba ha comenzado.',],- 'legal' => 'Al continuar, aceptas nuestros <a href="https://trypost.it/terms" target="_blank">Términos de Servicio</a> y <a href="https://trypost.it/privacy" target="_blank">Política de Privacidad</a>.',+ 'legal' => 'Al continuar, aceptas nuestros <a href=":terms_url" target="_blank">Términos de Servicio</a> y <a href=":privacy_url" target="_blank">Política de Privacidad</a>.','slides' => ['calendar' => [@@ -124,4 +124,5 @@ return ['expired_description' => 'El workspace de esta invitación fue eliminado. Pide al propietario de la cuenta una nueva invitación si aún necesitas acceso.','expired_action' => 'Ir al inicio',],+];diff --git a/lang/fr/auth.php b/lang/fr/auth.phpindex 904b4c1c4..580693ca2 100644--- a/lang/fr/auth.php+++ b/lang/fr/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Bienvenue sur TryPost ! Votre essai a commencé.',],- 'legal' => 'En continuant, vous acceptez nos <a href="https://trypost.it/terms" target="_blank">Conditions d\'utilisation</a> et notre <a href="https://trypost.it/privacy" target="_blank">Politique de confidentialité</a>.',+ 'legal' => 'En continuant, vous acceptez nos <a href=":terms_url" target="_blank">Conditions d\'utilisation</a> et notre <a href=":privacy_url" target="_blank">Politique de confidentialité</a>.','slides' => ['calendar' => [diff --git a/lang/it/auth.php b/lang/it/auth.phpindex 44511b142..5defda153 100644--- a/lang/it/auth.php+++ b/lang/it/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Benvenuto su TryPost! La tua prova è iniziata.',],- 'legal' => 'Continuando, accetti i nostri <a href="https://trypost.it/terms" target="_blank">Termini di servizio</a> e la nostra <a href="https://trypost.it/privacy" target="_blank">Informativa sulla privacy</a>.',+ 'legal' => 'Continuando, accetti i nostri <a href=":terms_url" target="_blank">Termini di servizio</a> e la nostra <a href=":privacy_url" target="_blank">Informativa sulla privacy</a>.','slides' => ['calendar' => [diff --git a/lang/ja/auth.php b/lang/ja/auth.phpindex 98df02db9..3d6929c6e 100644--- a/lang/ja/auth.php+++ b/lang/ja/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'TryPost へようこそ!トライアルが開始されました。',],- 'legal' => '続行すると、<a href="https://trypost.it/terms" target="_blank">利用規約</a>および<a href="https://trypost.it/privacy" target="_blank">プライバシーポリシー</a>に同意したものとみなされます。',+ 'legal' => '続行すると、<a href=":terms_url" target="_blank">利用規約</a>および<a href=":privacy_url" target="_blank">プライバシーポリシー</a>に同意したものとみなされます。','slides' => ['calendar' => [diff --git a/lang/ko/auth.php b/lang/ko/auth.phpindex cdf172d59..1f55b8482 100644--- a/lang/ko/auth.php+++ b/lang/ko/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'TryPost에 오신 것을 환영합니다! 체험이 시작되었습니다.',],- 'legal' => '계속 진행하면 <a href="https://trypost.it/terms" target="_blank">서비스 약관</a> 및 <a href="https://trypost.it/privacy" target="_blank">개인정보 처리방침</a>에 동의하는 것입니다.',+ 'legal' => '계속 진행하면 <a href=":terms_url" target="_blank">서비스 약관</a> 및 <a href=":privacy_url" target="_blank">개인정보 처리방침</a>에 동의하는 것입니다.','slides' => ['calendar' => [diff --git a/lang/nl/auth.php b/lang/nl/auth.phpindex 471c68013..995f3ebbd 100644--- a/lang/nl/auth.php+++ b/lang/nl/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Welkom bij TryPost! Je proefperiode is gestart.',],- 'legal' => 'Door door te gaan ga je akkoord met onze <a href="https://trypost.it/terms" target="_blank">Servicevoorwaarden</a> en <a href="https://trypost.it/privacy" target="_blank">Privacybeleid</a>.',+ 'legal' => 'Door door te gaan ga je akkoord met onze <a href=":terms_url" target="_blank">Servicevoorwaarden</a> en <a href=":privacy_url" target="_blank">Privacybeleid</a>.','slides' => ['calendar' => [diff --git a/lang/pl/auth.php b/lang/pl/auth.phpindex 1cce8921b..1d80a6852 100644--- a/lang/pl/auth.php+++ b/lang/pl/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Witamy w TryPost! Twój okres próbny właśnie się rozpoczął.',],- 'legal' => 'Kontynuując, akceptujesz nasze <a href="https://trypost.it/terms" target="_blank">Warunki korzystania z usługi</a> oraz <a href="https://trypost.it/privacy" target="_blank">Politykę prywatności</a>.',+ 'legal' => 'Kontynuując, akceptujesz nasze <a href=":terms_url" target="_blank">Warunki korzystania z usługi</a> oraz <a href=":privacy_url" target="_blank">Politykę prywatności</a>.','slides' => ['calendar' => [diff --git a/lang/pt-BR/auth.php b/lang/pt-BR/auth.phpindex 2ba690c7b..34e4f8c6c 100644--- a/lang/pt-BR/auth.php+++ b/lang/pt-BR/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Bem-vindo ao TryPost! Seu período de teste começou.',],- 'legal' => 'Ao continuar, você concorda com nossos <a href="https://trypost.it/terms" target="_blank">Termos de Serviço</a> e <a href="https://trypost.it/privacy" target="_blank">Política de Privacidade</a>.',+ 'legal' => 'Ao continuar, você concorda com nossos <a href=":terms_url" target="_blank">Termos de Serviço</a> e <a href=":privacy_url" target="_blank">Política de Privacidade</a>.','slides' => ['calendar' => [diff --git a/lang/ru/auth.php b/lang/ru/auth.phpindex e813ed655..df7bc03c9 100644--- a/lang/ru/auth.php+++ b/lang/ru/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Добро пожаловать в TryPost! Ваш пробный период начался.',],- 'legal' => 'Продолжая, вы соглашаетесь с нашими <a href="https://trypost.it/terms" target="_blank">Условиями использования</a> и <a href="https://trypost.it/privacy" target="_blank">Политикой конфиденциальности</a>.',+ 'legal' => 'Продолжая, вы соглашаетесь с нашими <a href=":terms_url" target="_blank">Условиями использования</a> и <a href=":privacy_url" target="_blank">Политикой конфиденциальности</a>.','slides' => ['calendar' => [diff --git a/lang/tr/auth.php b/lang/tr/auth.phpindex d11255b48..a8ecbc75a 100644--- a/lang/tr/auth.php+++ b/lang/tr/auth.php@@ -24,7 +24,7 @@ return ['welcome_trial' => 'TryPost\'a hoş geldiniz! Deneme süreniz başladı.',],- 'legal' => 'Devam ederek <a href="https://trypost.it/terms" target="_blank">Hizmet Şartları</a> ve <a href="https://trypost.it/privacy" target="_blank">Gizlilik Politikası</a>\'nı kabul etmiş olursunuz.',+ 'legal' => 'Devam ederek <a href=":terms_url" target="_blank">Hizmet Şartları</a> ve <a href=":privacy_url" target="_blank">Gizlilik Politikası</a>\'nı kabul etmiş olursunuz.','slides' => ['calendar' => [diff --git a/lang/uk/auth.php b/lang/uk/auth.phpindex 33918920f..f4ff78ce8 100644--- a/lang/uk/auth.php+++ b/lang/uk/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => 'Ласкаво просимо до TryPost! Ваш пробний період розпочато.',],- 'legal' => 'Продовжуючи, ви погоджуєтеся з нашими <a href="https://trypost.it/terms" target="_blank">Умовами використання</a> та <a href="https://trypost.it/privacy" target="_blank">Політикою конфіденційності</a>.',+ 'legal' => 'Продовжуючи, ви погоджуєтеся з нашими <a href=":terms_url" target="_blank">Умовами використання</a> та <a href=":privacy_url" target="_blank">Політикою конфіденційності</a>.','slides' => ['calendar' => [diff --git a/lang/zh/auth.php b/lang/zh/auth.phpindex 4d3528fdc..0b914697f 100644--- a/lang/zh/auth.php+++ b/lang/zh/auth.php@@ -22,7 +22,7 @@ return ['welcome_trial' => '欢迎使用 TryPost!你的试用已开始。',],- 'legal' => '继续即表示你同意我们的<a href="https://trypost.it/terms" target="_blank">服务条款</a>和<a href="https://trypost.it/privacy" target="_blank">隐私政策</a>。',+ 'legal' => '继续即表示你同意我们的<a href=":terms_url" target="_blank">服务条款</a>和<a href=":privacy_url" target="_blank">隐私政策</a>。','slides' => ['calendar' => [diff --git a/resources/js/components/auth/LegalLinks.vue b/resources/js/components/auth/LegalLinks.vuenew file mode 100644index 000000000..ea2276932--- /dev/null+++ b/resources/js/components/auth/LegalLinks.vue@@ -0,0 +1,25 @@+<script setup lang="ts">+import { usePage } from '@inertiajs/vue3';+import { trans } from 'laravel-vue-i18n';+import { computed } from 'vue';++import type { SharedData } from '@/types';++const page = usePage<SharedData>();++const sentence = computed(() =>+ trans('auth.legal', {+ terms_url: page.props.legal.terms,+ privacy_url: page.props.legal.privacy,+ }),+);+</script>++<template>+ <!-- eslint-disable-next-line vue/no-v-html -->+ <div+ data-testid="legal-links"+ class="text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary"+ v-html="sentence"+ />+</template>diff --git a/resources/js/pages/auth/Login.vue b/resources/js/pages/auth/Login.vueindex 02eab2268..b285a62e7 100644--- a/resources/js/pages/auth/Login.vue+++ b/resources/js/pages/auth/Login.vue@@ -3,6 +3,7 @@ import { Form, Head, usePage } from '@inertiajs/vue3';import { IconEye, IconEyeOff } from '@tabler/icons-vue';import { computed, ref } from 'vue';+import LegalLinks from '@/components/auth/LegalLinks.vue';import SocialLogin from '@/components/auth/SocialLogin.vue';import InputError from '@/components/InputError.vue';import TextLink from '@/components/TextLink.vue';@@ -183,6 +184,8 @@ const pageErrors = usePageErrors();}}</TextLink></div></Form>++ <LegalLinks /></div></AuthBase></template>diff --git a/resources/js/pages/auth/Register.vue b/resources/js/pages/auth/Register.vueindex 793d62e00..2c5c5087f 100644--- a/resources/js/pages/auth/Register.vue+++ b/resources/js/pages/auth/Register.vue@@ -3,6 +3,7 @@ import { Form, Head, usePage } from '@inertiajs/vue3';import { IconEye, IconEyeOff, IconMail } from '@tabler/icons-vue';import { computed, ref } from 'vue';+import LegalLinks from '@/components/auth/LegalLinks.vue';import SocialLogin from '@/components/auth/SocialLogin.vue';import InputError from '@/components/InputError.vue';import TextLink from '@/components/TextLink.vue';@@ -29,7 +30,6 @@ const showPassword = ref(false);const showEmailForm = ref(false);const page = usePage();-const isSelfHosted = computed(() => Boolean(page.props.selfHosted));const hasSocial = computed(() =>Boolean(page.props.googleAuthEnabled) ||@@ -175,12 +175,7 @@ const emailFormVisible = computed(() => !hasSocial.value || showEmailForm.value)</div></Form>- <!-- eslint-disable-next-line vue/no-v-html -->- <div- v-if="!isSelfHosted"- class="text-center text-xs text-muted-foreground [&_a]:underline [&_a]:underline-offset-4 [&_a]:hover:text-primary"- v-html="$t('auth.legal')"- />+ <LegalLinks /></div></AuthBase></template>diff --git a/resources/js/types/index.d.ts b/resources/js/types/index.d.tsindex 8fe3313df..ea013048a 100644--- a/resources/js/types/index.d.ts+++ b/resources/js/types/index.d.ts@@ -85,6 +85,11 @@ export interface ContentTypeMediaRule {auto_fits_image: boolean;}+export interface LegalLinks {+ terms: string;+ privacy: string;+}+export interface SharedData {name: string;auth: Auth;@@ -93,6 +98,7 @@ export interface SharedData {sidebarOpen: boolean;selfHosted: boolean;allowMultipleSocialAccounts: boolean;+ legal: LegalLinks;contentTypeMediaRules?: Record<string, ContentTypeMediaRule>;[key: string]: unknown;}diff --git a/tests/Browser/AuthLegalLinksTest.php b/tests/Browser/AuthLegalLinksTest.phpnew file mode 100644index 000000000..f512eea83--- /dev/null+++ b/tests/Browser/AuthLegalLinksTest.php@@ -0,0 +1,21 @@+<?php++declare(strict_types=1);++test('the login screen shows the legal sentence to a logged out visitor', function () {+ visit(route('login'))+ ->assertVisible('@legal-links')+ ->assertSeeLink('Terms of Service')+ ->assertSeeLink('Privacy Policy')+ ->assertNoJavaScriptErrors();+});++test('the register screen shows the legal sentence to a logged out visitor', function () {+ config(['trypost.self_hosted' => false]);++ visit(route('register'))+ ->assertVisible('@legal-links')+ ->assertSeeLink('Terms of Service')+ ->assertSeeLink('Privacy Policy')+ ->assertNoJavaScriptErrors();+});diff --git a/tests/Feature/Auth/LegalLinksTest.php b/tests/Feature/Auth/LegalLinksTest.phpnew file mode 100644index 000000000..a94a20eae--- /dev/null+++ b/tests/Feature/Auth/LegalLinksTest.php@@ -0,0 +1,39 @@+<?php++declare(strict_types=1);++test('auth screens receive the configured legal links', function (string $route) {+ config()->set('trypost.self_hosted', false);+ config()->set('trypost.legal.terms_url', 'https://example.test/terms');+ config()->set('trypost.legal.privacy_url', 'https://example.test/privacy');++ $this->get(route($route))+ ->assertOk()+ ->assertInertia(fn ($page) => $page+ ->where('legal.terms', 'https://example.test/terms')+ ->where('legal.privacy', 'https://example.test/privacy')+ );+})->with(['login', 'register']);++test('a self-hosted install can point the legal links at its own documents', function () {+ config()->set('trypost.legal.terms_url', 'https://acme.test/legal/tos');+ config()->set('trypost.legal.privacy_url', 'https://acme.test/legal/privacy');++ $this->get(route('login'))+ ->assertInertia(fn ($page) => $page+ ->where('legal.terms', 'https://acme.test/legal/tos')+ ->where('legal.privacy', 'https://acme.test/legal/privacy')+ );+});++test('the legal sentence carries a url placeholder rather than a hardcoded host', function (string $locale) {+ $sentence = require base_path("lang/{$locale}/auth.php");++ expect($sentence['legal'])+ ->toContain(':terms_url')+ ->toContain(':privacy_url')+ ->not->toContain('trypost.it');+})->with(array_map(+ fn (string $path) => basename(dirname($path)),+ glob(dirname(__DIR__, 3).'/lang/*/auth.php'),+));