diff --git a/.env.example b/.env.example index 224888f..4d67b08 100644 --- a/.env.example +++ b/.env.example @@ -3,7 +3,7 @@ # Required APP_KEY= # make one: echo "base64:$(openssl rand -base64 32)" -APP_URL=https://photos.example.com # the address the phones use +APP_URL=https://photos.example.com # replace: the public address the phones and invitees use; invite links are built from it DB_PASSWORD= # a long random password SEAWEEDFS_KEY= # S3 storage keys; make each one: openssl rand -hex 32 SEAWEEDFS_SECRET= diff --git a/CHANGELOG.md b/CHANGELOG.md index 57c71cf..11d0eb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ The version numbers are explained in "Project status" in the [README](README.md) ## [Unreleased] +### Fixed + +- Invitation links, the invite page and the setup address no longer use a placeholder `APP_URL`. When `APP_URL` is empty, `localhost`, `127.0.0.1`, `::1`, `0.0.0.0` or a host under `example.com`, `example.org` or `example.net`, the server uses the address of the request. A real `APP_URL` is still used as before. +- `POST /v1/invitations` returns `public_url_configured` (bool), so the app can tell the admin to set `APP_URL`. `GET /health/detailed` has a `public_url` check, and `php artisan kinlore:setup-token` prints a warning. + ## [1.5.1] - 2026-11-26 Use this release with version 1.2.0 or newer of the mobile app. The update needs no manual step. diff --git a/deploy/bare-metal/env.example b/deploy/bare-metal/env.example index 5b2dfbe..bf71c99 100644 --- a/deploy/bare-metal/env.example +++ b/deploy/bare-metal/env.example @@ -5,7 +5,7 @@ APP_NAME=Kinlore APP_ENV=production APP_DEBUG=false APP_KEY= # filled by: php artisan key:generate -APP_URL=https://photos.example.com # the address the phones use; invite and video links are built from it +APP_URL=https://photos.example.com # replace: the public address the phones and invitees use; invite and setup links are built from it # Optional: the setup token that the web setup page asks for. Empty: run 'php artisan kinlore:setup-token' to get one. SETUP_TOKEN= diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index b9d25ce..af5138b 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -63,7 +63,7 @@ export default defineConfig({ { text: 'Timeline and look-back', link: '/app/timeline-and-look-back' }, { text: 'Family and permissions', link: '/app/family-and-permissions' }, { text: 'Offline use and uploads', link: '/app/offline-and-uploads' }, - { text: 'Several servers', link: '/app/multiple-servers' }, + { text: 'Several families', link: '/app/multiple-servers' }, { text: 'Settings', link: '/app/settings' }, { text: 'Export', link: '/app/export' }, { text: 'Troubleshooting', link: '/app/troubleshooting' }, diff --git a/docs/app/children.md b/docs/app/children.md index 4ca3937..12203e6 100644 --- a/docs/app/children.md +++ b/docs/app/children.md @@ -2,36 +2,35 @@ This page tells you how to add, edit and delete a child, how to add a baby that is not born yet, and how to choose the child that the timeline shows. -A **child** has a profile with a name, a birth date or a due date, and an avatar color. Each moment belongs to one child. +A **child** has a profile with a name, a birth date or a due date, and a color. Each moment belongs to one child. Each child belongs to one family: the family that you add it to. ## Who may do what - The admin and partners may add a child, and edit or delete any child. - A family member may not add a child. A family member may edit or delete only a child that they created. -- The family always keeps at least one child. The app does not delete the last child. For roles, see [Family and permissions](family-and-permissions.md). ## Add the first child -After the first sign-in, a family with no child shows "Create Kid Profile". +After the first sign-in, a family with no child shows "Add your first child". 1. Type the **Name** of the child. 2. If the baby is not born yet, turn on **Expecting a baby?**. -3. Tap the date field and pick the **Birth Date** or the **Due Date**. Tap **Done**. -4. Under **Avatar Color**, tap a color. -5. Tap **Create Profile**. +3. Tap the date field and pick the **Birth date** or the **Due date**. Tap **Done**. +4. Under **Color**, tap a color. +5. Tap **Create profile**. For a born child, the app also adds a "First Meeting" milestone on the birth date. ## Add another child 1. Open the **Settings** tab. -2. Under **Family**, tap **Children**. +2. In the family section, tap **Children**. The header shows the family name. 3. Tap the **+** button at the top right ("Add child"). -4. The app shows "Add Child". Type the **Name**. -5. If the baby is not born yet, turn on **Expecting a baby?** and pick the **Due Date**. Else pick the **Date of Birth**. -6. Under **Avatar Color**, tap a color. +4. The app shows "Add child", with "Adds to" and the family name. Type the **Name**. +5. If the baby is not born yet, turn on **Expecting a baby?** and pick the **Due date**. Else pick the **Birth date**. +6. Under **Color**, tap a color. 7. Tap the check mark at the top right ("Save"). ### Check that it worked @@ -42,7 +41,7 @@ The **Children** screen shows the new child with its age. Open the child switche You can add a baby before the birth. -- Turn on **Expecting a baby?** and pick the **Due Date**. The due date must be today or later. +- Turn on **Expecting a baby?** and pick the **Due date**. The due date must be today or later. - You can leave the name empty. The app then uses the name "Baby". You can change it later. - Before the birth, the app shows the age as weeks of pregnancy, for example "28 weeks pregnant". @@ -50,7 +49,7 @@ You can add a baby before the birth. 1. Open **Settings** > **Children** and tap the child. 2. Turn off **Expecting a baby?**. -3. Pick the **Date of Birth**. +3. Pick the **Birth date**. 4. Change the **Name** if necessary. 5. Tap the check mark ("Save"). @@ -59,21 +58,22 @@ The app keeps the due date. ## Edit a child 1. Open **Settings** > **Children**. -2. Tap the child. The app shows "Edit Child". -3. Change the **Name**, the dates or the **Avatar Color**. +2. Tap the child. The app shows "Edit child". +3. Change the **Name**, the dates or the **Color**. 4. Tap the check mark at the top right ("Save"). -The "Edit Child" screen also shows the **Growth** records of the child, newest first. To add a growth record, see [Moments](moments.md#add-a-growth-record). +The "Edit child" screen also shows the **Growth** records of the child, newest first. To add a growth record, see [Moments](moments.md#add-a-growth-record). -If you may not edit the child, the screen has no check mark. +If you may not edit the child, the fields are not active and the screen has no check mark. ## Delete a child When you delete a child, the app also deletes all the moments of that child, for all members. +You can also delete the last child of the family. The app then shows "Add your first child". 1. Open **Settings** > **Children**. 2. Swipe the child to the left and tap the trash button. Or tap the child and tap **Delete child**. -3. The app asks "Delete Child". Tap **Delete**. +3. The app asks "Delete" with the name of the child and the family. Tap **Delete**. ### Check that it worked @@ -84,24 +84,26 @@ The child is not in the **Children** list. The **active child** is the child that the timeline shows. The other members of the family choose their own active child on their own phones. 1. Open the **Timeline** tab. -2. Tap the name of the child at the top of the screen. The app shows "Children". +2. Tap the name of the child at the top of the screen. The app shows "Choose a child". 3. Tap a child. The **Children** screen in **Settings** marks the active child with **Active**. -Each server keeps its own active child. +Each family keeps its own active child. ### Show several children together 1. Tap the name of the child at the top of the timeline. -2. Turn on **Select Multiple**. This switch shows only when the family has two or more children. -3. Tap the children that you want to see. You can also tap **Select All** or **Clear**. -4. Tap **Done**. +2. Tap **Select several**. This button shows only when the family has two or more children. +3. Tap the children that you want to see. You can also tap **Select all** or **Clear**. +4. Tap **Done**. The button shows the number of selected children. -The top of the timeline then shows the number of children, for example "2 Children". +The top of the timeline then shows the names of the children, for example "Emma & Leo", or the number of children, for example "3 children". +To see one child again, open the switcher and tap **Select one**. ## Problems -- **"Cannot Delete"** with "You must have at least one child profile.": you tried to delete the last child. Add another child first. -- **"Birth date cannot be in the future"**: pick a date that is today or earlier. For a baby that is not born yet, turn on **Expecting a baby?**. +- **"Enter a name. Only an expected baby can be saved without one."**: type a name, or turn on **Expecting a baby?**. +- **"The birth date must be today or earlier."**: pick a date that is today or earlier. For a baby that is not born yet, turn on **Expecting a baby?**. - **"No child yet"** after the sign-in: you are a family member and the family has no child. Ask the admin to add a child, then tap **Check again**. -- **"Profile Created Offline"**: the phone was offline. The app saved the child on the phone and sends it to the server at the next sync. See [Offline use and uploads](offline-and-uploads.md). +- **"Profile saved on this phone. It syncs when you are back online."**: the phone was offline. The app saved the child on the phone and sends it to the server at the next sync. See [Offline use and uploads](offline-and-uploads.md). +- **"Could not save the child. Try again."**: try again. If the message comes back, you may not edit this child. diff --git a/docs/app/connect.md b/docs/app/connect.md index 8c0c118..f9d0134 100644 --- a/docs/app/connect.md +++ b/docs/app/connect.md @@ -3,7 +3,7 @@ This page tells you how to connect the app to your family's server, sign in, and join a family with an invitation link. It also explains the family name, and what to do when the server is not set up yet. -A **server** is the computer that keeps your family's photos and moments. Each family has its own server. Each server has one **admin**: the person who manages the family. +A **server** is the computer that keeps your family's photos and moments. In Kinlore, one server is one family. Each family has one **admin**: the person who manages the family. ## Before you start @@ -13,27 +13,27 @@ A **server** is the computer that keeps your family's photos and moments. Each f ## Add the server and sign in 1. Open the app. The app shows "Welcome to Kinlore". -2. In **Server URL**, type the address of the server. You can add a port, for example `photos.example.com:8443`. +2. In **Server address**, type the address of the server. You can add a port, for example `photos.example.com:8443`. 3. Tap **Continue**. -4. The app shows "Welcome Back" and the address of the server. +4. The app shows "Welcome back" and the address of the server. 5. Type your **Email** and your **Password**. -6. Tap **Sign In**. +6. Tap **Sign in**. If you type no `https://` or `http://`, the app tries `https://` first. It tries `http://` only for an address on a home network. -To use a different server, tap **Change server** on the sign-in screen. +To use a different server, tap **Change server** on the sign-in screen. When the phone has more than one family, the button is **Use another family**. It opens "Choose a family". See [Several families](multiple-servers.md#switch-to-another-family). ### What you see after the sign-in - The app shows "Loading your family..." while it gets the family's data from the server. - When the family has children, the app shows the **Timeline** tab. -- When the family has no child yet and you are the admin or a partner, the app shows "Create Kid Profile". See [Children](children.md). +- When the family has no child yet and you are the admin or a partner, the app shows "Add your first child". See [Children](children.md). - When the family has no child yet and you are a family member, the app shows "No child yet". Ask the admin to add a child, then tap **Check again**. ### Check that it worked - The **Timeline** tab shows the moments of a child. -- Open the **Settings** tab. The row under **Server** shows the family name. The row under **Account** shows your name, your email and your role. +- Open the **Settings** tab. The card at the top shows the family name, the server address, and your name and role. ## Join with an invitation link @@ -48,20 +48,20 @@ The admin can send two links: 1. On your phone, tap the app link. Or open the web page and tap its button to open the app. 2. If the phone does not know this server yet, the app asks "Join photos.example.com?" (with the address of the server). Tap **Join** only if you know and trust this server. -3. The app shows "Create Account". It tells you who invited you and with which role. -4. Type **Your Name**, **Email**, **Password** and **Confirm Password**. The password must have at least 8 characters. If the invitation is for one email address, the app fills in that address. -5. Tap **Create Account & Join**. +3. The app shows "Create your account". It tells you who invited you and with which role. +4. Type **Your name**, **Email**, **Password** and **Repeat the password**. The password must have at least 8 characters. If the invitation is for one email address, the app fills in that address. +5. Tap **Create account and join**. ### Join with a pasted link or code Use these steps when the link does not open the app. 1. Open the app. -2. Type the server address in **Server URL** and tap **Continue**. +2. Type the server address in **Server address** and tap **Continue**. 3. On the sign-in screen, tap **I have an invitation**. 4. In **Invitation link or token**, paste the invitation link. You can also paste only the invitation code (the token). -5. Tap **Use Invitation**. -6. Fill in the form and tap **Create Account & Join**. +5. Tap **Use invitation**. +6. Fill in the form and tap **Create account and join**. ### Check that it worked @@ -74,8 +74,8 @@ The **family name** is the name of the server for all its members, for example " - The server owner can set the family name when they set up the server. - The admin can change the family name in the app. See [Family and permissions](family-and-permissions.md#change-the-family-name). - The app gets the family name from the server with each sync. A **sync** is the exchange of changes between the phone and the server. -- The app shows the family name in place of the server address: in the server list, in **Settings**, on the **Children** screen and in the child switcher. -- A member who is not the admin can give the server a different name on their own phone only. See [Multiple servers](multiple-servers.md#rename-a-server-on-this-phone). +- The app shows the family name in place of the server address: in **Settings**, in "Choose a family", on the **Families** screen, and in the header of the family screens, for example **Children** and **Members**. +- A member who is not the admin can give the family a different name on their own phone only. See [Several families](multiple-servers.md#rename-a-family-on-this-phone). ## When the server is not set up yet @@ -90,8 +90,8 @@ If the server has no admin, the app shows a message like this: "This server is n ## Problems -- **"Connection Failed"**: the app could not reach the server. Check the address, the port and the network of the phone. See [Troubleshooting](troubleshooting.md). -- **"Invalid server address"**: the address has a wrong form. Type only the host name or the IP address, with an optional port. +- **"Could not connect to the server. Check the address and your internet connection, then try again."**: the app could not reach the server. Check the address, the port and the network of the phone. See [Troubleshooting](troubleshooting.md). +- **"Enter a domain or IP, with an optional port, ..."**: the address has a wrong form. Type only the host name or the IP address, with an optional port. - **"This invitation is not valid. It is used, expired or unknown. Ask for a new invitation."**: ask the admin for a new invitation. - **"This invitation has no server address. Paste the full invitation link."**: you pasted only the code, and the phone does not know the server yet. Type the server address first, or paste the full link. - For more messages, see [Troubleshooting](troubleshooting.md). diff --git a/docs/app/export.md b/docs/app/export.md index 482f89c..cb03c8c 100644 --- a/docs/app/export.md +++ b/docs/app/export.md @@ -7,8 +7,8 @@ An **export** is one ZIP file with all original photos and videos and all moment ## Start an export 1. Open the **Settings** tab. -2. Under **Family**, tap **Export**. -3. Tap **Start Export**. +2. In the family section, tap **Export**. The header shows the family name. +3. Tap **Start export**. 4. The new export shows in the list with the status **Waiting**, then **Building**. 5. Pull the list down to see the newest status. 6. When the status is **Ready**, the list shows the size of the file. diff --git a/docs/app/family-and-permissions.md b/docs/app/family-and-permissions.md index ef89627..b06115d 100644 --- a/docs/app/family-and-permissions.md +++ b/docs/app/family-and-permissions.md @@ -9,7 +9,7 @@ A **member** is a person with an account on the family's server. Each member has | Role | What the member may do | | --- | --- | -| **Admin** | Everything. Only the admin manages members, invitations, the family name and the export. Each server has exactly one admin. | +| **Admin** | Everything. Only the admin manages members, invitations, the family name and the export. Each family has exactly one admin. | | **Partner** | Add, edit and delete all children and all moments. Like and comment. Permissions do not apply to a partner. | | **Family** | See all children and all moments. Do only what the admin allows with the permissions below. | @@ -33,43 +33,45 @@ A family member may also do these things, without a permission: A family member may not add a child. -You see your own role in **Settings**, under **Account**, for example "Role: Family". +You see your own role in **Settings**: on the family card ("You:" with your name and role) and under **Your account**. ## Open the member list Only the admin sees these screens. 1. Open the **Settings** tab. -2. Under **Family**, tap **Members**. +2. In the family section, tap **Members**. The header shows the family name. The **Members** screen has two lists: -- **Family members**: each member with name, email and role. Your own entry has "(you)". -- **Pending invitations**: invitations that nobody has used yet, with the role and the date when they expire. +- **Members of** and the family name: each member with name, email and role. Your own entry has "(you)". +- **Pending invitations**: invitations that nobody has used yet, with the role, who sent the invitation ("invited by" and a name) and the date when they expire. When the member who sent it no longer exists, the name is not shown. ## Invite a person -1. On the **Members** screen, tap the button at the top right ("Invite a member"). The app shows "Invite". +1. In **Settings**, tap **Invite someone**. Or, on the **Members** screen, tap the button at the top right ("Invite someone to" and the family name). The app shows "Invite to" with the family name and the server address. 2. Optional: type an email in **Email (optional)**. With an email, only that address can use the invitation. 3. Under **Role**, tap **Family** or **Partner**. 4. For **Family**, turn the permissions on or off. 5. Under **Expires after**, tap **1 day**, **7 days**, **14 days** or **30 days**. -6. Tap **Create Invitation**. +6. Tap **Create invitation**. 7. The app shows "Invitation ready" with two links: **Web page** and **App link**. 8. Tap **Share** to send the links with a message app. Or tap **Copy links** and paste them in a message. 9. Tap **Done**. +The links start with the public address of the server. If the server has no public address yet, the app shows "The server has no public address". The links then use the address that your phone uses. If that is an address on your home network, people outside it cannot open the links. To fix this, the server owner sets `APP_URL`. See [APP_URL placeholder](../self-hosting/configuration.md#app-url-placeholder). + For the full steps, from the admin to the first sign-in of the new member, see [Invite your family](../tutorials/invite-your-family.md). ### Check that it worked -The invitation is in **Pending invitations**. When the person has joined, the invitation is no longer in the list, and the person is in **Family members**. +The invitation is in **Pending invitations**. When the person has joined, the invitation is no longer in the list, and the person is in the list of members. ## Revoke an invitation 1. On the **Members** screen, find the invitation under **Pending invitations**. 2. Tap the **X** button next to it. -3. The app asks "Revoke invitation". Tap **Revoke**. +3. The app asks "Revoke invitation?". Tap **Revoke**. The link stops working. @@ -102,31 +104,30 @@ You cannot remove yourself. The family name is the name of the server for all members, for example "Anna Example Family". 1. Open the **Settings** tab. -2. Under **Server**, tap the row with the server name. The app shows "Servers". -3. Tap the active server. The active server has a check mark. The app shows "Server Details". -4. Tap the pencil button at the top right ("Rename family"). -5. Type the new name. The app shows "This is the family name. All members see it." -6. Tap the check mark ("Save name"). +2. Open the details of the active family. With one family: under **Families on this phone**, tap **Server details**. With several families: tap **Families**, then tap the info button of the active family. The app shows "Family details". +3. Tap the pencil button at the top right ("Rename family"). +4. In **Family name**, type the new name. The app shows "This is the family name. All members see it." +5. Tap **Save name**. The name can have up to 60 characters. The other members see the new name after their next sync. ### Check that it worked -The **Settings** tab shows the new name under **Server**. +The family card at the top of **Settings** shows the new name. ## Give the admin role to another member -Each server has one admin. When you give the admin role to another member, you become a partner. +Each family has one admin. When you give the admin role to another member, you become a partner. 1. On the **Members** screen, tap the member. 2. Tap **Make admin**. -3. Read the message and tap **Make admin**. +3. The app asks "Make" with the name of the member, "the admin of" and the family name. Tap **Make admin**. After the change, you can no longer manage members, invitations or exports. Only the new admin can give the role back to you. ### Check that it worked -In **Settings**, under **Account**, your role is "Partner". The **Members** and **Export** rows are not in **Settings**. +In **Settings**, your role is "Partner". The **Members**, **Invite someone** and **Export** rows are not in **Settings**. ## Set a new password for a member @@ -143,12 +144,14 @@ For yourself: your other devices are signed out. This phone stays signed in. ### Check that it worked -The app shows "Password changed." under the field. +The app shows "Password changed." under the field, with what happens to the sign-ins. ## Problems - **"The password must have at least 8 characters."**: type a longer password. - **"Could not load members."**: the app could not reach the server, or you are no longer the admin. +- **"Could not create the invitation."**: check the connection and try again. +- **"The server has no public address"** on the invitation: the server owner sets `APP_URL`. See [APP_URL placeholder](../self-hosting/configuration.md#app-url-placeholder). - **"Name not saved"**: the server did not save the family name. Check the connection and try again. - **"You cannot change your own role. Make another member admin instead."**: use **Make admin** on another member. - For more messages, see [Troubleshooting](troubleshooting.md). diff --git a/docs/app/install.md b/docs/app/install.md index f42fd86..6bab47c 100644 --- a/docs/app/install.md +++ b/docs/app/install.md @@ -43,8 +43,8 @@ The app build also declares the right to save photos to the phone. The app does ### If you refused the permission -If you refuse access, the app shows "Permission Required" and closes the picker. -To give access later, open the Settings app of your phone, find Kinlore, and allow access to photos and videos. +If you refuse access, the **Photos** tab of the add screen shows "Allow access to your photos". You can still add a milestone, a story or a growth record. +To give access later, tap **Open Settings** on that tab. Or open the Settings app of your phone, find Kinlore, and allow access to photos and videos. When you come back to the app, the albums show. ## Network diff --git a/docs/app/moments.md b/docs/app/moments.md index c671d3c..5eea5bd 100644 --- a/docs/app/moments.md +++ b/docs/app/moments.md @@ -1,6 +1,6 @@ # Moments -This page tells you how to add, edit and delete moments, and how to like and comment on them. +This page tells you how to add, see, edit and delete moments, and how to like and comment on them. A **moment** is one entry on the timeline of a child. There are five kinds of moments: @@ -16,49 +16,53 @@ A **moment** is one entry on the timeline of a child. There are five kinds of mo - A family member may add moments only with the permission **Add photos and moments**. - A family member may edit or delete the moments that they added, and the moments of a child that they created. - Likes need the permission **Like**. Comments need the permission **Comment**. +- Each member may delete their own comments. The admin may delete any comment. For roles and permissions, see [Family and permissions](family-and-permissions.md). ## Open the add screen 1. Open the **Timeline** tab. -2. Tap the **+** button at the top right ("Add memories"). -3. If the timeline shows several children, the app asks "Add to which child?". Tap the child. +2. Tap the **+** button at the top right ("Add a memory"). +3. If the timeline shows several children, the app asks "Add a memory for…". Tap the child. -The add screen has four tabs: **Media**, **Milestone**, **Story** and **Growth**. +The app shows "New moment", with "For" and the name of the child. The screen has four tabs: **Photos**, **Milestone**, **Story** and **Growth**. You can switch between the tabs: a selection of photos or a text that you started stays. + +To close the screen, tap the close button at the top right ("Close"). If you typed a story or a growth record and did not save it, the app asks "Discard this story?" (or "Discard this growth entry?"). Tap **Discard** to throw the text away, or **Keep editing**. The app also asks when you swipe the screen down on iOS, or press back on Android. If you do not see the **+** button, you may not add moments. Ask the admin. ## Add photos and videos -1. On the **Media** tab, tap an album. +1. On the **Photos** tab, tap an album. 2. Tap each photo and video that you want to add. Each item gets a number. -3. Tap **Upload**. +3. Tap the button at the bottom. It shows what you selected, for example **Add 3 photos and 1 video**. 4. The app goes back to the timeline. The items show there right away, with a small cloud icon until they are on the server. The app sends the original file to the server, one item at a time. An iPhone HEIC photo stays a HEIC photo. Items that are already on the server for this child have a check mark. You cannot select them again. +To go back to the list of albums, tap the back button at the top of the album. For a step-by-step guide, see [Upload your phone photos](../tutorials/upload-your-phone-photos.md). For the upload queue, see [Offline use and uploads](offline-and-uploads.md). ## Add a milestone 1. Tap the **Milestone** tab. -2. The list starts with milestones for the age of the child ("Suggested for" and the name of the child). To see all milestones, tap **See All Milestones**. +2. The list starts with milestones for the age of the child ("Suggested for" and the name of the child). To see all milestones, tap **See all milestones**. When no milestone fits the age, the app shows all milestones at once. 3. Tap a milestone. -4. Tap **Save**. -5. The app shows "Milestone Recorded! 🎉". Tap **OK**. +4. Tap **Save milestone**. +5. The app shows a message, for example "“First steps” is on Emma's timeline.", and closes the screen. The milestone gets the date of today. To change the date, see [Edit a moment](#edit-a-moment). A milestone needs a connection to the server. ## Add a story -1. Tap the **Story** tab. The app shows "Write a Story". -2. Write the text. For ideas, tap a line under "Need inspiration?". -3. To change the date, tap **Today** and pick a date. The date cannot be in the future. -4. Tap **Add Story**. -5. The app shows "Story Created! 📖". Tap **OK**. +1. Tap the **Story** tab. +2. Write the text. For ideas, tap a line under "Need an idea?". +3. To change the date, tap the date (**Today**) and pick a date. The date cannot be in the future. +4. Tap **Add story**. +5. The app shows a message, for example "Story added to Emma's timeline.", and closes the screen. You can add a story offline. The app sends it at the next sync. @@ -66,67 +70,82 @@ You can add a story offline. The app sends it at the next sync. 1. Tap the **Growth** tab. 2. Type at least one measurement: **Height** in cm, **Weight** in kg or **Head circumference** in cm. -3. To change the date, tap the date and pick a date. -4. Optional: type a note. -5. Tap **Add Growth**. +3. To change the date, tap the date under **Measured on** and pick a date. +4. Optional: type a **Note**. +5. Tap **Add growth**. -The values must be in these ranges: height 1 to 250 cm, weight 0.1 to 200 kg, head circumference 1 to 100 cm. +The values must be in these ranges: height 1 to 250 cm, weight 0.1 to 200 kg, head circumference 1 to 100 cm. A value outside its range shows the allowed range under the field. You can add a growth record offline. The app sends it at the next sync. ## See a moment -1. On the timeline, tap a moment. The app shows it on the full screen, below the header. +1. On the timeline, tap a moment. The app shows it on the full screen. 2. Swipe left or right to see the next moment. -3. To close, tap the back button in the header ("Back"). +3. To close, swipe the moment down, or tap the back button at the top left ("Back"). + +- For a photo: pinch or double-tap to zoom. Tap the photo once to hide or show the buttons. You can swipe down to close only when the photo is not zoomed. +- A video starts to play when it opens. +- A story, a milestone or a growth record shows as a card. A long story scrolls. Swipe down to close when the card is at the top. -The age of each shown child at the date of the moment is at the bottom left. The heart and the comment button are at the bottom right. +The top shows the date of the moment. The bottom shows the age of each shown child at the date of the moment, who added the moment ("Added by" and a name), the like button, the comment button and the details button. + +If you may edit the moment, the top right has a menu button ("More actions"). It has **Edit details** and **Delete moment**. ## Like a moment -1. Open the moment on the full screen. -2. Tap the heart ("Like"). +- On the timeline, double-tap a moment. +- Or open the moment on the full screen and tap the heart ("Like"). To remove your like, tap the heart again ("Unlike"). -A like needs a connection to the server. +A like needs a connection to the server. When the server does not get the like, the app removes the heart again and shows a message. ## Comment on a moment 1. Open the moment on the full screen. -2. Tap the comment button. The details of the moment open on the lower half of the screen. Scroll the list to see all comments. -3. Type your text in "Write a comment...". +2. Tap the comment button. The details of the moment open on the lower half of the screen. Drag the sheet up to see more. Scroll to see all comments. +3. Type your text in "Add a comment…". 4. Tap the send button ("Send comment"). -The details show the number of likes and comments, the comments, and who added the moment ("Added by" and a name). -A comment needs a connection to the server. +A comment can have up to 1,000 characters. A comment needs a connection to the server. + +### Delete a comment + +You can delete your own comments. The admin can delete every comment. + +1. Open the details of the moment. +2. Tap the trash button next to the comment ("Delete comment by" and a name). +3. The app asks "Delete this comment?". Tap **Delete comment**. + +The comment is removed for everyone in the family. ## Edit a moment 1. Open the moment on the full screen. -2. Tap the comment button to open the details. +2. Tap the details button. Or tap the menu button and tap **Edit details**. 3. To change the date, tap the date and pick a new date. -4. To change the text, tap the description field ("Add a description...") and type. The change is saved when you leave the field. +4. To change the text, tap the caption field ("Add a caption…") and type. The app saves the change when you leave the field or close the details, and shows "Saved". -If you may not edit the moment, the date and the description cannot be changed. -For a story, the description is the text of the story. +If you may not edit the moment, the date and the caption cannot be changed. +For a story, the caption is the text of the story. A caption can have up to 5,000 characters. ## Delete a moment When you delete a moment, it is removed for all members. 1. Open the moment on the full screen. -2. Tap the comment button to open the details. -3. Tap the trash button ("Delete moment"). -4. The app asks "Delete moment". Tap **Delete**. +2. Tap the menu button ("More actions") and tap **Delete moment**. Or open the details and tap the trash button ("Delete moment"). +3. The app asks "Delete this moment?". Tap **Delete moment**. ### Check that it worked -The moment is not on the timeline. +The app shows "Moment deleted". The moment is not on the timeline. ## Problems -- **"No Photos Selected"**: select at least one item before you tap **Upload**. -- **"Failed to create milestone. Please try again."**: the app could not reach the server. Check the connection and try again. -- **"Empty Story"**: write some text before you tap **Add Story**. -- **"Missing measurement"**: type at least one value, in its range. -- **"Failed to post comment"**: the app could not reach the server, or you may not comment. +- **"Allow access to your photos"** on the **Photos** tab: the app may not read your photos. Tap **Open Settings** and allow access. You can still add a milestone, a story or a growth record. +- **"Could not save the milestone. Check the connection and try again."**: the app could not reach the server. +- **"Could not save the story. Try again."** or **"Could not save the measurement"**: try again. +- **"Could not post your comment. Try again."**: the app could not reach the server, or you may not comment. +- **"Could not delete the comment. Try again."**: check the connection and try again. +- **"Not saved."** with "Tap to try again." under the caption: tap the message to save again. - **"Not saved on the server:"** followed by a reason, in the details of a moment: the server did not accept this change. See [Troubleshooting](troubleshooting.md). diff --git a/docs/app/multiple-servers.md b/docs/app/multiple-servers.md index 5ca899c..4bb4552 100644 --- a/docs/app/multiple-servers.md +++ b/docs/app/multiple-servers.md @@ -1,99 +1,121 @@ -# Multiple servers +# Several families -This page tells you how to use more than one server in the app: add a server, switch between servers, choose a default server, rename a server on your phone, and remove a server. +This page tells you how to use more than one family in the app: add a family, switch between families, choose a default family, rename a family on your phone, and remove a family from your phone. -You need more than one server when you belong to more than one family, for example your own family and the family of your parents. Each family has its own server. +In Kinlore, one server is one family. You need more than one family when you belong to more than one, for example your own family and the family of your parents. Each family has its own server. -Each server keeps its own sign-in, its own copy of the data on the phone and its own upload queue. Two families never share data on the phone. +Each family keeps its own sign-in, its own copy of the data on the phone and its own upload queue. Two families never share data on the phone. -## Open the server list +## Where the app shows the family -1. Open the **Settings** tab. -2. Under **Server**, tap the row with the server name. The row also shows how many servers the app knows, for example "2 servers configured". +- **Settings** starts with a card that shows the active family: its name, its address, and your name and role there. +- With more than one family, the timeline shows the family name above the name of the child. +- The screens of a family, for example **Children**, **Members**, **Invite** and **Export**, show the family name in their header. -The app shows "Servers". Each server shows its name, its address and the name that you use there ("Signed in as" and a name). +## Switch to another family -- A check mark shows the **active** server: the server that the app shows now. -- A star shows the **default** server. -- A status shows if the server answers, for example **Online** or **Offline**. +The app shows "Choose a family", a list of all families on this phone. Each family shows its name, its address, the email that you use there, and a status, for example **Online** or **Offline**. A check mark shows the active family. -Pull the list down to check the status of all servers again. +You can open "Choose a family" from three places: -## Add a server +- In **Settings**, tap **Switch family** on the family card. +- On the timeline, tap the family name at the top of the screen. +- On the sign-in screen, tap **Use another family**. -1. On the **Servers** screen, tap the **+** button at the top right ("Add server"). The app shows "Add Server". -2. In **Server URL**, type the address of the server, for example `photos.example.com`. -3. Tap **Test Connection**. The button shows **Connected** when the server answers. -4. Optional: type a **Display Name (Optional)**. -5. Tap **Add Server**. +These buttons show only when the phone has more than one family. -The app adds the server to the list. The server does not become active. -After the first sync with the server, the app shows the family name of the server. +1. Open "Choose a family". +2. Tap the family. +3. If the phone has no sign-in for that family, the app shows the sign-in screen. Sign in. To join this family with an invitation, tap **I have an invitation**. ### Check that it worked -The new server is in the list on the **Servers** screen. +The family card in **Settings** shows the new family. The timeline shows the children of that family. -## Switch to another server +## Add a family -1. On the **Servers** screen, tap the server. -2. If the phone has no sign-in for that server, the app shows the sign-in screen. Sign in. To join this family with an invitation, tap **I have an invitation**. +1. Open the **Settings** tab. +2. Under **Families on this phone**, tap **Add another family**. You can also tap **Add another family** in "Choose a family". The app shows "Add a family". +3. In **Server address**, type the address of the server, for example `photos.example.com`. +4. Tap **Test connection**. The button shows **Connected** when the server answers. +5. Optional: type a **Display name (optional)**. +6. Tap **Add family**. -You can also long-press the server, or open its details, and tap **Switch to this Server**. +The app adds the family and opens it at once. So the next screen is the sign-in screen of the new family. Sign in, or tap **I have an invitation**. +After the first sync, the app shows the family name of the server. ### Check that it worked -The server has the check mark. The **Settings** tab shows its name under **Server**. The timeline shows the children of that family. +The new family is in "Choose a family" and on the **Families** screen. + +## Open the family list + +The **Families** screen lists all families on this phone. It has more options than "Choose a family". + +1. Open the **Settings** tab. +2. Under **Families on this phone**, tap **Families**. This row shows only when the phone has more than one family. You can also tap **Manage families** in "Choose a family". + +Each family shows its name, its address and the account that you use there ("You:" and an email). + +- **In use** and a check mark show the **active** family: the family that the app shows now. +- A star shows the **default** family. +- A status shows if the server answers, for example **Online** or **Offline**. + +Tap a family to switch to it. Tap the active family, or the info button of a family, to open its details. Long-press a family for more options. +Pull the list down to check the status of all families again. To add a family, tap the **+** button at the top right ("Add a family"). -## Choose the default server +## Choose the default family -The **default** server is the server that the app opens when no server was active before. +The **default** family is the family that the app opens when no family was active before. -1. On the **Servers** screen, long-press the server. -2. Tap **Set as Default**. +1. On the **Families** screen, long-press the family. +2. Tap **Set as default**. -To remove the default, open the server details and tap **Remove as Default**. +You can also open the family details and tap **Set as default**. To remove the default, open the family details and tap **Remove as default**. -## See the server details +## See the family details -1. On the **Servers** screen, tap the active server. For another server, long-press it and tap **View Details**. -2. The app shows "Server Details": the address (**URL**), the **Status**, the time of the last connection, your account, and, when the app knows them, the number of children and members. +1. With one family: in **Settings**, under **Families on this phone**, tap **Server details**. With several families: on the **Families** screen, tap the info button of the family. +2. The app shows "Family details": the **Address**, the **Status**, the time of the last connection, your account there, and, when the app knows them, the number of children and members. To check the connection again, tap the refresh button next to **Status** ("Test connection"). +For a family that is not active, tap **Switch to this family** to open it. -## Rename a server on this phone +## Rename a family on this phone -You can give a server a name that only you see, on this phone. +You can give a family a name that only you see, on this phone. -1. Open the server details. -2. Tap the pencil button at the top right ("Rename server"). +1. Open the family details. +2. Tap the pencil button at the top right ("Rename on this phone"). 3. Type the name. The app shows "This name is only on this phone. Leave it empty to use the family name." -4. Tap the check mark ("Save name"). +4. Tap **Save name**. To use the family name again, clear the field and save. -For the admin, the pencil on the active server changes the family name for all members. See [Family and permissions](family-and-permissions.md#change-the-family-name). +For the admin, the pencil on the active family changes the family name for all members. See [Family and permissions](family-and-permissions.md#change-the-family-name). -## Remove a server +## Remove a family from this phone -When you remove a server, the app deletes the data of that server on this phone. The data on the server stays. -You cannot remove the active server. Switch to another server first. +When you remove a family, the app deletes the data of that family on this phone. The data on the server stays. +You cannot remove the active family. Switch to another family first. -1. On the **Servers** screen, long-press the server. -2. Tap **Remove**. Or open the server details and tap **Remove Server**. -3. The app asks "Remove Server". Tap **Remove**. +1. On the **Families** screen, long-press the family and tap **Remove**. Or open the family details and tap **Remove from this phone**. +2. The app asks "Remove" with the name of the family. Tap **Remove**. -The app removes the server, its sign-in and its data from the phone. To use the server again, add it again and sign in. +The app removes the family, its sign-in and its data from the phone. To use the family again, add it again and sign in. -Stories, changes or uploads that have not reached that server yet are lost. Before you remove a server, switch to it and let it sync. +Stories, changes or uploads that have not reached that server yet are lost. Before you remove a family, switch to it and let it sync. When the app knows that changes are not sent yet, it shows "Cannot remove this server yet" and removes nothing. ### Check that it worked -The server is not in the list on the **Servers** screen. +The family is not on the **Families** screen. ## Problems -- **"Server already configured"**: the app already knows this server. Find it in the list. -- **"Please test the connection first"**: tap **Test Connection** before **Add Server**. +- **"Server already configured"**: the family is already on this phone. Find it on the **Families** screen. +- **"Test the connection first."**: tap **Test connection** before **Add family**. - **"Server not reachable"** or **"Server address not found"**: check the address and the network. See [Troubleshooting](troubleshooting.md). -- **"Cannot Remove"**: the server is active, or it has unsent changes. Switch to another server first, or let the changes sync. +- **"Could not open"** with the name of the family: the app could not switch. Check the connection and try again. +- **"The family was added, but it did not open. Open it from Families."**: open the **Families** screen and tap the new family. +- **"Cannot remove this family"**: the family is active. Switch to another family first. +- **"Cannot remove this server yet"**: the family has unsent changes on this phone. Switch to it and let the changes sync, then try again. diff --git a/docs/app/offline-and-uploads.md b/docs/app/offline-and-uploads.md index cb083cf..3aaf216 100644 --- a/docs/app/offline-and-uploads.md +++ b/docs/app/offline-and-uploads.md @@ -4,7 +4,7 @@ This page explains what the app can do without a connection to the server, how t ## The copy on the phone -The app keeps a copy of the family's data on the phone. Each server has its own copy. +The app keeps a copy of the family's data on the phone. Each family has its own copy. The timeline reads from this copy. So you can open the app and see the timeline when the phone is offline. A **sync** is the exchange of changes between the phone and the server: @@ -18,7 +18,7 @@ The app syncs at these times: - When the app starts. - After you sign in. -- When you switch to another server. +- When you switch to another family. - When you pull the timeline down and release it. - After you save a child, a story or a growth record. @@ -35,23 +35,23 @@ The app does not sync by itself when the network comes back. When you are online | Delete a moment | Yes. The app sends the deletion at the next sync. | | Pick photos and videos for upload | Yes. The upload queue waits for the network. | | Add a milestone | No. | -| Like or comment | No. | +| Like, comment or delete a comment | No. | | Look-back cards | No. The cards do not show. | -| Members, invitations, export, family name | No. | -| Sign in or join with an invitation | No. | +| Members, invitations, export, family name, signed-in devices | No. | +| Sign in, join with an invitation, or add a family | No. | ## The upload queue -The **upload queue** is the list of photos and videos that wait to go to the server. When you tap **Upload** in the photo picker, the app adds all items to the queue at once and closes the picker. +The **upload queue** is the list of photos and videos that wait to go to the server. When you tap the add button in the photo picker, for example **Add 3 photos**, the app adds all items to the queue at once and closes the add screen. - The items show on the timeline right away, at their date, with the preview from the phone. An icon in the corner shows the status: - a cloud with an arrow: the item waits or goes to the server now - a crossed-out Wi-Fi sign: the item waits for Wi-Fi (see [Mobile data](#mobile-data)) - - a warning sign: the upload failed + - a circle with an exclamation mark: the upload failed - When the server has an item, the moment takes the place of the preview. Uploaded moments show no icon. - The queue sends one item at a time, and it sends the original file. - When the app starts again, the queue continues with the items that are not sent yet. It starts after the first sync. -- Each server has its own queue. When you switch to another server, the items of the first server wait. They continue when you switch back. +- Each family has its own queue. When you switch to another family, the items of the first family wait. They continue when you switch back. ### Keep the app open for speed @@ -67,44 +67,45 @@ So a long queue, for example 400 photos and videos, finishes much sooner when th By default, photos and videos upload only on Wi-Fi. On mobile data, the queue waits and shows "Waiting for Wi-Fi". It continues by itself when the phone is on Wi-Fi again. - To always upload on mobile data, turn on **Upload over mobile data** in **Settings**. -- To send the waiting items now, open the **Upload Queue** screen and tap **Upload now over mobile data**. This lasts until the queue is empty. +- To send the waiting items now, open the **Uploads** screen and tap **Upload now over mobile data**. This lasts until the queue is empty. Sync works on mobile data in any case. It sends only small amounts of data. ### The status bar -While the app works in the background, a small bar shows at the bottom of every screen. It shows one thing at a time: +While the app works in the background, a small bar shows at the bottom of the screen, above the tabs. It shows one thing at a time: - "Uploading 10 / 400" while items go to the server. - "Waiting for Wi-Fi" while the queue waits for Wi-Fi. - "Syncing…" during a sync. - "2 uploads failed. Tap to see and retry." when items failed. -Tap the bar to open the **Upload Queue** screen. **Settings** shows the same progress in the **Uploads** row. +Tap the bar to open the **Uploads** screen. **Settings** shows the same progress in the **Uploads** row. -### The Upload Queue screen +### The Uploads screen -Each item shows its status: +The header shows the number of items. Each item shows its status: -- **Pending**: the item waits. -- **Uploading...**: the item goes to the server now. +- **Waiting**: the item waits. +- **Waiting for Wi-Fi**: the item waits for Wi-Fi. See [Mobile data](#mobile-data). +- **Uploading…**: the item goes to the server now. - **Uploaded**: the server has the item. The item leaves the list after a few seconds. -- **Failed**: the queue stopped trying. See [Failed uploads](#failed-uploads). +- **Upload failed**: the queue stopped trying. See [Failed uploads](#failed-uploads). The buttons at the top: -- **Retry Failed**: try all failed items again. -- **Clear Failed**: remove all failed items from the queue. The photos and videos stay on the phone. You can pick them again later. -- **Clear Done**: remove the uploaded items from the list. +- **Retry failed**: try all failed items again. +- **Remove failed**: remove all failed items from the queue. The app asks "Remove failed uploads?". Tap **Remove**. The photos and videos stay on the phone. You can pick them again later. +- **Clear uploaded**: remove the uploaded items from the list. -When the queue is empty, the screen shows "All Caught Up!". +When the queue is empty, the screen shows "Nothing to upload". ## Retries The queue tries again by itself in these cases: -- **The phone is offline.** This does not count as a try. The item stays **Pending**. The queue tries again every 60 seconds until the network is back. -- **The upload stopped, or the server had a problem.** The queue waits 10 seconds and tries again. After three tries, the item is **Failed**. +- **The phone is offline.** This does not count as a try. The item stays **Waiting**. The queue tries again every 60 seconds until the network is back. +- **The upload stopped, or the server had a problem.** The queue waits 10 seconds and tries again. After three tries, the item is **Upload failed**. - **Your sign-in ended.** The queue stops. Sign in again. The queue then continues. The queue does not send an item twice. Before an upload, it asks the server which items it already has for the child. An item that the server has gets the status **Uploaded**. @@ -113,7 +114,7 @@ The server also keeps one copy of each file per child. When two members upload t ## Failed uploads -**Failed** means that the queue stopped trying to send this item. The item is still on the phone. It is not on the server. +**Upload failed** means that the queue stopped trying to send this item. The item is still on the phone. It is not on the server. An item fails at once when the server refuses it. For example: @@ -126,7 +127,7 @@ An item also fails after three tries with a server problem. ### Retry a failed upload 1. Tap the status bar at the bottom of the screen. With failed items, it shows for example "2 uploads failed. Tap to see and retry." -2. On the **Upload Queue** screen, tap the retry button next to the item ("Retry upload"). Or tap **Retry Failed** to retry all failed items. +2. On the **Uploads** screen, tap the retry button next to the item ("Retry" and the name of the item). Or tap **Retry failed** to retry all failed items. 3. Wait until the item shows **Uploaded**. ### Check that it worked @@ -134,15 +135,15 @@ An item also fails after three tries with a server problem. - The status bar is gone, and **Settings** > **Uploads** shows "Up to date". - The photo or the video is on the timeline of the child. -If the item fails again, the server refuses it. See [Troubleshooting](troubleshooting.md#uploads). You can remove it with **Clear Failed**. +If the item fails again, the server refuses it. See [Troubleshooting](troubleshooting.md#uploads). You can remove it with **Remove failed**. ## Unsent changes Changes that did not reach the server yet are only on this phone. These actions would delete them, so the app checks first: -- **Reset & Sync** in **Settings** sends the changes first. It stops if some changes cannot be sent. +- **Reset and sync** in **Settings** sends the changes first. It stops if some changes cannot be sent. - **Reset this phone** in **Settings** warns you with the number of unsent changes. -- **Remove Server** refuses to remove the active server's data while it has unsent changes. +- **Remove from this phone**, on the details of a family, refuses to remove a family while the app knows that it has unsent changes. -See [Settings](settings.md) and [Multiple servers](multiple-servers.md). +See [Settings](settings.md) and [Several families](multiple-servers.md). diff --git a/docs/app/settings.md b/docs/app/settings.md index 394c93a..d19b745 100644 --- a/docs/app/settings.md +++ b/docs/app/settings.md @@ -1,34 +1,75 @@ # Settings -This page explains every row of the **Settings** tab, including sign-out, **Reset & Sync** and **Reset this phone**. +This page explains every part of the **Settings** tab: the family card, the family screens, your account, your signed-in devices, the families on this phone, storage, uploads, **Reset and sync** and **Reset this phone**. To open the screen, tap the **Settings** tab at the bottom of the app. -## Server +In Kinlore, one server is one family. The **Settings** tab always shows the family that the app shows now: the **active family**. -The row shows the name of the active server, and the number of servers that the app knows, for example "2 servers configured". +## The family card -Tap the row to open the server list. See [Multiple servers](multiple-servers.md). +The card at the top shows: -## Account +- The family name, for example "Anna Example Family". Until the first sync, the app shows the server address in its place. +- The server address, for example `photos.example.com`. +- Your name and your role in this family, for example "You: Ben, Family". -- The first row shows your name, your email and your role, for example "Role: Family". You cannot tap this row. -- **Sign Out** signs you out of the active server. +When the phone has more than one family, the card also has the button **Switch family**. It opens "Choose a family". See [Several families](multiple-servers.md#switch-to-another-family). + +## The family section + +The title of this section has the family name, for example "Smith family". Each row works on the active family only. + +- **Children**: add, edit and delete children. See [Children](children.md). +- **Members**: only for the admin. Manage members, their roles and their permissions. See [Family and permissions](family-and-permissions.md). +- **Invite someone**: only for the admin. Make an invitation link. See [Invite your family](../tutorials/invite-your-family.md). +- **Export**: only for the admin. Make a ZIP file with all photos, videos and moments. See [Export](export.md). + +The screens that open from these rows show the family name in their header. So you always know which family you change. + +## Your account + +- The first row shows your name, your email and your role in this family. You cannot tap this row. +- **Signed-in devices**: see and sign out the phones and tablets that use your account in this family. See [Signed-in devices](#signed-in-devices). +- **Sign out**: sign out of this family on this phone. ### Sign out -1. Tap **Sign Out**. -2. The app asks "Are you sure you want to sign out?". Tap **Sign Out**. +1. Tap **Sign out**. +2. The app asks "Sign out of" with the family name. Tap **Sign out**. -The app removes only the sign-in of the active server. The server stays in the list. The data of the server stays on the phone. Your other servers keep their sign-ins. +The app removes only the sign-in of this family. The family stays on the phone, with its data. Your other families stay signed in. To sign in again, type your email and your password on the sign-in screen. -## Family +### Signed-in devices -- **Children**: add, edit and delete children. See [Children](children.md). -- **Members**: only for the admin. Invite people, and manage members and their permissions. See [Family and permissions](family-and-permissions.md). -- **Export**: only for the admin. Make a ZIP file with all photos, videos and moments. See [Export](export.md). +The **Signed-in devices** screen shows every sign-in of your account in this family. + +- **This phone**: the phone that you hold, with the date of the sign-in. +- **Other devices**: the other phones and tablets. Each one shows as "Another device", with the date of the sign-in and the time of the last use. + +When no other device is signed in, the screen shows "Only this phone". Pull the screen down to load the list again. + +To sign out one other device: + +1. Tap the sign-out button next to the device. +2. The app asks "Sign out this device?". Tap **Sign out device**. + +That device needs the email and the password to sign in again. + +To sign out all devices: + +1. Tap **Sign out everywhere**. +2. The app asks "Sign out everywhere?". Tap **Sign out everywhere**. + +Every device signs out of this family, this phone too. The app then shows the sign-in screen. + +## Families on this phone + +- **Add another family**: connect to a second Kinlore server. See [Several families](multiple-servers.md#add-a-family). +- **Families**: shows only when the phone has more than one family. It opens the list of families. See [Several families](multiple-servers.md). +- **Server details**: shows only when the phone has one family. It opens "Family details". See [Several families](multiple-servers.md#see-the-family-details). ## Storage @@ -40,19 +81,19 @@ The bar changes color above 75% and turns red above 90%. Tell the server owner w ### Uploads -The **Uploads** row shows the progress of the upload queue: for example "10 / 400", "Waiting for Wi-Fi", "3 failed" or "Up to date". It changes with every uploaded file. Tap it to open the **Upload Queue** screen. See [Offline use and uploads](./offline-and-uploads.md#the-upload-queue). +The **Uploads** row shows the progress of the upload queue: for example "10 / 400", "Waiting for Wi-Fi", "3 failed" or "Up to date". It changes with every uploaded file. Tap it to open the **Uploads** screen. See [Offline use and uploads](./offline-and-uploads.md#the-upload-queue). ### Upload over mobile data When this switch is off, photos and videos upload only on Wi-Fi. On mobile data, they wait. The switch is off at first. Turn it on to upload on any connection. See [Mobile data](./offline-and-uploads.md#mobile-data). -### Reset & Sync +### Reset and sync -**Reset & Sync** deletes the copy of the data on this phone for the active server, and gets everything again from the server. Use it when the timeline shows wrong data. +**Reset and sync** deletes the copy of the data on this phone for the active family, and gets everything again from the server. Use it when the timeline shows wrong data. -1. Tap **Reset & Sync**. -2. Read the message "Reset Local Data". Tap **Reset & Sync**. -3. Wait. The app shows "Success" when it is done. +1. Tap **Reset and sync**. +2. Read the message "Reset local data?". Tap **Reset and sync**. +3. Wait. The app shows "Local data has been reset and synced from the cloud." when it is done. Before the reset, the app sends the unsent changes of this phone. If it cannot send them all, it stops and deletes nothing. The data on the server does not change. @@ -62,18 +103,18 @@ Before the reset, the app sends the unsent changes of this phone. If it cannot s The reset deletes these things on the phone: -- All servers in the list. +- All families on this phone. - All sign-ins. -- The copy of the data of every server. -- The upload queue, and the settings of the app, for example the active child and the default server. +- The copy of the data of every family. +- The upload queue, and the settings of the app, for example the active child and the default family. -After the reset, the app starts at "Welcome to Kinlore". To get everything back, add the server and sign in again. +After the reset, the app starts at "Welcome to Kinlore". To get everything back, add the family again and sign in. 1. Tap **Reset this phone**. -2. Read the message "Reset this phone". Tap **Reset phone**. -3. If the active server has unsent changes, the app shows "Unsent changes will be lost" with the number of changes. To keep them, tap **Cancel**, stay online and let them sync. To delete them, tap the button "Reset and lose" with the number. +2. Read the message "Reset this phone?". Tap **Reset phone**. +3. If the active family has unsent changes, the app shows "Unsent changes will be lost" with the number of changes. To keep them, tap **Cancel**, stay online and let them sync. To delete them, tap the button "Reset and lose" with the number. -The app can count the unsent changes of the active server only. Stories, changes or uploads that have not reached your other servers yet are lost. +The app can count the unsent changes of the active family only. Stories, changes or uploads that have not reached your other families yet are lost. ### Check that it worked @@ -85,5 +126,6 @@ The bottom of the screen shows the version of the app, for example "Kinlore 1.2. ## Problems -- **"Not reset"**: the app could not send all unsent changes, so it deleted nothing. Wait until the uploads finish, or retry or remove failed uploads. Then try again. See [Offline use and uploads](offline-and-uploads.md). +- **"Not reset"**: the app could not send all unsent changes, or it could not reach the server. So it deleted nothing. Wait until the uploads finish, or retry or remove failed uploads. Then try again. See [Offline use and uploads](offline-and-uploads.md). - **"Could not reset this phone completely. Please try again."**: tap **Reset this phone** again. +- **"Could not load your signed-in devices."**: the app could not reach the server. Check the connection, then tap **Try again**. diff --git a/docs/app/timeline-and-look-back.md b/docs/app/timeline-and-look-back.md index dff3235..8ab8de4 100644 --- a/docs/app/timeline-and-look-back.md +++ b/docs/app/timeline-and-look-back.md @@ -4,15 +4,19 @@ This page explains the timeline, its filters, and the "On this day" and "Then an ## The timeline -The **Timeline** tab shows the moments of the active child, newest first, in a grid of two columns. +The **Timeline** tab shows the moments of the active child, newest first, in a grid of two columns. The moments are grouped by month. Each month starts with its name, for example "May 2026". When the timeline shows one child, the month also shows the age of the child in that month. To choose the child, tap the name of the child at the top of the screen. See [Children](children.md#choose-the-active-child). - The top of the screen shows the name and the age of the child. +- When the phone has more than one family, the family name shows above the name of the child. Tap it to switch to another family. See [Several families](multiple-servers.md#switch-to-another-family). - When you scroll, a small label shows the age of the child at the date of the moments on the screen. +- When the timeline shows several children, each moment has a small badge in the color of its child, with its first letter. - Photos, videos, stories, milestones and growth records each have their own look in the grid. - The app loads more moments when you scroll down. -When a child has no moments, the timeline shows "No Memories Yet". +Tap a moment to see it on the full screen. Double-tap a moment to like it. See [Moments](moments.md#see-a-moment). + +When a child has no moments, the timeline shows "No memories yet". ## Get the newest moments @@ -29,7 +33,7 @@ The row of buttons above the grid filters the moments. 2. To see only the moments that you liked, tap **Liked by me**. Tap it again to turn it off. You can use a kind and **Liked by me** together. -When no moment matches, the timeline shows "No moments match this filter". +When no moment matches, the timeline shows "No moments match this filter." Tap **Show all** to turn the filter off. ### Check that it worked @@ -40,7 +44,7 @@ The selected button has a different color, and the grid shows only the moments o **Look-back cards** show older moments at the top of the timeline. The server selects the moments. - **On this day**: photos, videos and stories of the same day and month in earlier years, for example "On this day · 2 years ago". -- **Then and now**: the first photo of a child taken after the birth and the newest photo, side by side, with the age of the child in each. Only photos with a photo date from the camera count, so photos from before the birth, scans and screenshots are not used. This card shows only when the two photos are at least 6 months apart. +- **Then and now**: the first photo of a child taken after the birth and the newest photo, side by side, with the name of the child. When the timeline shows one child, each photo also shows the age of the child. Only photos with a photo date from the camera count, so photos from before the birth, scans and screenshots are not used. This card shows only when the two photos are at least 6 months apart. The cards show only when these conditions are true: @@ -48,11 +52,13 @@ The cards show only when these conditions are true: - The phone can reach the server. - The server has moments that match. -When the timeline shows several children, the cards show only the active child. This is the child that was active before you turned on **Select Multiple**. +When the timeline shows several children, the cards show the moments of all shown children. + +Tap a moment on a card to see it on the full screen. When the moment is not on this phone yet, the app shows "This moment is still syncing to this phone". Wait a moment and try again. ## Problems - **The timeline does not show a new moment of another member.** Pull the grid down to start a sync. - **The look-back cards do not show.** Set the filter to **All** and turn off **Liked by me**. Check that the phone is online. If the cards still do not show, there are no matching moments yet. -- **A video shows "Processing…".** The server is still preparing the video. Wait and open it again later. -- **A video shows "Could not process video" or "Could not play video".** See [Troubleshooting](troubleshooting.md). +- **A video shows "Processing" on the timeline, or "Processing your video…" when you open it.** The server is still preparing the video. Wait and open it again later. +- **A video shows "Could not process" or "This video could not be processed", or "Could not play this video."** See [Troubleshooting](troubleshooting.md). diff --git a/docs/app/troubleshooting.md b/docs/app/troubleshooting.md index e9895ff..25f3232 100644 --- a/docs/app/troubleshooting.md +++ b/docs/app/troubleshooting.md @@ -7,19 +7,19 @@ For problems on the server itself, see [Server troubleshooting](../self-hosting/ | Message | What to do | | --- | --- | -| "Please enter a server URL" | Type the server address in **Server URL**. | -| "Invalid server address" | Type only a host name or an IP address, with an optional port, for example `photos.example.com` or `192.168.1.20:28461`. | -| "Connection Failed" with "Could not connect to the server. Please check the URL and try again." | Check the address and the port. Check that the phone has a network connection. For a server at home, check that the phone uses the home network. Ask the server owner if the server runs. | -| "Server is not responding correctly" | The address answers, but it is not a Kinlore server. Check the address with the server owner. | +| "Enter the server address." | Type the server address in **Server address**. | +| "Enter a domain or IP, with an optional port, ..." | Type only a host name or an IP address, with an optional port, for example `photos.example.com` or `192.168.1.20:28461`. | +| "Could not connect to the server. Check the address and your internet connection, then try again." | Check the address and the port. Check that the phone has a network connection. For a server at home, check that the phone uses the home network. Ask the server owner if the server runs. | +| "This address answers, but not like a Kinlore server. ..." | The address is not a Kinlore server. Check the address with the server owner. | | "This server is not set up yet. ..." | The server has no admin yet. The server owner creates the admin in a web browser. See [Connect to a server](connect.md#when-the-server-is-not-set-up-yet). | -| "Please fill in all fields" | Type your email and your password. | -| "The provided credentials are incorrect." | The email or the password is wrong. Type them again. If you forgot your password, ask the admin to set a new one. See [Family and permissions](family-and-permissions.md#set-a-new-password-for-a-member). | -| "Authentication failed. Please try again." | Try again. If the message comes back, check the connection. | +| "Enter your email." or "Enter your password." | Type your email and your password. | +| "The provided credentials are incorrect." or "Sign-in failed. Check your email and password, then try again." | The email or the password is wrong. Type them again. If you forgot your password, ask the admin to set a new one. See [Family and permissions](family-and-permissions.md#set-a-new-password-for-a-member). | +| "Could not reach the server. Check your internet connection, then try again." | The server did not answer. Check the connection of the phone, then try again. | | "Could not load your family" | The first sync failed. Check the connection to the server, then tap **Try again**. | The server allows only a few sign-in tries per minute. After many wrong tries, wait one minute. -When the app shows the sign-in screen without a reason, your sign-in ended. For example, the admin set a new password for you, or removed you. Sign in again, or ask the admin. +When the app shows the sign-in screen without a reason, your sign-in ended. For example, the admin set a new password for you, or removed you, or you tapped **Sign out everywhere** on another device. Sign in again, or ask the admin. ## Invitations @@ -27,42 +27,47 @@ When the app shows the sign-in screen without a reason, your sign-in ended. For | --- | --- | | "This invitation is not valid. It is used, expired or unknown. Ask for a new invitation." | Ask the admin for a new invitation. | | "This invitation has no server address. Paste the full invitation link." | Paste the full link. Or type the server address on the first screen, then tap **I have an invitation** and paste the code. | -| "Invalid invitation" | Paste the invitation link or the code exactly as you received it. | -| "You did not join this server. Paste an invitation link for a server you trust." | You tapped **Cancel** in "Join ...?". Paste a link again, and tap **Join** if you trust the server. | -| "Passwords do not match" | Type the same password in **Password** and **Confirm Password**. | -| "Password must be at least 8 characters" | Type a longer password. | +| "This is not an invitation. Paste the invitation link or the token you received." | Paste the invitation link or the code exactly as you received it. | +| "You did not join this server. Paste an invitation link for a server you trust." | You closed "Join ...?" without **Join**. Paste a link again, and tap **Join** if you trust the server. | +| "The passwords do not match." | Type the same password in **Password** and **Repeat the password**. | +| "Use at least 8 characters." | Type a longer password. | | "The email has already been taken." | An account with this email exists. Tap **Already have an account? Sign in**. | | "A valid invitation is required to join this instance." | The invitation is not valid, or it is for another email address. Ask the admin for a new invitation. | -| "Invitation for another server" | You are signed in, and the link is for another server. Open **Settings**, tap your server under **Server**, add the other server, then switch to it and tap **I have an invitation**. See [Multiple servers](multiple-servers.md). | +| "Invitation for another server" | You are signed in, and the link is for another family. In **Settings**, tap **Add another family** and add the server of the invitation. On its sign-in screen, tap **I have an invitation** and paste the link. See [Several families](multiple-servers.md#add-a-family). | +| "The server has no public address" (on the admin's phone, after **Create invitation**) | The links use the address of the admin's phone. People outside your home network may not open them. The server owner sets `APP_URL`. See [APP_URL placeholder](../self-hosting/configuration.md#app-url-placeholder). | ## Children | Message | What to do | | --- | --- | -| "Cannot Delete" with "You must have at least one child profile." | Add another child before you delete this one. | -| "Please enter a name" | Type a name. For a baby that is not born yet, you can leave it empty after you turn on **Expecting a baby?**. | -| "Please select a birth date" or "Please select a due date" | Tap the date field and pick a date. | -| "Birth date cannot be in the future" | Pick today or an earlier date. | +| "Enter a name. Only an expected baby can be saved without one." | Type a name. For a baby that is not born yet, you can leave it empty after you turn on **Expecting a baby?**. | +| "Pick the birth date." or "Pick the due date." | Tap the date field and pick a date. | +| "The birth date must be today or earlier." | Pick today or an earlier date. | | "No child yet" | You are a family member, and the family has no child. Ask the admin to add one, then tap **Check again**. | -| "Could not check" | The app could not reach the server. Check the connection, then tap **Check again**. | -| "Failed to save child. Please try again." | Try again. If the message comes back, you may not edit this child. | +| "Could not reach the server. Check your connection, then try again." on "No child yet" | Check the connection, then tap **Check again**. | +| "Could not save the child. Try again." or "Could not create the profile. Try again." | Try again. If the message comes back, you may not edit this child. | +| "Could not delete" with the name of the child | Check the connection and try again. You may delete only a child that you may edit. | ## Moments | Message | What to do | | --- | --- | -| "Permission Required" | The app may not read your photos. Allow access to photos and videos in the Settings app of your phone. See [Install the app](install.md#permissions). | -| "No Photos Selected" | Select at least one photo or video before you tap **Upload**. | -| "Failed to create milestone. Please try again." | A milestone needs the server. Check the connection and try again. | -| "No milestones available" | The app has no list of milestones yet. Pull the timeline down to sync, then try again. | -| "Empty Story" | Write some text first. | -| "Missing measurement" | Type at least one value in its range: height 1 to 250 cm, weight 0.1 to 200 kg, head 1 to 100 cm. | -| "Failed to post comment" | Check the connection. If it is good, you may not comment. Ask the admin. | -| "Failed to delete the moment" or "Failed to save the change" | The server refused the change. You may only change your own moments, unless you are the admin or a partner. | +| "Allow access to your photos" | The app may not read your photos. Tap **Open Settings** and allow access to photos and videos. See [Install the app](install.md#permissions). | +| "Could not load your albums." or "Could not load the photos of this album." | Close the add screen and open it again. | +| "Could not add the photos to the upload queue. Try again." | Try again. If the message comes back, close the app and open it again. | +| "Could not save the milestone. Check the connection and try again." | A milestone needs the server. Check the connection and try again. | +| "No milestones yet" | The app has no list of milestones yet. Connect to the internet and open the **Milestone** tab again. | +| "Enter a number from ... to ..." under a growth field | Type a value in its range: height 1 to 250 cm, weight 0.1 to 200 kg, head 1 to 100 cm. | +| "Could not save the story. Try again." or "Could not save the measurement" | Try again. | +| "Could not post your comment. Try again." | Check the connection. If it is good, you may not comment. Ask the admin. | +| "Could not delete the comment. Try again." | Check the connection. You may delete only your own comments, unless you are the admin. | +| "Could not delete the moment." or "Could not save the change." | The server refused the change. You may only change your own moments, unless you are the admin or a partner. | +| "Not saved." under the caption | Tap the message to save again. | | "Not saved on the server:" and a reason | The server did not accept a change from this phone. See below. | -| "Processing…" on a video | The server still prepares the video. Wait and try again later. | -| "Could not process video" | The server could not prepare the video. Tell the server owner. | -| "Could not play video" | Check the connection. Close the video and open it again. | +| "This moment is still syncing to this phone" | You tapped a look-back moment that is not on the phone yet. Wait, and try again. | +| "Processing" on a video, or "Processing your video…" | The server still prepares the video. Wait and try again later. | +| "Could not process" or "This video could not be processed." | The server could not prepare the video. Tell the server owner. | +| "Could not play this video." | Check the connection. Close the video and open it again. | ### "Not saved on the server" @@ -79,9 +84,9 @@ Pull the timeline down to sync. If the message stays, delete the moment on this | Message or status | What to do | | --- | --- | -| "2 uploads failed. Tap to see and retry." (with the number of failed items) | Tap the bar. On the **Upload Queue** screen, tap **Retry Failed**. See [Offline use and uploads](offline-and-uploads.md#failed-uploads). | -| An item stays **Pending** | The phone is offline, or the server does not answer. The queue tries again every 60 seconds. Check the connection. | -| An item is **Failed** again after a retry | The server refuses the file. See the list below. | +| "2 uploads failed. Tap to see and retry." (with the number of failed items) | Tap the bar. On the **Uploads** screen, tap **Retry failed**. See [Offline use and uploads](offline-and-uploads.md#failed-uploads). | +| An item stays **Waiting** | The phone is offline, or the server does not answer. The queue tries again every 60 seconds. Check the connection. | +| An item is **Upload failed** again after a retry | The server refuses the file. See the list below. | The server refuses a file in these cases: @@ -90,28 +95,33 @@ The server refuses a file in these cases: - You no longer have the permission **Add photos and moments**. - The child was deleted. -You can remove failed items with **Clear Failed**. The photos and videos stay on the phone. +You can remove failed items with **Remove failed**. The photos and videos stay on the phone. -## Servers +## Families | Message | What to do | | --- | --- | -| "Server already configured" | The app already knows this server. Find it on the **Servers** screen. | -| "Please test the connection first" | Tap **Test Connection** before **Add Server**. | +| "Server already configured" | The family is already on this phone. Find it on the **Families** screen. | +| "Test the connection first." | Tap **Test connection** before **Add family**. | | "Server not reachable" | The server does not answer. Check the address, the port and the network. | | "Server address not found" | The host name is wrong, or the phone cannot find it. Check the spelling. | -| "Cannot Remove" | You cannot remove the active server. Switch to another server first. If the server has unsent changes, let them sync first. | -| "Name not saved" | The server did not save the family name. Check the connection and try again. | +| "Could not open" with the name of a family | The app could not switch to the family. Check the connection and try again. | +| "Cannot remove this family" | You cannot remove the active family. Switch to another family first. | +| "Cannot remove this server yet" | The family has unsent changes on this phone. Switch to it and let them sync first. | +| "Name not saved. Check the connection and try again." | The server did not save the family name. Check the connection and try again. | -## Members and export +## Members, devices and export | Message | What to do | | --- | --- | | "Could not load members." | Check the connection. Only the admin can open **Members**. | | "Could not create the invitation." | Check the connection and try again. | +| "Could not revoke the invitation." | Check the connection and try again. | | "Could not save the changes." | Check the connection and try again. | | "Could not transfer the admin role." | Check the connection. Pull the **Members** list down, then try again. | | "You cannot change your own role. Make another member admin instead." | Use **Make admin** on another member. | +| "Could not load your signed-in devices." | Check the connection, then tap **Try again**. | +| "Could not sign out that device." or "Could not sign out everywhere." | Check the connection and try again. | | "An export is already running. Pull down to refresh its status." | Wait until the running export is ready. | | "Could not open the download link." | Pull the **Export** list down to get a new link, then try again. | @@ -121,11 +131,11 @@ You can remove failed items with **Clear Failed**. The photos and videos stay on | --- | --- | | "Not reset" | The app deleted nothing, because some changes could not reach the server. Wait until the uploads finish, or retry or remove failed uploads. Then try again. | | "Unsent changes will be lost" | Tap **Cancel** to keep the changes, and let them sync. Reset only if you accept that they are lost. | -| "Failed to reset and sync. Please try again." | Check the connection and try again. | +| "Could not reset and sync. Please try again." | Check the connection and try again. | ## Still a problem? - Pull the timeline down to start a sync. - Close the app and open it again. -- In **Settings**, use **Reset & Sync**. See [Settings](settings.md#reset-sync). +- In **Settings**, use **Reset and sync**. See [Settings](settings.md#reset-and-sync). - Ask the server owner to check the server. See [Server troubleshooting](../self-hosting/troubleshooting.md). diff --git a/docs/faq.md b/docs/faq.md index 3423e7a..f4a9dab 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -10,7 +10,7 @@ See [Install the app](/app/install). ## Can one server hold several families? -No. One server holds one family. A second family runs a second server. The app can hold several servers. See [Several servers](/app/multiple-servers). +No. One server holds one family. A second family runs a second server. The app can hold several families. See [Several families](/app/multiple-servers). ## Do I need a host name and HTTPS? diff --git a/docs/guide/what-is-kinlore.md b/docs/guide/what-is-kinlore.md index 6fd256c..97157c2 100644 --- a/docs/guide/what-is-kinlore.md +++ b/docs/guide/what-is-kinlore.md @@ -16,7 +16,7 @@ One Kinlore server holds one family. - **Shared data.** All members see all children and all moments. - **A family name.** The server has a name, for example "Anna Example Family". Members see it in the app and on invitations. A stranger who finds the server address does not see it. -A family that wants a second, separate space runs a second server. The app can hold several servers. See [Several servers](/app/multiple-servers). +A family that wants a second, separate space runs a second server. The app can hold several families. See [Several families](/app/multiple-servers). ## Roles diff --git a/docs/project/roadmap.md b/docs/project/roadmap.md index 4b7ac04..34648f0 100644 --- a/docs/project/roadmap.md +++ b/docs/project/roadmap.md @@ -12,7 +12,7 @@ Kinlore is a self-hosted family photo journal. One Kinlore server holds **one fa - **Roles and permissions.** A partner can add and change everything. A family member can view, and can add moments, like, comment and download when the admin allows it. The full rules are in [API rules, section 1](/reference/api#_1-roles-and-permissions). - **Two ways to run it.** With Docker (PostgreSQL, SeaweedFS, Caddy with optional built-in HTTPS), see [Install with Docker](/self-hosting/docker). Or directly on a Linux host, where SQLite and the local disk are enough, see [Install without Docker](/self-hosting/bare-metal). -A family that wants a second space runs a second server. The app can hold several servers by address. +A family that wants a second space runs a second server. The app can hold several families, one server each, and switch between them. ## Planned work @@ -24,4 +24,4 @@ Open items, most useful first. 4. Tag one moment to several children, and access per child for each member. 5. A web app for viewing, and for upload from a desktop computer. 6. Uploads that continue on Android after the system stops the app in the background. iOS does this; on Android the upload starts again when the app opens. -7. Smaller items: look-back in the time zone of the family, a "Change password" item for every member, a sessions screen (the API can list and revoke sign-ins), and cleanup of expired invitations. +7. Smaller items: look-back in the time zone of the family, a "Change password" item for every member, and cleanup of expired invitations. diff --git a/docs/reference/api.md b/docs/reference/api.md index 16e6db8..b91d2f5 100644 --- a/docs/reference/api.md +++ b/docs/reference/api.md @@ -68,13 +68,16 @@ Returned by login, register and `/auth/me` (`/auth/me` adds the count fields): - Behind a reverse proxy, the pages and form action use the proxy's `https` address (trusted proxies, section 10). API: -- `GET /auth/setup-status` (public): `{ needs_setup: bool, setup_token_required: bool, instance_name: string, setup_url: string }`. `setup_url` is `{APP_URL}/setup`. `setup_token_required` is the same as `needs_setup`. The app uses it to tell the user to finish setup in a browser. +- `GET /auth/setup-status` (public): `{ needs_setup: bool, setup_token_required: bool, instance_name: string, setup_url: string }`. `setup_url` is `{base}/setup` (see the public address rule below). `setup_token_required` is the same as `needs_setup`. The app uses it to tell the user to finish setup in a browser. - `POST /auth/register`: `name, email, password, password_confirmation, invite_token` (required). It only registers invited users and gives them the role and permissions of the invitation. On an instance with no user it returns `403` with the message "Finish setup in a web browser at {setup_url}". A taken email gives a `422` email error only together with a valid invitation; without one the answer is the invitation error. - `GET /auth/invitations/{token}` (public, throttled 10/min): `200 { valid: true, email: string|null, role, invited_by: { name }, expires_at, instance_name }`, or `404` when unknown, used or expired. - Invitation item (admin endpoints): `{ id, email, role, permissions: {...}, invited_by: { id, name }, expires_at, created_at }`. -- `POST /v1/invitations` (admin): `{ email?, role?: partner|family (default family), permissions?: { add_content?, comment?, like?, download? }, expires_in_days?: 1..30 (default 7) }` → `201` invitation item plus `token`, `invite_link`, `invite_url`: - - `invite_link` = `kinlore://invite/{token}?server={urlencoded APP_URL}` - - `invite_url` = `{APP_URL}/invite/{token}`: a small public HTML page with an "Open in Kinlore" button (the `invite_link`), the server address and the token, for people who get the link in a message app. +- `POST /v1/invitations` (admin): `{ email?, role?: partner|family (default family), permissions?: { add_content?, comment?, like?, download? }, expires_in_days?: 1..30 (default 7) }` → `201` invitation item plus `token`, `invite_link`, `invite_url`, `public_url_configured`: + - `invite_link` = `kinlore://invite/{token}?server={urlencoded base}` + - `invite_url` = `{base}/invite/{token}`: a small public HTML page with an "Open in Kinlore" button (the `invite_link`), the server address and the token, for people who get the link in a message app. + - `public_url_configured` (bool): `false` when `APP_URL` is empty or a placeholder. The links then use the address of this request. The app can tell the admin to set `APP_URL`. + +**Public address rule.** `{base}` is `APP_URL` when it is a real address. `APP_URL` is then used even when the request comes in on another host name. `APP_URL` is a placeholder when it is empty, `localhost`, `127.0.0.1`, `::1`, `0.0.0.0`, or a host under `example.com`, `example.org` or `example.net`. Then `{base}` is the address of the request, as seen through the trusted proxies (section 10). This rule applies to `invite_link`, `invite_url`, `setup_url`, the invite page and the setup pages. - `GET /v1/invitations` (admin): pending invitations. `DELETE /v1/invitations/{id}` (admin): revoke. **Family name.** The family name is the friendly name of this server, at most 60 characters. The app shows it in place of the server address. @@ -173,4 +176,4 @@ The API trusts `X-Forwarded-Proto`, `X-Forwarded-Host`, `X-Forwarded-Port` and ` ## 11. Health -`GET /health` (public, no envelope): `{ status, timestamp, service }`. `GET /health/detailed` (admin only). +`GET /health` (public, no envelope): `{ status, timestamp, service }`. `GET /health/detailed` (admin only). Its `checks.public_url` has `status: "warning"` when `APP_URL` is empty or a placeholder (see the public address rule in section 3), and `"ok"` otherwise. The warning does not change the overall status. diff --git a/docs/self-hosting/configuration.md b/docs/self-hosting/configuration.md index 4a61370..97e08ab 100644 --- a/docs/self-hosting/configuration.md +++ b/docs/self-hosting/configuration.md @@ -32,7 +32,7 @@ The settings file holds `APP_KEY` and the passwords. Without it, a backup cannot | Variable | Description | Default | |---|---|---| | `APP_KEY` | The secret key of the server. It protects sessions, signed links and encrypted values. Make it with `echo "base64:$(openssl rand -base64 32)"`. | none | -| `APP_URL` | The address that the phones use, for example `https://photos.example.com`. Include a port if it is not 80 or 443. Invitation links, video links and the setup page are built from it. | `http://localhost:28461` | +| `APP_URL` | The public address that the phones and invited people use, for example `https://kinlore.yourfamily.net`. Include a port if it is not 80 or 443. Invitation links, the invite page and the setup address are built from it. Replace the example value: see [APP_URL placeholder](#app-url-placeholder). | `http://localhost:28461` | | `DB_PASSWORD` | The password of the database user. PostgreSQL gets it at its first start. Make it with `openssl rand -hex 32`. | none | | `SEAWEEDFS_KEY` | The access key of the media storage. Make it with `openssl rand -hex 32`. | none | | `SEAWEEDFS_SECRET` | The secret key of the media storage. Make it with `openssl rand -hex 32`. | none | @@ -42,6 +42,14 @@ The settings file holds `APP_KEY` and the passwords. Without it, a backup cannot - PostgreSQL keeps the first `DB_PASSWORD`. A new value in `.env` does not change the database password, and the API can then not connect. ::: +### APP_URL placeholder {#app-url-placeholder} + +The server treats `APP_URL` as a placeholder when it is empty, `localhost`, `127.0.0.1`, `::1`, `0.0.0.0`, or a host under `example.com`, `example.org` or `example.net`, such as `photos.example.com` from the example file. Then it builds the links from the address of the request. That is the address that the admin's phone used. This is only a fallback: on a phone that uses a local address, the links do not work for other people. The request address comes from the `Host` header, which the client sends. So with a placeholder, the public invite page and setup pages show back the host name of whoever asks. A shared cache in front of the server must therefore keep these pages apart by host name, or not store them. Set a real `APP_URL`, and none of this applies. + +To see the problem, look at `checks.public_url` in `GET /api/health/detailed`, or at the warning of `php artisan kinlore:setup-token`. The app can also warn the admin when an invitation is made. + +To fix it, set `APP_URL` to the public address, then run `docker compose up -d` (host install: `sudo -u www-data php artisan config:cache`). Invitations made before the change keep their old link. Revoke them and make new ones. + ## Address and HTTPS | Variable | Description | Default | diff --git a/docs/self-hosting/troubleshooting.md b/docs/self-hosting/troubleshooting.md index c30af1a..d4dd64d 100644 --- a/docs/self-hosting/troubleshooting.md +++ b/docs/self-hosting/troubleshooting.md @@ -27,6 +27,7 @@ More log commands are in [Maintenance](/self-hosting/maintenance#logs). | `docker compose` stops with an error about `!override` | Docker Compose is older than 2.24.4. `deploy/docker/reverse-proxy.yml` needs a newer version. Check with `docker compose version`, then update Docker. See [Requirements](/self-hosting/requirements#docker-and-docker-compose). | | A log shows `permission denied` for a folder under `DATA_LOCATION` | With `deploy/docker/bind-mounts.yml`, each service writes as its own user into its subfolder. Keep the data folder on a local Linux file system such as ext4. Network shares and disks with FAT or NTFS often do not keep the owner of a file. After a copy, check that you used `cp -a`. See [Data locations](/self-hosting/data-locations). | | The setup page does not accept the token | Print the token again with `php artisan kinlore:setup-token`. If `SETUP_TOKEN` is set, enter that value. See [Create the first admin](/self-hosting/first-admin). | +| Invitation links show `photos.example.com` (or `localhost`) | `APP_URL` still has the example value. The server then uses the address of the request, but that can be a local address that other people cannot open. Set `APP_URL` to the public address, run `docker compose up -d`, then make new invitations. See [APP_URL placeholder](/self-hosting/configuration#app-url-placeholder). | | A changed variable has no effect | Docker: run `docker compose up -d`; `docker compose restart` is not enough. Host install: run `sudo -u www-data php artisan config:cache`. In Docker, check that the name is passed to the container. See [Where the variables are](/self-hosting/configuration#where-the-variables-are). | ## Web server and HTTPS diff --git a/docs/tutorials/invite-your-family.md b/docs/tutorials/invite-your-family.md index 2b803b7..2ee92f5 100644 --- a/docs/tutorials/invite-your-family.md +++ b/docs/tutorials/invite-your-family.md @@ -5,29 +5,30 @@ In the example, the admin invites Ben to the server of "Anna Example Family" at ## What you need -- You are the admin of the server, and you are signed in to the app. See [Connect to a server](../app/connect.md). +- You are the admin of the family, and you are signed in to the app. See [Connect to a server](../app/connect.md). - The family has at least one child. See [Children](../app/children.md). - The person that you invite has the Kinlore app on their phone. See [Install the app](../app/install.md). - The phone of the person can reach the server. For a server at home, the phone must use the home network. ## Part 1: The admin makes the invitation -1. Open the **Settings** tab. -2. Under **Family**, tap **Members**. -3. Tap the button at the top right ("Invite a member"). The app shows "Invite". -4. In **Email (optional)**, type the email of the person, for example `ben@example.com`. Then only this address can use the invitation. You can also leave the field empty. -5. Under **Role**, tap a role: +1. Open the **Settings** tab. The card at the top shows the family name. With several families, check that it is the right family, or tap **Switch family**. +2. In the family section, tap **Invite someone**. The app shows "Invite to Anna Example Family", with the server address. +3. In **Email (optional)**, type the email of the person, for example `ben@example.com`. Then only this address can use the invitation. You can also leave the field empty. +4. Under **Role**, tap a role: - **Partner** for a person who manages the children and the moments with you, for example the other parent. - **Family** for all other people, for example grandparents. -6. For **Family**, choose the permissions. All four are on. Turn off what the person may not do: +5. For **Family**, choose the permissions. All four are on. Turn off what the person may not do: - **Add photos and moments** - **Comment** - **Like** - **Download original files** -7. Under **Expires after**, tap the number of days, for example **7 days**. -8. Tap **Create Invitation**. +6. Under **Expires after**, tap the number of days, for example **7 days**. +7. Tap **Create invitation**. -The app shows "Invitation ready", with a **Web page** link and an **App link**. +The app shows "Invitation ready", with a **Web page** link and an **App link**. The links start with the public address of the server, for example `https://photos.example.com/invite/...`. + +If the app also shows "The server has no public address", the server still has the example address in its settings. The links then use the address that your phone uses. If that is an address on your home network, Ben can open the links only on that network. Ask the server owner to set `APP_URL` to the public address, then make a new invitation. See [APP_URL placeholder](../self-hosting/configuration.md#app-url-placeholder). ## Part 2: The admin sends the invitation @@ -42,7 +43,7 @@ Send the invitation only to the person that you invite. Anyone with the link can ### Check that it worked -On the **Members** screen, the invitation is under **Pending invitations**, with the role and the date when it expires. +In **Settings**, tap **Members**. The invitation is under **Pending invitations**, with the role, "invited by" with your name, and the date when it expires. ## Part 3: The invited person joins @@ -51,38 +52,40 @@ The person does these steps on their own phone. 1. Open the message from the admin. 2. Tap the app link that starts with `kinlore://invite/`. Or tap the web page link, then tap the button on the page to open the app. 3. The app asks "Join photos.example.com?". Tap **Join**. -4. The app shows "Create Account", and who sent the invitation. -5. Type **Your Name**, for example "Ben". +4. The app shows "Create your account", and who sent the invitation. +5. Type **Your name**, for example "Ben". 6. Check the **Email**. If the admin typed an email, the app fills it in. -7. Type a **Password** with at least 8 characters. Type it again in **Confirm Password**. -8. Tap **Create Account & Join**. +7. Type a **Password** with at least 8 characters. Type it again in **Repeat the password**. +8. Tap **Create account and join**. The app shows "Loading your family...", then the timeline of the family. If the link does not open the app: 1. Open the app. -2. In **Server URL**, type the server address, for example `photos.example.com`. The web page of the invitation shows it. +2. In **Server address**, type the server address, for example `photos.example.com`. The web page of the invitation shows it. 3. Tap **Continue**. 4. Tap **I have an invitation**. 5. Paste the invitation link, or type the invitation code from the web page. -6. Tap **Use Invitation**. +6. Tap **Use invitation**. 7. Continue with step 5 above. ### Check that it worked - On the phone of the person, the timeline shows the children of the family. -- In **Settings**, under **Account**, the person sees their name and their role, for example "Role: Family". -- On the admin's phone, open **Members**. The person is under **Family members**, and the invitation is no longer under **Pending invitations**. +- In **Settings**, the card at the top shows the family name, and the person's name and role, for example "You: Ben, Family". +- On the admin's phone, open **Members**. The person is in the list of members, and the invitation is no longer under **Pending invitations**. ## Part 4: The first sign-in on another phone The account now exists. On a second phone, or after a sign-out, the person signs in with the email and the password: 1. Open the app. -2. Type the server address in **Server URL** and tap **Continue**. +2. Type the server address in **Server address** and tap **Continue**. 3. Type the **Email** and the **Password**. -4. Tap **Sign In**. +4. Tap **Sign in**. + +If the person already uses Kinlore for another family, they add this family in **Settings** with **Add another family**. See [Several families](../app/multiple-servers.md#add-a-family). ## Change the rights later @@ -92,6 +95,7 @@ The admin can change the role and the permissions of a member at any time. See [ - **"This invitation is not valid. It is used, expired or unknown. Ask for a new invitation."**: the admin makes a new invitation. - **"A valid invitation is required to join this instance."**: the email in the form is not the email of the invitation. Use the email that the admin typed, or ask for a new invitation. -- **"Connection Failed"** or **"Cannot reach the server"**: the phone cannot reach the server. Check the network of the phone. +- **"Could not connect to the server"** or **"Cannot reach the server"**: the phone cannot reach the server. Check the network of the phone. +- **The link opens `photos.example.com` or a home address that does not work.** The server has no public address. See [APP_URL placeholder](../self-hosting/configuration.md#app-url-placeholder). - **The person forgot the password.** The admin sets a new one. See [Family and permissions](../app/family-and-permissions.md#set-a-new-password-for-a-member). - For more messages, see [Troubleshooting](../app/troubleshooting.md). diff --git a/docs/tutorials/upload-your-phone-photos.md b/docs/tutorials/upload-your-phone-photos.md index fb34465..cec60c3 100644 --- a/docs/tutorials/upload-your-phone-photos.md +++ b/docs/tutorials/upload-your-phone-photos.md @@ -17,9 +17,9 @@ This tutorial shows you how to pick many photos and videos from the gallery of y ## Step 2: Open the gallery -1. Tap the **+** button at the top right ("Add memories"). +1. Tap the **+** button at the top right ("Add a memory"). 2. The first time, the phone asks for access to your photos and videos. Allow it. See [Install the app](../app/install.md#permissions). -3. The **Media** tab shows the albums of your phone. Tap an album. +3. The app shows "New moment". The **Photos** tab shows the albums of your phone. Tap an album. ## Step 3: Pick the photos and videos @@ -27,12 +27,12 @@ This tutorial shows you how to pick many photos and videos from the gallery of y 2. To remove an item from the selection, tap it again. 3. To pick from another album, go back to the albums and tap another album. Your selection stays. -On the album list, the title at the top shows the number of items, for example "12 Selected". +The button at the bottom shows what you selected, for example "Add 10 photos and 2 videos". Items with a check mark are on the server already for this child. You cannot select them again. ## Step 4: Start the upload -1. Tap **Upload**. The app goes back to the timeline at once. +1. Tap the button at the bottom, for example **Add 10 photos and 2 videos**. The app goes back to the timeline at once. 2. The items show on the timeline right away, each with a small cloud icon. The app now sends the items one at a time. You can keep using the app. Keep it open for the fastest upload: in the background, the phone sends the rest only from time to time. On mobile data, the items wait for Wi-Fi unless you allow mobile data (see [Mobile data](../app/offline-and-uploads.md#mobile-data)). @@ -40,13 +40,13 @@ The app now sends the items one at a time. You can keep using the app. Keep it o ## Step 5: Watch the queue 1. Look at the status bar at the bottom of the screen. It shows, for example, "Uploading 3 / 12". -2. Tap the bar. The app shows the **Upload Queue** screen. -3. Each item shows **Pending**, **Uploading...**, **Uploaded** or **Failed**. -4. To go back, tap the back button. +2. Tap the bar. The app shows the **Uploads** screen. +3. Each item shows **Waiting**, **Uploading…**, **Uploaded** or **Upload failed**. +4. To go back, tap the close button ("Close"). -Items with **Uploaded** leave the list after a few seconds. When the queue is empty, the screen shows "All Caught Up!". +Items with **Uploaded** leave the list after a few seconds. When the queue is empty, the screen shows "Nothing to upload". -If the phone goes offline, the items stay **Pending**. The queue continues when the network is back. +If the phone goes offline, the items stay **Waiting**. The queue continues when the network is back. ## Step 6: Check the result @@ -58,15 +58,15 @@ If the phone goes offline, the items stay **Pending**. The queue continues when ### Check that it worked - The status bar is gone, and **Settings** > **Uploads** shows "Up to date". -- The **Upload Queue** screen shows "All Caught Up!". +- The **Uploads** screen shows "Nothing to upload". - The photos and videos are on the timeline of the child, at the date when you took them. - Open the gallery again: the uploaded items have a check mark. ## Problems -- **The bar shows "2 uploads failed. Tap to see and retry."** (with the number of failed items) Tap the bar, then tap **Retry Failed**. If an item fails again, the server refuses it. See [Offline use and uploads](../app/offline-and-uploads.md#failed-uploads). -- **Items stay "Pending".** The phone cannot reach the server. Check the network. The queue tries again every 60 seconds. +- **The bar shows "2 uploads failed. Tap to see and retry."** (with the number of failed items) Tap the bar, then tap **Retry failed**. If an item fails again, the server refuses it. See [Offline use and uploads](../app/offline-and-uploads.md#failed-uploads). +- **Items stay "Waiting".** The phone cannot reach the server. Check the network. The queue tries again every 60 seconds. - **The + button is missing.** You may not add moments. Ask the admin. -- **"Permission Required"**: allow access to photos and videos in the Settings app of your phone. -- **A video shows "Processing…".** The server still prepares the video. Wait and open it again later. +- **"Allow access to your photos"**: tap **Open Settings** and allow access to photos and videos. +- **A video shows "Processing".** The server still prepares the video. Wait and open it again later. - For more messages, see [Troubleshooting](../app/troubleshooting.md). diff --git a/kinlore-api/app/Console/Commands/SetupToken.php b/kinlore-api/app/Console/Commands/SetupToken.php index 70c677b..7cdf5c6 100644 --- a/kinlore-api/app/Console/Commands/SetupToken.php +++ b/kinlore-api/app/Console/Commands/SetupToken.php @@ -6,6 +6,7 @@ use App\Models\User; use App\Services\AuthService; +use App\Support\PublicUrl; use Illuminate\Console\Attributes\Description; use Illuminate\Console\Attributes\Signature; use Illuminate\Console\Command; @@ -33,6 +34,9 @@ public function handle(AuthService $auth): int $this->line('Setup token: '.$auth->setupToken()); $this->line('Open '.$auth->setupUrl().' and enter this token to create the admin account.'); + if (! PublicUrl::isConfigured()) { + $this->warn('APP_URL is empty or a placeholder. Set it to the public address of this server, or invite links will not work.'); + } return self::SUCCESS; } diff --git a/kinlore-api/app/Http/Controllers/Api/HealthController.php b/kinlore-api/app/Http/Controllers/Api/HealthController.php index 01ddaa1..bd1230e 100644 --- a/kinlore-api/app/Http/Controllers/Api/HealthController.php +++ b/kinlore-api/app/Http/Controllers/Api/HealthController.php @@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api; use App\Http\Controllers\Controller; +use App\Support\PublicUrl; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; @@ -45,7 +46,12 @@ public function detailed(): JsonResponse // 5. Memory $checks['memory'] = $this->checkMemory(); - // 6. PHP Version + // 6. Public address for invite and setup links: a warning only, the server still works + $checks['public_url'] = PublicUrl::isConfigured() + ? ['status' => 'ok', 'url' => PublicUrl::base()] + : ['status' => 'warning', 'url' => PublicUrl::base(), 'message' => 'APP_URL is empty or a placeholder; links use the address of this request. Set APP_URL to the public address.']; + + // 7. PHP Version $checks['php'] = [ 'version' => PHP_VERSION, 'extensions' => $this->getRequiredExtensions(), diff --git a/kinlore-api/app/Http/Controllers/Api/InvitationController.php b/kinlore-api/app/Http/Controllers/Api/InvitationController.php index ef83d8f..e5c0759 100644 --- a/kinlore-api/app/Http/Controllers/Api/InvitationController.php +++ b/kinlore-api/app/Http/Controllers/Api/InvitationController.php @@ -9,6 +9,7 @@ use App\Http\Requests\Api\StoreInvitationRequest; use App\Http\Responses\ApiResponse; use App\Models\Invitation; +use App\Support\PublicUrl; use Illuminate\Http\JsonResponse; use Illuminate\Support\Str; @@ -49,6 +50,7 @@ public function store(StoreInvitationRequest $request): JsonResponse 'token' => $token, 'invite_link' => $invitation->inviteLink(), 'invite_url' => $invitation->inviteUrl(), + 'public_url_configured' => PublicUrl::isConfigured(), ], 'Invitation created', 201 diff --git a/kinlore-api/app/Http/Controllers/InviteLinkController.php b/kinlore-api/app/Http/Controllers/InviteLinkController.php index a4a926b..b89797c 100644 --- a/kinlore-api/app/Http/Controllers/InviteLinkController.php +++ b/kinlore-api/app/Http/Controllers/InviteLinkController.php @@ -6,6 +6,7 @@ use App\Services\AuthService; use App\Services\FamilyService; +use App\Support\PublicUrl; use Illuminate\Http\Response; /** @@ -26,7 +27,7 @@ public function show(string $token): Response // Only the holder of a valid invitation sees the family name. 'instanceName' => $invitation ? $this->family->name() : config('app.name'), 'invitation' => $invitation, - 'server' => config('app.url'), + 'server' => PublicUrl::base(), ], $invitation ? 200 : 404); } } diff --git a/kinlore-api/app/Http/Controllers/SetupController.php b/kinlore-api/app/Http/Controllers/SetupController.php index f63f047..55e16e8 100644 --- a/kinlore-api/app/Http/Controllers/SetupController.php +++ b/kinlore-api/app/Http/Controllers/SetupController.php @@ -8,6 +8,7 @@ use App\Models\User; use App\Services\AuthService; use App\Services\FamilyService; +use App\Support\PublicUrl; use Illuminate\Http\RedirectResponse; use Illuminate\View\View; @@ -59,7 +60,7 @@ private function pageData(): array { return [ 'instanceName' => config('app.name'), - 'server' => config('app.url') ?: url('/'), + 'server' => PublicUrl::base(), ]; } } diff --git a/kinlore-api/app/Models/Invitation.php b/kinlore-api/app/Models/Invitation.php index 9990b07..0936ef4 100644 --- a/kinlore-api/app/Models/Invitation.php +++ b/kinlore-api/app/Models/Invitation.php @@ -5,6 +5,7 @@ namespace App\Models; use App\Enums\Role; +use App\Support\PublicUrl; use Illuminate\Database\Eloquent\Attributes\Fillable; use Illuminate\Database\Eloquent\Attributes\Hidden; use Illuminate\Database\Eloquent\Attributes\Scope; @@ -72,11 +73,11 @@ public function toItem(): array public function inviteLink(): string { - return "kinlore://invite/{$this->token}?server=".rawurlencode((string) config('app.url')); + return "kinlore://invite/{$this->token}?server=".rawurlencode(PublicUrl::base()); } public function inviteUrl(): string { - return rtrim((string) config('app.url'), '/')."/invite/{$this->token}"; + return PublicUrl::base()."/invite/{$this->token}"; } } diff --git a/kinlore-api/app/Services/AuthService.php b/kinlore-api/app/Services/AuthService.php index bbeab77..e851b2d 100644 --- a/kinlore-api/app/Services/AuthService.php +++ b/kinlore-api/app/Services/AuthService.php @@ -9,6 +9,7 @@ use App\Models\Kid; use App\Models\Moment; use App\Models\User; +use App\Support\PublicUrl; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; @@ -46,12 +47,10 @@ public function setupStatus(): array ]; } - // From APP_URL when set: url() follows the request Host header, which any client chooses. + // From APP_URL when it is real: url() follows the request Host header, which any client chooses. public function setupUrl(): string { - $base = config('app.url'); - - return filled($base) ? rtrim($base, '/').'/setup' : url('/setup'); + return PublicUrl::base().'/setup'; } /** diff --git a/kinlore-api/app/Support/PublicUrl.php b/kinlore-api/app/Support/PublicUrl.php new file mode 100644 index 0000000..0d85f7a --- /dev/null +++ b/kinlore-api/app/Support/PublicUrl.php @@ -0,0 +1,31 @@ +admin()->create()); + + return $this->postJson($base.'/api/v1/invitations')->assertStatus(201)->json('data'); + } + + public function test_placeholder_app_url_falls_back_to_the_request_address(): void + { + config(['app.url' => 'https://photos.example.com']); + + $data = $this->createInvitation('https://family.lan:8443'); + + $this->assertFalse($data['public_url_configured']); + $this->assertSame("https://family.lan:8443/invite/{$data['token']}", $data['invite_url']); + $this->assertSame("kinlore://invite/{$data['token']}?server=https%3A%2F%2Ffamily.lan%3A8443", $data['invite_link']); + + $this->get("https://family.lan:8443/invite/{$data['token']}")->assertOk() + ->assertSee('https://family.lan:8443', false) + ->assertSee("kinlore://invite/{$data['token']}?server=https%3A%2F%2Ffamily.lan%3A8443", false) + ->assertDontSee('photos.example.com'); + $this->getJson('https://family.lan:8443/api/auth/setup-status')->assertJsonPath('data.setup_url', 'https://family.lan:8443/setup'); + } + + public function test_real_app_url_wins_over_the_host_header(): void + { + config(['app.url' => 'https://kin.family.test/']); + + $data = $this->createInvitation('http://other.host'); + + $this->assertTrue($data['public_url_configured']); + $this->assertSame("https://kin.family.test/invite/{$data['token']}", $data['invite_url']); + $this->assertSame("kinlore://invite/{$data['token']}?server=https%3A%2F%2Fkin.family.test", $data['invite_link']); + $this->get("http://other.host/invite/{$data['token']}")->assertOk() + ->assertSee('https://kin.family.test', false) + ->assertDontSee('other.host'); + } + + public function test_placeholder_detection(): void + { + $placeholders = ['', 'http://localhost', 'http://localhost:8000', 'http://127.0.0.1', 'http://[::1]:8000', 'http://0.0.0.0', + 'https://example.com', 'https://photos.example.com', 'https://EXAMPLE.org', 'https://a.b.example.net', 'photos.kin.app']; + foreach ($placeholders as $url) { + config(['app.url' => $url]); + $this->assertFalse(PublicUrl::isConfigured(), $url); + } + + foreach (['https://kin.app', 'https://myexample.com', 'https://example.com.kin.app', 'http://192.168.1.20:8000'] as $url) { + config(['app.url' => $url]); + $this->assertTrue(PublicUrl::isConfigured(), $url); + } + } + + public function test_detailed_health_warns_about_a_placeholder_app_url(): void + { + Storage::fake(config('filesystems.default')); + Sanctum::actingAs(User::factory()->admin()->create()); + + config(['app.url' => 'https://photos.example.com']); + $this->getJson('/api/health/detailed')->assertJsonPath('checks.public_url.status', 'warning'); + + config(['app.url' => 'https://kin.app']); + $this->getJson('/api/health/detailed')->assertJsonPath('checks.public_url.status', 'ok') + ->assertJsonPath('checks.public_url.url', 'https://kin.app'); + } +}