From d1cda51e80fc7575b864169495bfbfd03f4141d6 Mon Sep 17 00:00:00 2001 From: Nika Tskhakaia Date: Fri, 3 Apr 2020 14:14:05 +0000 Subject: Translated using Weblate (Georgian) Currently translated at 29.9% (71 of 237 strings) Translation: Lemmy/lemmy Translate-URL: http://weblate.yerbamate.dev/projects/lemmy/lemmy/ka/ --- ui/translations/ka.json | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/ui/translations/ka.json b/ui/translations/ka.json index 2c63c085..01dbe4ed 100644 --- a/ui/translations/ka.json +++ b/ui/translations/ka.json @@ -1,2 +1,75 @@ { + "post": "პოსტი", + "remove_post": "პოსტის წაშლა", + "no_posts": "0 პოსტები", + "create_a_post": "პოსტის შექმნა", + "create_post": "პოსტის შექმნა", + "number_of_posts": "თარგმნა", + "number_of_posts_plural": "თარგმნა", + "posts": "პოსტები", + "cross_posts": "ეს ლინკი უკვე დადებულია აქ:", + "comments": "კომენტარები", + "number_of_comments": "კომენტარი", + "number_of_comments_plural": "კომანტარები", + "remove_comment": "კომენტარის წაშლა", + "communities": "თემები", + "users": "მომხმარებელი", + "create_a_community": "ახალი თემის შექმნა", + "create_community": "თემის შექმნა", + "remove_community": "თემის წაშლა", + "community_reqs": "პატარა ასო, ქვედა ტირე, და გამოტოვების გარეშე.", + "create_private_message": "კერძო მესეჯის შექმნა", + "send_secure_message": "ინკრიპტული მესეჯის გაგზავნა", + "send_message": "მესეჯის გაგზავნა", + "message": "მესეჯი", + "edit": "რადექტირება", + "reply": "პასუხის გაცემა", + "more": "მეტი", + "cancel": "გაუქება", + "upload_image": "სურათის ატვირთვა", + "avatar": "ავატარი", + "upload_avatar": "ავატარის ატვირთვა", + "show_context": "კონტექსტის ნახვა", + "sorting_help": "სორტირების დახმარება", + "view_source": "view source", + "unlock": "გაღება", + "lock": "ჩაკეტვა", + "sticky": "sticky", + "link": "ლინკი", + "archive_link": "ლინკის არქივება", + "mod": "მოდერატორი", + "mods": "მოდერატორები", + "moderates": "მოდერატორს", + "settings": "პარამეტრები", + "appoint_as_mod": "დანიშნე როგორც მოდერატორი", + "modlog": "მოდ-ლოგი", + "admin": "ადმინი", + "admins": "ადმინები", + "appoint_as_admin": "დანიშნე როგორც ადმინი", + "remove": "მოხსნა", + "removed": "მოხსნილია", + "locked": "ჩაკეტილი", + "stickied": "დაწეპებული", + "reason": "მიზეზი", + "mark_as_read": "მონიშნე როგორც წაკითხული", + "mark_as_unread": "მონიშნე როგორც წაუკითხავი", + "delete": "წაშლა", + "deleted": "წაშლილია", + "delete_account": "ჩემი ანგარიშის წაშლა", + "restore": "რასტორაცია", + "ban": "გაშავება", + "ban_from_site": "გაშავება საიტიდან", + "unban": "გაშავების გაუქმნება", + "unban_from_site": "სატიდან გაშავების გაუქმნება", + "banned": "გაშავებულია", + "save": "დამახსოვრება", + "unsave": "დამახსოვრების გაუქმნება", + "create": "შექმნა", + "preview": "წინასწარ ნახვა", + "show_avatars": "ავატარები გამოჩენა", + "formatting_help": "formatting help", + "unsticky": "unsticky", + "remove_as_mod": "მოხსენი როგორც მოდერატორი", + "remove_as_admin": "მოხსენი როგორც ადმინი", + "delete_account_confirm": "გაფთხილება: ეს შენს ყველაფერს წაშლის. პაროლი ჩაწერეთ რომ დაადასტუროთ." } -- cgit v1.2.3 From a497a568db6349b25f7b662079141f8a3ddfb6cd Mon Sep 17 00:00:00 2001 From: dessalines Date: Fri, 3 Apr 2020 14:14:05 +0000 Subject: Translated using Weblate (French) Currently translated at 94.0% (223 of 237 strings) Translation: Lemmy/lemmy Translate-URL: http://weblate.yerbamate.dev/projects/lemmy/lemmy/fr/ Translated using Weblate (Spanish) Currently translated at 100.0% (237 of 237 strings) Translation: Lemmy/lemmy Translate-URL: http://weblate.yerbamate.dev/projects/lemmy/lemmy/es/ --- ui/translations/es.json | 72 +++++++++++++++++++++++++++---------------------- ui/translations/fr.json | 3 ++- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/ui/translations/es.json b/ui/translations/es.json index 61bebb97..02dac76e 100644 --- a/ui/translations/es.json +++ b/ui/translations/es.json @@ -4,13 +4,15 @@ "no_posts": "Sin publicaciones.", "create_a_post": "Crear una publicación", "create_post": "Crear Publicación", - "number_of_posts": "{{count}} Publicaciones", + "number_of_posts": "{{count}} Publicación", + "number_of_posts_plural": "{{count}} Publicaciónes", "posts": "Publicaciones", "related_posts": "Estas publicaciones podrían estar relacionadas", "cross_posts": "Este link también ha sido publicado en:", "cross_post": "cross-post", "comments": "Comentarios", - "number_of_comments": "{{count}} Comentarios", + "number_of_comments": "{{count}} Comentario", + "number_of_comments_plural": "{{count}} Comentarios", "remove_comment": "Eliminar Comentarios", "communities": "Comunidades", "users": "Usuarios", @@ -20,7 +22,8 @@ "subscribed_to_communities": "Suscrito a <1>comunidades", "trending_communities": "<1>Comunidades en tendencia", "list_of_communities": "Lista de comunidades", - "number_of_communities": "{{count}} Comunidades", + "number_of_communities": "{{count}} Comunidad", + "number_of_communities_plural": "{{count}} Comunidades", "community_reqs": "minúsculas, guión bajo, y sin espacios.", "create_private_message": "Crear Mensaje Privado", "send_secure_message": "Enviar Mensaje Seguro", @@ -63,8 +66,7 @@ "delete": "eliminar", "deleted": "eliminado", "delete_account": "Eliminar Cuenta", - "delete_account_confirm": - "Aviso: esta acción eliminará permanentemente tu información. Introduce tu contraseña para continuar", + "delete_account_confirm": "Aviso: esta acción eliminará permanentemente tu información. Introduce tu contraseña para continuar", "restore": "restaurar", "ban": "expulsar", "ban_from_site": "expulsar del sitio", @@ -77,10 +79,14 @@ "creator": "creador", "username": "Nombre de Usuario", "email_or_username": "Correo o Usuario", - "number_of_users": "{{count}} Usuarios", - "number_of_subscribers": "{{count}} Suscriptores", - "number_of_points": "{{count}} Puntos", - "number_online": "{{count}} Usuarios En Línea", + "number_of_users": "{{count}} Usuario", + "number_of_users_plural": "{{count}} Usuarios", + "number_of_subscribers": "{{count}} Suscriptor", + "number_of_subscribers_plural": "{{count}} Suscriptores", + "number_of_points": "{{count}} Punto", + "number_of_points_plural": "{{count}} Puntos", + "number_online": "{{count}} Usuario En Línea", + "number_online_plural": "{{count}} Usuarios En Línea", "name": "Nombre", "title": "Titulo", "category": "Categoría", @@ -120,8 +126,7 @@ "login_sign_up": "Iniciar sesión / Crear cuenta", "login": "Iniciar sesión", "sign_up": "Crear cuenta", - "notifications_error": - "Notificaciones de escritorio no disponibles en tu navegador. Prueba Firefox o Chrome.", + "notifications_error": "Notificaciones de escritorio no disponibles en tu navegador. Prueba Firefox o Chrome.", "unread_messages": "Mensajes no leídos", "messages": "Mensajes", "password": "Contraseña", @@ -134,8 +139,7 @@ "no_email_setup": "Este servidor no ha activado correctamente el correo.", "email": "Correo electrónico", "matrix_user_id": "Usuario Matricial", - "private_message_disclaimer": - "Aviso: Los mensajes privados en Lemmy no son seguros. Por favor cree una cuenta en <1>Riot.im para mensajeria segura.", + "private_message_disclaimer": "Aviso: Los mensajes privados en Lemmy no son seguros. Por favor cree una cuenta en <1>Riot.im para mensajeria segura.", "send_notifications_to_email": "Enviar notificaciones al correo", "optional": "Opcional", "expires": "Expira", @@ -165,14 +169,12 @@ "theme": "Tema", "sponsors": "Patrocinadores", "sponsors_of_lemmy": "Patrocinadores de Lemmy", - "sponsor_message": - "Lemmy es software libre y de <1>código abierto, lo que significa que no tendrá publicidades, monetización, ni capitales emprendedores, nunca. Tus donaciones apoyan directamente el desarrollo a tiempo completo del proyecto. Muchas gracias a las siguientes personas:", + "sponsor_message": "Lemmy es software libre y de <1>código abierto, lo que significa que no tendrá publicidades, monetización, ni capitales emprendedores, nunca. Tus donaciones apoyan directamente el desarrollo a tiempo completo del proyecto. Muchas gracias a las siguientes personas:", "support_on_patreon": "Apoyo en Patreon", "support_on_liberapay": "Apoyo en Liberapay", "donate_to_lemmy": "Donar a Lemmy", "donate": "Donar", - "general_sponsors": - "Los Patrocinadores Generales son aquellos que señaron entre $10 y $39 a Lemmy.", + "general_sponsors": "Los Patrocinadores Generales son aquellos que señaron entre $10 y $39 a Lemmy.", "crypto": "Crypto", "bitcoin": "Bitcoin", "ethereum": "Ethereum", @@ -188,8 +190,7 @@ "yes": "sí", "no": "no", "powered_by": "Impulsado por", - "landing_0": - "Lemmy es un <1>agregador de links / alternativa a reddit, con la intención de funcionar en el <2>fediverso.<3>Es alojable por uno mismo (sin necesidad de grandes compañías), tiene actualización en vivo de cadenas de comentarios, y es pequeño (<4>~80kB). Federar con el sistema de redes ActivityPub forma parte de los objetivos del proyecto. <5>Esta es una <6>version beta muy prematura, y actualmente muchas de las características están rotas o faltan. <7>Sugiere nuevas características o reporta errores <8>aquí.<9>Hecho con <10>Rust, <11>Actix, <12>Inferno, <13>Typescript.", + "landing_0": "Lemmy es un <1>agregador de links / alternativa a reddit, con la intención de funcionar en el <2>fediverso.<3>Es alojable por uno mismo (sin necesidad de grandes compañías), tiene actualización en vivo de cadenas de comentarios, y es pequeño (<4>~80kB). Federar con el sistema de redes ActivityPub forma parte de los objetivos del proyecto. <5>Esta es una <6>version beta muy prematura, y actualmente muchas de las características están rotas o faltan. <7>Sugiere nuevas características o reporta errores <8>aquí.<9>Hecho con <10>Rust, <11>Actix, <12>Inferno, <13>Typescript.", "not_logged_in": "No has iniciado sesión.", "logged_in": "Has iniciado sesión.", "community_ban": "Has sido expulsado de esta comunidad.", @@ -204,12 +205,9 @@ "couldnt_find_community": "No se pudo encontrar la comunidad.", "couldnt_update_community": "No se pudo actualizar la comunidad.", "community_already_exists": "Esta comunidad ya existe.", - "community_moderator_already_exists": - "Este moderador de la comunidad ya existe.", - "community_follower_already_exists": - "Este seguidor de la comunidad ya existe.", - "community_user_already_banned": - "Este usuario de la comunidad ya fue expulsado.", + "community_moderator_already_exists": "Este moderador de la comunidad ya existe.", + "community_follower_already_exists": "Este seguidor de la comunidad ya existe.", + "community_user_already_banned": "Este usuario de la comunidad ya fue expulsado.", "couldnt_create_post": "No se pudo crear la publicación.", "couldnt_like_post": "No se pudo gustar la publicación.", "couldnt_find_post": "No se pudo encontrar la publicación.", @@ -220,21 +218,31 @@ "not_an_admin": "No es un administrador.", "site_already_exists": "El sitio ya existe.", "couldnt_update_site": "No se pudo actualizar el sitio.", - "couldnt_find_that_username_or_email": - "No se pudo encontrar ese nombre de usuario o correo electrónico.", + "couldnt_find_that_username_or_email": "No se pudo encontrar ese nombre de usuario o correo electrónico.", "password_incorrect": "Contraseña incorrecta.", "passwords_dont_match": "Las contraseñas no coinciden.", "admin_already_created": "Lo sentimos, ya hay un adminisitrador.", "user_already_exists": "El usuario ya existe.", "email_already_exists": "El correo ya está en uso.", "couldnt_update_user": "No se pudo actualizar el usuario.", - "system_err_login": - "Error del sistema. Intente cerrar sesión e ingresar de nuevo.", + "system_err_login": "Error del sistema. Intente cerrar sesión e ingresar de nuevo.", "couldnt_create_private_message": "No se pudo crear el mensaje privado.", - "no_private_message_edit_allowed": - "Sin permisos para editar el mensaje privado.", + "no_private_message_edit_allowed": "Sin permisos para editar el mensaje privado.", "couldnt_update_private_message": "No se pudo actualizar el mensaje privado.", "old": "Antiguo", "time": "Tiempo", - "action": "Acción" + "action": "Acción", + "more": "más", + "cross_posted_to": "publicado también en:", + "sorting_help": "ayuda del orden", + "upvote": "Voto Positivo", + "number_of_upvotes": "{{count}} Voto Positivo", + "number_of_upvotes_plural": "{{count}} Votos Positivos", + "downvote": "Voto Negativo", + "number_of_downvotes": "{{count}} Voto Negativo", + "number_of_downvotes_plural": "{{count}} Votos Negativos", + "couldnt_get_comments": "No se pudo obtener los comentarios.", + "post_title_too_long": "El título de la publicación es muy largo.", + "block_leaving": "¿Está seguro de que desea salir?", + "show_context": "Mostrar contexto" } diff --git a/ui/translations/fr.json b/ui/translations/fr.json index 7f61cbfe..96b8c3d1 100644 --- a/ui/translations/fr.json +++ b/ui/translations/fr.json @@ -227,5 +227,6 @@ "no_private_message_edit_allowed": "Pas autorisé à modifier un message privé.", "couldnt_update_private_message": "Impossible de modifier un message privé.", "time": "Temps", - "action": "Action" + "action": "Action", + "more": "plus" } -- cgit v1.2.3 From 0ca385deaf00d905081c66d0e0164558531e0e70 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 3 Apr 2020 13:46:25 -0400 Subject: Adding a text body preview and icon for posts with a body. Fixes #617 --- ui/src/components/post-listing.tsx | 20 ++++++++++++++++++++ ui/src/components/symbols.tsx | 3 +++ ui/src/utils.ts | 8 ++++++++ 3 files changed, 31 insertions(+) diff --git a/ui/src/components/post-listing.tsx b/ui/src/components/post-listing.tsx index ff863dcb..101d1807 100644 --- a/ui/src/components/post-listing.tsx +++ b/ui/src/components/post-listing.tsx @@ -20,6 +20,7 @@ import { MomentTime } from './moment-time'; import { PostForm } from './post-form'; import { IFramelyCard } from './iframely-card'; import { + md, mdToHtml, canMod, isMod, @@ -30,6 +31,7 @@ import { showAvatars, pictshareImage, setupTippy, + previewLines, } from '../utils'; import { i18n } from '../i18next'; @@ -459,6 +461,24 @@ export class PostListing extends Component { + {post.body && ( + <> +
  • +
  • + {/* Using a link with tippy doesn't work on touch devices unfortunately */} + + + + + +
  • + + )}
  • {this.state.upvotes !== this.state.score && ( <> diff --git a/ui/src/components/symbols.tsx b/ui/src/components/symbols.tsx index 16deec3e..dae734a8 100644 --- a/ui/src/components/symbols.tsx +++ b/ui/src/components/symbols.tsx @@ -15,6 +15,9 @@ export class Symbols extends Component { xmlnsXlink="http://www.w3.org/1999/xlink" > + + + diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 8ecef19b..d659509c 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -823,3 +823,11 @@ function hsl(num: number) { function randomHsl() { return `hsla(${Math.random() * 360}, 100%, 50%, 1)`; } + +export function previewLines(text: string, lines: number = 3): string { + // Use lines * 2 because markdown requires 2 lines + return text + .split('\n') + .slice(0, lines * 2) + .join('\n'); +} -- cgit v1.2.3 From 522299ea9eeee8b475080eb81805c55161d90baa Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 3 Apr 2020 14:37:44 -0400 Subject: Adding docs for DB Backup / Restore. Fixes #619 --- docs/src/SUMMARY.md | 1 + docs/src/about_goals.md | 1 + docs/src/administration_backup_and_restore.md | 44 +++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 docs/src/administration_backup_and_restore.md diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 70c423c7..bff5cbf6 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -10,6 +10,7 @@ - [Install with Ansible](administration_install_ansible.md) - [Install with Kubernetes](administration_install_kubernetes.md) - [Configuration](administration_configuration.md) + - [Backup and Restore](administration_backup_and_restore.md) - [Contributing](contributing.md) - [Docker Development](contributing_docker_development.md) - [Local Development](contributing_local_development.md) diff --git a/docs/src/about_goals.md b/docs/src/about_goals.md index caa6948a..e0427481 100644 --- a/docs/src/about_goals.md +++ b/docs/src/about_goals.md @@ -51,3 +51,4 @@ - [Activitypub implementers guide](https://socialhub.activitypub.rocks/t/draft-guide-for-new-activitypub-implementers/479) - [Data storage questions](https://socialhub.activitypub.rocks/t/data-storage-questions/579/3) - [Activitypub as it has been understood](https://flak.tedunangst.com/post/ActivityPub-as-it-has-been-understood) +- [Asonix http signatures in rust](https://git.asonix.dog/Aardwolf/http-signature-normalization) diff --git a/docs/src/administration_backup_and_restore.md b/docs/src/administration_backup_and_restore.md new file mode 100644 index 00000000..fe97cf88 --- /dev/null +++ b/docs/src/administration_backup_and_restore.md @@ -0,0 +1,44 @@ +# Backup and Restore Guide + +## Docker and Ansible + +When using docker or ansible, there should be a `volumes` folder, which contains both the database, and all the pictures. Copy this folder to the new instance to restore your data. + +### Incremental Database backup + +To incrementally backup the DB to an `.sql` file, you can run: + +```bash +docker exec -t FOLDERNAME_postgres_1 pg_dumpall -c -U lemmy > lemmy_dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql +``` +### A Sample backup script + +```bash +#!/bin/sh +# DB Backup +ssh MY_USER@MY_IP "docker exec -t FOLDERNAME_postgres_1 pg_dumpall -c -U lemmy" > ~/BACKUP_LOCATION/INSTANCE_NAME_dump_`date +%Y-%m-%d"_"%H_%M_%S`.sql + +# Volumes folder Backup +rsync -avP -zz --rsync-path="sudo rsync" MY_USER@MY_IP:/LEMMY_LOCATION/volumes ~/BACKUP_LOCATION/FOLDERNAME +``` + +### Restoring the DB + +If you need to restore from a `pg_dumpall` file, you need to first clear out your existing database + +```bash +# Drop the existing DB +docker exec -i FOLDERNAME_postgres_1 psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;" + +# Restore from the .sql backup +cat db_dump.sql | docker exec -i FOLDERNAME_postgres_1 psql -U lemmy # restores the db + +# This also might be necessary when doing a db import with a different password. +docker exec -i FOLDERNAME_postgres_1 psql -U lemmy -c "alter user lemmy with password 'bleh'" +``` + +## More resources + +- https://stackoverflow.com/questions/24718706/backup-restore-a-dockerized-postgresql-database + + -- cgit v1.2.3 From 6e5729c660b2d70826da6ee4b3b4a2f4e446bc76 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 3 Apr 2020 14:44:10 -0400 Subject: Fixing deploy script. --- docker/dev/deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/dev/deploy.sh b/docker/dev/deploy.sh index db2294fa..09b21b0b 100755 --- a/docker/dev/deploy.sh +++ b/docker/dev/deploy.sh @@ -72,5 +72,5 @@ git push origin $new_tag git push # Pushing to any ansible deploys -cd ../../ansible || exit -ansible-playbook lemmy.yml --become +cd ../../../lemmy-ansible || exit +ansible-playbook -i prod playbooks/site.yml --vault-password-file vault_pass -- cgit v1.2.3 From cb49a7e79044a76cabf8660e330294b2f370491c Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 3 Apr 2020 14:44:30 -0400 Subject: Version v0.6.45 --- ansible/VERSION | 2 +- docker/prod/docker-compose.yml | 2 +- server/src/version.rs | 2 +- ui/src/version.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/VERSION b/ansible/VERSION index 83ca525b..48861fee 100644 --- a/ansible/VERSION +++ b/ansible/VERSION @@ -1 +1 @@ -v0.6.44 +v0.6.45 diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 76f5ae14..325effa6 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -12,7 +12,7 @@ services: restart: always lemmy: - image: dessalines/lemmy:v0.6.44 + image: dessalines/lemmy:v0.6.45 ports: - "127.0.0.1:8536:8536" restart: always diff --git a/server/src/version.rs b/server/src/version.rs index 1491a0a2..c2717a78 100644 --- a/server/src/version.rs +++ b/server/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "v0.6.44"; +pub const VERSION: &str = "v0.6.45"; diff --git a/ui/src/version.ts b/ui/src/version.ts index fdf2c347..f0847f75 100644 --- a/ui/src/version.ts +++ b/ui/src/version.ts @@ -1 +1 @@ -export const version: string = 'v0.6.44'; +export const version: string = 'v0.6.45'; -- cgit v1.2.3 From 221e35ec38fb9323bf0b0ca1d19dac7884fb79fa Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 5 Apr 2020 10:11:16 -0400 Subject: Try to fix post creation bug. --- ui/src/components/post.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/components/post.tsx b/ui/src/components/post.tsx index f51ba6ff..de0f0e32 100644 --- a/ui/src/components/post.tsx +++ b/ui/src/components/post.tsx @@ -460,7 +460,7 @@ export class Post extends Component { } else if (res.op == UserOperation.Search) { let data = res.data as SearchResponse; this.state.crossPosts = data.posts.filter( - p => p.id != this.state.post.id + p => p.id != Number(this.props.match.params.id) ); this.setState(this.state); } else if (res.op == UserOperation.TransferSite) { -- cgit v1.2.3 From ed264aba3c12243352f68c2de6a5f21f23778bd0 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 9 Apr 2020 16:11:11 -0400 Subject: Updating code url references to https://github.com/LemmyNet/lemmy --- CODE_OF_CONDUCT.md | 2 +- README.md | 20 ++++++++++---------- RELEASES.md | 4 ++-- docs/src/about.md | 2 +- docs/src/administration_install_ansible.md | 4 ++-- docs/src/contributing.md | 5 +++-- docs/src/contributing_docker_development.md | 2 +- docs/src/contributing_local_development.md | 2 +- ui/src/components/sponsors.tsx | 3 ++- ui/src/utils.ts | 2 +- 10 files changed, 24 insertions(+), 22 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 5a6c7d67..e0270d4c 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -30,6 +30,6 @@ In the Lemmy community we strive to go the extra step to look out for each other And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could’ve communicated better — remember that it’s your responsibility to make others comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust. -The enforcement policies listed above apply to all official Lemmy venues; including git repositories under [github.com/dessalines/lemmy](https://github.com/dessalines/lemmy) and [yerbamate.dev/dessalines/lemmy](https://yerbamate.dev/dessalines/lemmy), the [Matrix channel](https://matrix.to/#/!BZVTUuEiNmRcbFeLeI:matrix.org?via=matrix.org&via=privacytools.io&via=permaweb.io); and all instances under lemmy.ml. For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. +The enforcement policies listed above apply to all official Lemmy venues; including git repositories under [github.com/LemmyNet/lemmy](https://github.com/LemmyNet/lemmy) and [yerbamate.dev/dessalines/lemmy](https://yerbamate.dev/dessalines/lemmy), the [Matrix channel](https://matrix.to/#/!BZVTUuEiNmRcbFeLeI:matrix.org?via=matrix.org&via=privacytools.io&via=permaweb.io); and all instances under lemmy.ml. For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion. Adapted from the [Rust Code of Conduct](https://www.rust-lang.org/policies/code-of-conduct), which is based on the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/). diff --git a/README.md b/README.md index 2adad59c..d576e5be 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@
    -![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/dessalines/lemmy.svg) -[![Build Status](https://travis-ci.org/dessalines/lemmy.svg?branch=master)](https://travis-ci.org/dessalines/lemmy) -[![GitHub issues](https://img.shields.io/github/issues-raw/dessalines/lemmy.svg)](https://github.com/dessalines/lemmy/issues) +![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/LemmyNet/lemmy.svg) +[![Build Status](https://travis-ci.org/LemmyNet/lemmy.svg?branch=master)](https://travis-ci.org/LemmyNet/lemmy) +[![GitHub issues](https://img.shields.io/github/issues-raw/LemmyNet/lemmy.svg)](https://github.com/LemmyNet/lemmy/issues) [![Docker Pulls](https://img.shields.io/docker/pulls/dessalines/lemmy.svg)](https://cloud.docker.com/repository/docker/dessalines/lemmy/) [![Translation status](http://weblate.yerbamate.dev/widgets/lemmy/-/lemmy/svg-badge.svg)](http://weblate.yerbamate.dev/engage/lemmy/) -[![License](https://img.shields.io/github/license/dessalines/lemmy.svg)](LICENSE) -![GitHub stars](https://img.shields.io/github/stars/dessalines/lemmy?style=social) +[![License](https://img.shields.io/github/license/LemmyNet/lemmy.svg)](LICENSE) +![GitHub stars](https://img.shields.io/github/stars/LemmyNet/lemmy?style=social)

    @@ -22,11 +22,11 @@ · Documentation · - Report Bug + Report Bug · - Request Feature + Request Feature · - Releases + Releases

    @@ -36,7 +36,7 @@ Front Page|Post ---|--- ![main screen](https://i.imgur.com/kZSRcRu.png)|![chat screen](https://i.imgur.com/4XghNh6.png) -[Lemmy](https://github.com/dessalines/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), [Raddle](https://raddle.me), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse). +[Lemmy](https://github.com/LemmyNet/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), [Raddle](https://raddle.me), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse). For a link aggregator, this means a user registered on one server can subscribe to forums on any other server, and can have discussions with users registered elsewhere. @@ -132,7 +132,7 @@ If you want to help with translating, take a look at [Weblate](https://weblate.y - [Mastodon](https://mastodon.social/@LemmyDev) - [![Mastodon Follow](https://img.shields.io/mastodon/follow/810572?domain=https%3A%2F%2Fmastodon.social&style=social)](https://mastodon.social/@LemmyDev) - [Matrix](https://riot.im/app/#/room/#rust-reddit-fediverse:matrix.org) - [![Matrix](https://img.shields.io/matrix/rust-reddit-fediverse:matrix.org.svg?label=matrix-chat)](https://riot.im/app/#/room/#rust-reddit-fediverse:matrix.org) -- [GitHub](https://github.com/dessalines/lemmy) +- [GitHub](https://github.com/LemmyNet/lemmy) - [Gitea](https://yerbamate.dev/dessalines/lemmy) - [GitLab](https://gitlab.com/dessalines/lemmy) diff --git a/RELEASES.md b/RELEASES.md index 4d86f6da..5a4c7645 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,6 +1,6 @@ # Lemmy v0.6.0 Release (2020-01-16) -`v0.6.0` is here, and we've closed [41 issues!](https://github.com/dessalines/lemmy/milestone/15?closed=1) +`v0.6.0` is here, and we've closed [41 issues!](https://github.com/LemmyNet/lemmy/milestone/15?closed=1) This is the biggest release by far: @@ -10,7 +10,7 @@ This is the biggest release by far: - Can set a custom language. - Lemmy-wide settings to disable downvotes, and close registration. - A better documentation system, hosted in lemmy itself. -- [Huge DB performance gains](https://github.com/dessalines/lemmy/issues/411) (everthing down to < `30ms`) by using materialized views. +- [Huge DB performance gains](https://github.com/LemmyNet/lemmy/issues/411) (everthing down to < `30ms`) by using materialized views. - Fixed major issue with similar post URL and title searching. - Upgraded to Actix `2.0` - Faster comment / post voting. diff --git a/docs/src/about.md b/docs/src/about.md index 33ecb211..31081f48 100644 --- a/docs/src/about.md +++ b/docs/src/about.md @@ -4,7 +4,7 @@ Front Page|Post ---|--- ![main screen](https://i.imgur.com/kZSRcRu.png)|![chat screen](https://i.imgur.com/4XghNh6.png) -[Lemmy](https://github.com/dessalines/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), [Raddle](https://raddle.me), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse). +[Lemmy](https://github.com/LemmyNet/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), [Raddle](https://raddle.me), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse). For a link aggregator, this means a user registered on one server can subscribe to forums on any other server, and can have discussions with users registered elsewhere. diff --git a/docs/src/administration_install_ansible.md b/docs/src/administration_install_ansible.md index bf5e6749..77d901b3 100644 --- a/docs/src/administration_install_ansible.md +++ b/docs/src/administration_install_ansible.md @@ -7,7 +7,7 @@ First, you need to [install Ansible on your local computer](https://docs.ansible Then run the following commands on your local computer: ```bash -git clone https://github.com/dessalines/lemmy.git +git clone https://github.com/LemmyNet/lemmy.git cd lemmy/ansible/ cp inventory.example inventory nano inventory # enter your server, domain, contact email @@ -19,4 +19,4 @@ To update to a new version, just run the following in your local Lemmy repo: git pull origin master cd ansible ansible-playbook lemmy.yml --become -``` \ No newline at end of file +``` diff --git a/docs/src/contributing.md b/docs/src/contributing.md index 9a01ad5d..4eabd6fc 100644 --- a/docs/src/contributing.md +++ b/docs/src/contributing.md @@ -4,13 +4,14 @@ Information about contributing to Lemmy, whether it is translating, testing, des ## Issue tracking / Repositories -- [GitHub (for issues)](https://github.com/dessalines/lemmy) +- [GitHub (for issues)](https://github.com/LemmyNet/lemmy) - [Gitea](https://yerbamate.dev/dessalines/lemmy) - [GitLab](https://gitlab.com/dessalines/lemmy) ## Translating -Go [here](https://github.com/dessalines/lemmy#translations) for translation instructions. +Check out [Lemmy's Weblate](https://weblate.yerbamate.dev/projects/lemmy/) for translations. + ## Architecture diff --git a/docs/src/contributing_docker_development.md b/docs/src/contributing_docker_development.md index d5ab5829..09239821 100644 --- a/docs/src/contributing_docker_development.md +++ b/docs/src/contributing_docker_development.md @@ -3,7 +3,7 @@ ## Running ```bash -git clone https://github.com/dessalines/lemmy +git clone https://github.com/LemmyNet/lemmy cd lemmy/docker/dev ./docker_update.sh # This builds and runs it, updating for your changes ``` diff --git a/docs/src/contributing_local_development.md b/docs/src/contributing_local_development.md index 175b000c..e823c9d1 100644 --- a/docs/src/contributing_local_development.md +++ b/docs/src/contributing_local_development.md @@ -22,7 +22,7 @@ export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy #### Running ```bash -git clone https://github.com/dessalines/lemmy +git clone https://github.com/LemmyNet/lemmy cd lemmy ./install.sh # For live coding, where both the front and back end, automagically reload on any save, do: diff --git a/ui/src/components/sponsors.tsx b/ui/src/components/sponsors.tsx index 347cb718..643153e6 100644 --- a/ui/src/components/sponsors.tsx +++ b/ui/src/components/sponsors.tsx @@ -2,6 +2,7 @@ import { Component } from 'inferno'; import { WebSocketService } from '../services'; import { i18n } from '../i18next'; import { T } from 'inferno-i18next'; +import { repoUrl } from '../utils'; let general = [ 'Nathan J. Goode', @@ -44,7 +45,7 @@ export class Sponsors extends Component {
    {i18n.t('donate_to_lemmy')}

    - ## + ##

    diff --git a/ui/src/utils.ts b/ui/src/utils.ts index d659509c..ceb05764 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -44,7 +44,7 @@ import emojiShortName from 'emoji-short-name'; import Toastify from 'toastify-js'; import tippy from 'tippy.js'; -export const repoUrl = 'https://github.com/dessalines/lemmy'; +export const repoUrl = 'https://github.com/LemmyNet/lemmy'; export const helpGuideUrl = '/docs/about_guide.html'; export const markdownHelpUrl = `${helpGuideUrl}#markdown-guide`; export const sortingHelpUrl = `${helpGuideUrl}#sorting`; -- cgit v1.2.3 From 7edfccee4939fd00b092589c7f53120a8b292ff1 Mon Sep 17 00:00:00 2001 From: Nika Tskhakaia Date: Fri, 10 Apr 2020 14:40:20 +0000 Subject: Translated using Weblate (Georgian) Currently translated at 67.5% (160 of 237 strings) Translation: Lemmy/lemmy Translate-URL: http://weblate.yerbamate.dev/projects/lemmy/lemmy/ka/ Translated using Weblate (Georgian) Currently translated at 62.8% (149 of 237 strings) Translation: Lemmy/lemmy Translate-URL: http://weblate.yerbamate.dev/projects/lemmy/lemmy/ka/ --- ui/translations/ka.json | 97 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/ui/translations/ka.json b/ui/translations/ka.json index 01dbe4ed..21db25ef 100644 --- a/ui/translations/ka.json +++ b/ui/translations/ka.json @@ -71,5 +71,100 @@ "unsticky": "unsticky", "remove_as_mod": "მოხსენი როგორც მოდერატორი", "remove_as_admin": "მოხსენი როგორც ადმინი", - "delete_account_confirm": "გაფთხილება: ეს შენს ყველაფერს წაშლის. პაროლი ჩაწერეთ რომ დაადასტუროთ." + "delete_account_confirm": "გაფთხილება: ეს შენს ყველაფერს წაშლის. პაროლი ჩაწერეთ რომ დაადასტუროთ.", + "creator": "შემქნელი", + "username": "მომხმარებლის სახელი", + "email_or_username": "ელ-პოსტა ან მომხმარებლის სახელი", + "number_of_users": "მომხმარებელი", + "number_of_users_plural": "მომხმარებლები", + "number_of_subscribers": "გამომწერი", + "number_of_subscribers_plural": "გამომწერები", + "number_of_points": "ქულა", + "number_of_points_plural": "ქულა", + "number_online": "მომხმარებელი საიტზე", + "number_online_plural": "მომხმარებელი საიტზე", + "name": "სახელი", + "title": "სათაური", + "category": "კატეგორია", + "subscribers": "გამომწერი", + "both": "ორივე", + "saved": "შანახული", + "unsubscribe": "გამოწერის გაუქმნება", + "subscribe": "გამოწერა", + "subscribed": "გამოწერილია", + "prev": "წუნა", + "next": "შემდეგი", + "sidebar": "Sidebar", + "sort_type": "სორტირების ტიპი", + "inbox": "Inbox", + "inbox_for": "<1>{{user}}-s Inbox", + "mark_all_as_read": "მონიშვნა ყველასი როგორც წაკითხული", + "type": "ტიპი", + "unread": "წაუკითხავია", + "mentions": "ხსენებები", + "reply_sent": "პასუხი გაგზავნილია", + "message_sent": "მესეჯი", + "search": "ძებმა", + "overview": "გადახედვა", + "view": "ნახვა", + "logout": "გასვლა", + "login_sign_up": "შესვლა ან რეგისტრაცია", + "login": "შესვლა", + "sign_up": "რეგისტრაცია", + "unread_messages": "წაუკითხავი მესეჯები", + "messages": "მესეჯები", + "password": "პაროლი", + "verify_password": "პაროლის დადასტურება", + "old_password": "ძველი პაროლი", + "forgot_password": "აღგდენა", + "reset_password_mail_sent": "ელ-პოსტა შეამოწმეთ", + "password_change": "პაროლის შეცვლა", + "new_password": "ახალი პაროლი", + "email": "ელ-პოსტა", + "matrix_user_id": "მატრიცული მომხმარებელი", + "private_message_disclaimer": ".", + "send_notifications_to_email": "შეტყობინების გაგზავნა ელ-პოსტაზე", + "optional": "არასავალდებულო", + "expires": "ვადა გასდის", + "language": "ენა", + "browser_default": "Browser Default", + "enable_downvotes": "არმოწონების ჩართვა", + "upvote": "მოწონება", + "downvote": "არ მოწონება", + "open_registration": "რეგისტრაციის გახსნა", + "registration_closed": "რეგისტრაცია დახურულია", + "enable_nsfw": "Enable NSFW", + "url": "მისამართი", + "body": "ტექსტი", + "copy_suggested_title": "დაკოპირება რეკომინდებულის სათაური: {{title}}", + "community": "თემა", + "expand_here": "Expand here", + "subscribe_to_communities": "Subscribe to some <1>communities.", + "chat": "ჩეტი", + "recent_comments": "ბოლო კომენტარები", + "no_results": "0 შედეგი", + "setup": "Setup", + "lemmy_instance_setup": "Lemmy Instance Setup", + "setup_admin": "Set Up Site Administrator", + "your_site": "შენი გვერდი", + "modified": "რედაკტირებული", + "nsfw": "NSFW", + "notifications_error": "გთხოვთ იხმაღეთ Chome ან Firefox შეტყობინებისთვის", + "no_email_setup": "This server hasn't correctly set up email.", + "downvotes_disabled": "არმოწონები გამორთულია", + "number_of_upvotes": "მოწონება", + "number_of_upvotes_plural": "მოწონება", + "number_of_downvotes": "არ მოწონება", + "number_of_downvotes_plural": "არ მოწონება", + "hot": "ცხელი", + "new": "ახალი", + "old": "ძველი", + "top_day": "ტოპ დღეს", + "week": "კვირა", + "month": "თვე", + "year": "წელი", + "all": "ყველა", + "top": "ტოპ", + "api": "API", + "show_nsfw": "Show NSFW content" } -- cgit v1.2.3 From 450a53d552de25d2948c0b2f403a5ca95e75e312 Mon Sep 17 00:00:00 2001 From: nick t Date: Fri, 10 Apr 2020 14:40:20 +0000 Subject: Translated using Weblate (Georgian) Currently translated at 84.3% (200 of 237 strings) Translation: Lemmy/lemmy Translate-URL: http://weblate.yerbamate.dev/projects/lemmy/lemmy/ka/ --- ui/translations/ka.json | 57 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/ui/translations/ka.json b/ui/translations/ka.json index 21db25ef..ebda8982 100644 --- a/ui/translations/ka.json +++ b/ui/translations/ka.json @@ -166,5 +166,60 @@ "all": "ყველა", "top": "ტოპ", "api": "API", - "show_nsfw": "Show NSFW content" + "show_nsfw": "Show NSFW content", + "related_posts": "ეს პოსტები შეიძლება ერთმანეც ეხება", + "cross_post": "გადაკვეთა-პოსტი", + "general_sponsors": "General Sponsors are those that pledged $10 to $39 to Lemmy.", + "cross_posted_to": "გადაკვეთა-პოსტი გაკეთდა: ", + "subscribed_to_communities": "მიყვები <1>communities", + "trending_communities": "ტრენდული <1>communities", + "list_of_communities": "ყველა თემა", + "number_of_communities": "თემა", + "number_of_communities_plural": "თემები", + "landing": "Lemmy is a <1>link aggregator / reddit alternative, intended to work in the <2>fediverse.<3>It's self-hostable, has live-updating comment threads, and is tiny (<4>~80kB). Federation into the ActivityPub network is on the roadmap. <5>This is a <6>very early beta version, and a lot of features are currently broken or missing. <7>Suggest new features or report bugs <8>here.<9>Made with <10>Rust, <11>Actix, <12>Inferno, <13>Typescript.", + "docs": "დოკუმენტაცია", + "couldnt_like_comment": "კომენტარის მოწონება ვერ მოხერხდა.", + "couldnt_update_comment": "კომენტარის განახლება ვერ მოხერხდა.", + "replies": "პასუხები", + "theme": "საიტის თემა", + "sponsors": "სპონსორები", + "sponsors_of_lemmy": "Sponsors", + "sponsor_message": "Lemmy is free, <1>open-source software, meaning no advertising, monetizing, or venture capital, ever. Your donations directly support full-time development of the project. Thank you to the following people:", + "support_on_patreon": "Support on Patreon", + "support_on_liberapay": "Support on Liberapay", + "donate_to_lemmy": "Donate to Lemmy", + "no_comment_edit_allowed": "კომენტარის რედაკტირება არ შეიძლება.", + "donate": "Donate", + "crypto": "Crypto", + "bitcoin": "Bitcoin", + "ethereum": "Ethereum", + "code": "კოდი", + "joined": "დაემატა", + "by": "by", + "to": "to", + "from": "from", + "transfer_community": "transfer community", + "transfer_site": "transfer site", + "are_you_sure": "დარწმუნებული ხარ?", + "yes": "კი", + "no": "არა", + "powered_by": "Powered by", + "not_logged_in": "შასული არ ხართ", + "logged_in": "შაული ხართ.", + "community_ban": "შენ ამ თემისგან გაშავებული ხარ.", + "site_ban": "საიტიდან გაშავებული ხარ.", + "couldnt_create_comment": "კომენტარის შექმნა ვერ მოხერხდა.", + "couldnt_find_community": "ტემა არ მოიძებნა.", + "couldnt_save_comment": "კომენტარის შენახვა ვერ მოხერხდა.", + "couldnt_get_comments": "კომენტარების ნახვა ვერ მოხერხდა.", + "no_post_edit_allowed": "პოსტის რედაკტირება არ შეიძლება.", + "no_community_edit_allowed": "თემის რედაკტირება არ შეიძლება.", + "couldnt_update_community": "თემა ვერ განახლდა.", + "community_already_exists": "ეს თემა უკვე არსებობს.", + "community_follower_already_exists": "თემის ფოლოვორი უკვე არსებობს.", + "community_user_already_banned": "თემის მომხმარებელი უკვე შავ სიაშია.", + "couldnt_like_post": "პოსტის მოწონება ვერ მოხერხდა.", + "community_moderator_already_exists": "ამ თემის მოდერატორი უკვე არსებობს.", + "couldnt_create_post": "პოსტი ვერ შეიქმნა.", + "post_title_too_long": "პოსტის სათაური ძალიან გრძელია." } -- cgit v1.2.3 From bb287cbd076940bd09f6afb61b642370d020f91e Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 10 Apr 2020 16:55:57 -0400 Subject: Adding an admin settings page. - Fixes #620 - Adding a UserListing component. Fixes #627 --- docker/dev/docker-compose.yml | 2 +- docker/prod/docker-compose.yml | 2 +- docs/src/contributing_websocket_http_api.md | 99 +++++++++--- server/src/api/site.rs | 70 ++++++++ server/src/routes/api.rs | 2 + server/src/routes/index.rs | 1 + server/src/settings.rs | 12 ++ server/src/websocket/mod.rs | 2 + server/src/websocket/server.rs | 10 ++ ui/src/components/admin-settings.tsx | 241 ++++++++++++++++++++++++++++ ui/src/components/comment-node.tsx | 27 ++-- ui/src/components/main.tsx | 24 +-- ui/src/components/navbar.tsx | 26 +++ ui/src/components/post-listing.tsx | 23 +-- ui/src/components/private-message-form.tsx | 25 +-- ui/src/components/private-message.tsx | 1 + ui/src/components/search.tsx | 23 +-- ui/src/components/sidebar.tsx | 21 +-- ui/src/components/site-form.tsx | 7 + ui/src/components/symbols.tsx | 3 + ui/src/components/user-listing.tsx | 36 +++++ ui/src/index.tsx | 116 ++++++------- ui/src/interfaces.ts | 22 ++- ui/src/services/WebSocketService.ts | 13 ++ ui/translations/en.json | 4 + 25 files changed, 633 insertions(+), 179 deletions(-) create mode 100644 ui/src/components/admin-settings.tsx create mode 100644 ui/src/components/user-listing.tsx diff --git a/docker/dev/docker-compose.yml b/docker/dev/docker-compose.yml index a7d289b2..3c52d1e5 100644 --- a/docker/dev/docker-compose.yml +++ b/docker/dev/docker-compose.yml @@ -21,7 +21,7 @@ services: environment: - RUST_LOG=debug volumes: - - ../lemmy.hjson:/config/config.hjson:ro + - ../lemmy.hjson:/config/config.hjson depends_on: - postgres - pictshare diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index 325effa6..a1b36162 100644 --- a/docker/prod/docker-compose.yml +++ b/docker/prod/docker-compose.yml @@ -19,7 +19,7 @@ services: environment: - RUST_LOG=error volumes: - - ./lemmy.hjson:/config/config.hjson:ro + - ./lemmy.hjson:/config/config.hjson depends_on: - postgres - pictshare diff --git a/docs/src/contributing_websocket_http_api.md b/docs/src/contributing_websocket_http_api.md index a73a1c13..f228f94e 100644 --- a/docs/src/contributing_websocket_http_api.md +++ b/docs/src/contributing_websocket_http_api.md @@ -92,85 +92,93 @@ - [Request](#request-17) - [Response](#response-17) - [HTTP](#http-18) - * [Community](#community) - + [Get Community](#get-community) + + [Get Site Config](#get-site-config) - [Request](#request-18) - [Response](#response-18) - [HTTP](#http-19) - + [Create Community](#create-community) + + [Save Site Config](#save-site-config) - [Request](#request-19) - [Response](#response-19) - [HTTP](#http-20) - + [List Communities](#list-communities) + * [Community](#community) + + [Get Community](#get-community) - [Request](#request-20) - [Response](#response-20) - [HTTP](#http-21) - + [Ban from Community](#ban-from-community) + + [Create Community](#create-community) - [Request](#request-21) - [Response](#response-21) - [HTTP](#http-22) - + [Add Mod to Community](#add-mod-to-community) + + [List Communities](#list-communities) - [Request](#request-22) - [Response](#response-22) - [HTTP](#http-23) - + [Edit Community](#edit-community) + + [Ban from Community](#ban-from-community) - [Request](#request-23) - [Response](#response-23) - [HTTP](#http-24) - + [Follow Community](#follow-community) + + [Add Mod to Community](#add-mod-to-community) - [Request](#request-24) - [Response](#response-24) - [HTTP](#http-25) - + [Get Followed Communities](#get-followed-communities) + + [Edit Community](#edit-community) - [Request](#request-25) - [Response](#response-25) - [HTTP](#http-26) - + [Transfer Community](#transfer-community) + + [Follow Community](#follow-community) - [Request](#request-26) - [Response](#response-26) - [HTTP](#http-27) - * [Post](#post) - + [Create Post](#create-post) + + [Get Followed Communities](#get-followed-communities) - [Request](#request-27) - [Response](#response-27) - [HTTP](#http-28) - + [Get Post](#get-post) + + [Transfer Community](#transfer-community) - [Request](#request-28) - [Response](#response-28) - [HTTP](#http-29) - + [Get Posts](#get-posts) + * [Post](#post) + + [Create Post](#create-post) - [Request](#request-29) - [Response](#response-29) - [HTTP](#http-30) - + [Create Post Like](#create-post-like) + + [Get Post](#get-post) - [Request](#request-30) - [Response](#response-30) - [HTTP](#http-31) - + [Edit Post](#edit-post) + + [Get Posts](#get-posts) - [Request](#request-31) - [Response](#response-31) - [HTTP](#http-32) - + [Save Post](#save-post) + + [Create Post Like](#create-post-like) - [Request](#request-32) - [Response](#response-32) - [HTTP](#http-33) - * [Comment](#comment) - + [Create Comment](#create-comment) + + [Edit Post](#edit-post) - [Request](#request-33) - [Response](#response-33) - [HTTP](#http-34) - + [Edit Comment](#edit-comment) + + [Save Post](#save-post) - [Request](#request-34) - [Response](#response-34) - [HTTP](#http-35) - + [Save Comment](#save-comment) + * [Comment](#comment) + + [Create Comment](#create-comment) - [Request](#request-35) - [Response](#response-35) - [HTTP](#http-36) - + [Create Comment Like](#create-comment-like) + + [Edit Comment](#edit-comment) - [Request](#request-36) - [Response](#response-36) - [HTTP](#http-37) + + [Save Comment](#save-comment) + - [Request](#request-37) + - [Response](#response-37) + - [HTTP](#http-38) + + [Create Comment Like](#create-comment-like) + - [Request](#request-38) + - [Response](#response-38) + - [HTTP](#http-39) * [RSS / Atom feeds](#rss--atom-feeds) + [All](#all) + [Community](#community-1) @@ -779,6 +787,53 @@ Search types are `All, Comments, Posts, Communities, Users, Url` `POST /site/transfer` +#### Get Site Config +##### Request +```rust +{ + op: "GetSiteConfig", + data: { + auth: String + } +} +``` +##### Response +```rust +{ + op: "GetSiteConfig", + data: { + config_hjson: String, + } +} +``` +##### HTTP + +`GET /site/config` + +#### Save Site Config +##### Request +```rust +{ + op: "SaveSiteConfig", + data: { + config_hjson: String, + auth: String + } +} +``` +##### Response +```rust +{ + op: "SaveSiteConfig", + data: { + config_hjson: String, + } +} +``` +##### HTTP + +`PUT /site/config` + ### Community #### Get Community ##### Request diff --git a/server/src/api/site.rs b/server/src/api/site.rs index 6bd90149..3720a2c4 100644 --- a/server/src/api/site.rs +++ b/server/src/api/site.rs @@ -97,6 +97,22 @@ pub struct TransferSite { auth: String, } +#[derive(Serialize, Deserialize)] +pub struct GetSiteConfig { + auth: String, +} + +#[derive(Serialize, Deserialize)] +pub struct GetSiteConfigResponse { + config_hjson: String, +} + +#[derive(Serialize, Deserialize)] +pub struct SaveSiteConfig { + config_hjson: String, + auth: String, +} + impl Perform for Oper { fn perform(&self, conn: &PgConnection) -> Result { let _data: &ListCategories = &self.data; @@ -510,3 +526,57 @@ impl Perform for Oper { }) } } + +impl Perform for Oper { + fn perform(&self, conn: &PgConnection) -> Result { + let data: &GetSiteConfig = &self.data; + + let claims = match Claims::decode(&data.auth) { + Ok(claims) => claims.claims, + Err(_e) => return Err(APIError::err("not_logged_in").into()), + }; + + let user_id = claims.id; + + // Only let admins read this + let admins = UserView::admins(&conn)?; + let admin_ids: Vec = admins.into_iter().map(|m| m.id).collect(); + + if !admin_ids.contains(&user_id) { + return Err(APIError::err("not_an_admin").into()); + } + + let config_hjson = Settings::read_config_file()?; + + Ok(GetSiteConfigResponse { config_hjson }) + } +} + +impl Perform for Oper { + fn perform(&self, conn: &PgConnection) -> Result { + let data: &SaveSiteConfig = &self.data; + + let claims = match Claims::decode(&data.auth) { + Ok(claims) => claims.claims, + Err(_e) => return Err(APIError::err("not_logged_in").into()), + }; + + let user_id = claims.id; + + // Only let admins read this + let admins = UserView::admins(&conn)?; + let admin_ids: Vec = admins.into_iter().map(|m| m.id).collect(); + + if !admin_ids.contains(&user_id) { + return Err(APIError::err("not_an_admin").into()); + } + + // Make sure docker doesn't have :ro at the end of the volume, so its not a read-only filesystem + let config_hjson = match Settings::save_config_file(&data.config_hjson) { + Ok(config_hjson) => config_hjson, + Err(_e) => return Err(APIError::err("couldnt_update_site").into()), + }; + + Ok(GetSiteConfigResponse { config_hjson }) + } +} diff --git a/server/src/routes/api.rs b/server/src/routes/api.rs index 29a360e4..36a55f96 100644 --- a/server/src/routes/api.rs +++ b/server/src/routes/api.rs @@ -52,6 +52,8 @@ pub fn config(cfg: &mut web::ServiceConfig) { .route("/api/v1/site", web::post().to(route_post::)) .route("/api/v1/site", web::put().to(route_post::)) .route("/api/v1/site/transfer", web::post().to(route_post::)) + .route("/api/v1/site/config", web::get().to(route_get::)) + .route("/api/v1/site/config", web::put().to(route_post::)) .route("/api/v1/admin/add", web::post().to(route_post::)) .route("/api/v1/user/ban", web::post().to(route_post::)) // User account actions diff --git a/server/src/routes/index.rs b/server/src/routes/index.rs index c1c363c9..45ce204e 100644 --- a/server/src/routes/index.rs +++ b/server/src/routes/index.rs @@ -33,6 +33,7 @@ pub fn config(cfg: &mut web::ServiceConfig) { .route("/modlog/community/{community_id}", web::get().to(index)) .route("/modlog", web::get().to(index)) .route("/setup", web::get().to(index)) + .route("/admin", web::get().to(index)) .route( "/search/q/{q}/type/{type}/sort/{sort}/page/{page}", web::get().to(index), diff --git a/server/src/settings.rs b/server/src/settings.rs index 875323e9..216c057e 100644 --- a/server/src/settings.rs +++ b/server/src/settings.rs @@ -1,6 +1,8 @@ use config::{Config, ConfigError, Environment, File}; +use failure::Error; use serde::Deserialize; use std::env; +use std::fs; use std::net::IpAddr; static CONFIG_FILE_DEFAULTS: &str = "co