diff options
-rw-r--r-- | ansible/VERSION | 2 | ||||
-rw-r--r-- | docker/prod/docker-compose.yml | 2 | ||||
-rw-r--r-- | docs/src/contributing_local_development.md | 70 | ||||
-rw-r--r-- | server/src/version.rs | 2 | ||||
-rw-r--r-- | ui/src/components/login.tsx | 1 | ||||
-rw-r--r-- | ui/src/components/user.tsx | 2 | ||||
-rw-r--r-- | ui/src/index.html | 3 | ||||
-rw-r--r-- | ui/src/services/UserService.ts | 4 | ||||
-rw-r--r-- | ui/src/utils.ts | 22 | ||||
-rw-r--r-- | ui/src/version.ts | 2 | ||||
-rw-r--r-- | ui/translations/fr.json | 12 | ||||
-rw-r--r-- | ui/translations/hu.json | 19 |
12 files changed, 99 insertions, 42 deletions
diff --git a/ansible/VERSION b/ansible/VERSION index e31dcbc4..2c4784f1 100644 --- a/ansible/VERSION +++ b/ansible/VERSION @@ -1 +1 @@ -v0.6.71 +v0.6.73 diff --git a/docker/prod/docker-compose.yml b/docker/prod/docker-compose.yml index db6e4004..bbf2a698 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.71 + image: dessalines/lemmy:v0.6.73 ports: - "127.0.0.1:8536:8536" restart: always diff --git a/docs/src/contributing_local_development.md b/docs/src/contributing_local_development.md index e823c9d1..f801caf3 100644 --- a/docs/src/contributing_local_development.md +++ b/docs/src/contributing_local_development.md @@ -1,31 +1,61 @@ -#### Requirements +### Ubuntu -- [Rust](https://www.rust-lang.org/) -- [Yarn](https://yarnpkg.com/en/) -- [Postgres](https://www.postgresql.org/) -#### Set up Postgres DB +#### Build requirements: +``` +sudo apt install git cargo libssl-dev pkg-config libpq-dev yarn curl gnupg2 git +# install yarn +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list +sudo apt update && sudo apt install yarn +``` -```bash +#### Get the source code +``` +git clone https://github.com/LemmyNet/lemmy.git +# or alternatively from gitea +# git clone https://yerbamate.dev/LemmyNet/lemmy.git +``` + +All the following commands need to be run either in `lemmy/server` or `lemmy/ui`, as indicated +by the `cd` command. + +#### Build the backend (Rust) +``` cd server -./db-init.sh +cargo build +# for development, use `cargo check` instead) ``` -Or run the commands manually: +#### Build the frontend (Typescript) +``` +cd ui +yarn +yarn build +``` -```bash -psql -c "create user lemmy with password 'password' superuser;" -U postgres -psql -c 'create database lemmy with owner lemmy;' -U postgres +#### Setup postgresql +``` +sudo apt install postgresql +sudo systemctl start postgresql +# initialize postgres database +sudo -u postgres psql -c "create user lemmy with password 'password' superuser;" -U postgres +sudo -u postgres psql -c 'create database lemmy with owner lemmy;' -U postgres export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432/lemmy +# or execute server/db-init.sh ``` -#### Running - -```bash -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: -# cd ui && yarn start -# cd server && cargo watch -x run +#### Run a local development instance ``` +# run each of these in a seperate terminal +cd server && cargo run +ui & yarn start +``` + +Then open [localhost:4444](http://localhost:4444) in your browser. It will auto-refresh if you edit +any frontend files. For backend coding, you will have to rerun `cargo run`. You can use +`cargo check` as a faster way to find compilation errors. + +Note that this setup doesn't include image uploads or link previews (provided by pict-rs and +iframely respectively). If you want to test those, you should use the +[Docker development](contributing_docker_development.md). diff --git a/server/src/version.rs b/server/src/version.rs index 354b86b4..e3c8ca57 100644 --- a/server/src/version.rs +++ b/server/src/version.rs @@ -1 +1 @@ -pub const VERSION: &str = "v0.6.71"; +pub const VERSION: &str = "v0.6.73"; diff --git a/ui/src/components/login.tsx b/ui/src/components/login.tsx index 84014f68..ce04d0d4 100644 --- a/ui/src/components/login.tsx +++ b/ui/src/components/login.tsx @@ -111,6 +111,7 @@ export class Login extends Component<any, State> { required /> <button + type="button" disabled={!validEmail(this.state.loginForm.username_or_email)} onClick={linkEvent(this, this.handlePasswordReset)} className="btn p-0 btn-link d-inline-block float-right text-muted small font-weight-bold" diff --git a/ui/src/components/user.tsx b/ui/src/components/user.tsx index eded9998..7cd460a1 100644 --- a/ui/src/components/user.tsx +++ b/ui/src/components/user.tsx @@ -922,7 +922,7 @@ export class User extends Component<any, UserState> { handleUserSettingsThemeChange(i: User, event: any) { i.state.userSettingsForm.theme = event.target.value; - setTheme(event.target.value); + setTheme(event.target.value, true); i.setState(i.state); } diff --git a/ui/src/index.html b/ui/src/index.html index f39773d0..7cea8c4e 100644 --- a/ui/src/index.html +++ b/ui/src/index.html @@ -15,7 +15,8 @@ <link rel="stylesheet" type="text/css" href="/static/assets/css/toastify.css" /> <link rel="stylesheet" type="text/css" href="/static/assets/css/selectr.min.css" /> <link rel="stylesheet" type="text/css" href="/static/assets/css/tippy.css" /> - <link rel="stylesheet" type="text/css" href="/static/assets/css/themes/darkly.min.css" id="darkly" /> + <link rel="stylesheet" type="text/css" href="/static/assets/css/themes/united.min.css" id="default-light" media="(prefers-color-scheme: light)" /> + <link rel="stylesheet" type="text/css" href="/static/assets/css/themes/darkly.min.css" id="default-dark" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: dark)" /> <link rel="stylesheet" type="text/css" href="/static/assets/css/main.css" /> <!-- Scripts --> diff --git a/ui/src/services/UserService.ts b/ui/src/services/UserService.ts index 47e28c73..786d5d07 100644 --- a/ui/src/services/UserService.ts +++ b/ui/src/services/UserService.ts @@ -41,9 +41,7 @@ export class UserService { private setUser(jwt: string) { this.user = jwt_decode(jwt); - if (this.user.theme != 'darkly') { - setTheme(this.user.theme); - } + setTheme(this.user.theme, true); this.sub.next({ user: this.user }); console.log(this.user); } diff --git a/ui/src/utils.ts b/ui/src/utils.ts index 3bad5040..93b9cab0 100644 --- a/ui/src/utils.ts +++ b/ui/src/utils.ts @@ -404,7 +404,7 @@ export function getMomentLanguage(): string { return lang; } -export function setTheme(theme: string = 'darkly') { +export function setTheme(theme: string = 'darkly', loggedIn: boolean = false) { // unload all the other themes for (var i = 0; i < themes.length; i++) { let styleSheet = document.getElementById(themes[i]); @@ -413,10 +413,19 @@ export function setTheme(theme: string = 'darkly') { } } - // Load the theme dynamically - let cssLoc = `/static/assets/css/themes/${theme}.min.css`; - loadCss(theme, cssLoc); - document.getElementById(theme).removeAttribute('disabled'); + // if the user is not logged in, we load the default themes and let the browser decide + if(!loggedIn) { + document.getElementById("default-light").removeAttribute('disabled') + document.getElementById("default-dark").removeAttribute('disabled') + } else { + document.getElementById("default-light").setAttribute('disabled', 'disabled'); + document.getElementById("default-dark").setAttribute('disabled', 'disabled'); + + // Load the theme dynamically + let cssLoc = `/static/assets/css/themes/${theme}.min.css`; + loadCss(theme, cssLoc); + document.getElementById(theme).removeAttribute('disabled'); + } } export function loadCss(id: string, loc: string) { @@ -501,7 +510,7 @@ export function messageToastify( text: `${body}<br />${creator}`, avatar: avatar, backgroundColor: backgroundColor, - className: 'text-body', + className: 'text-dark', close: true, gravity: 'top', position: 'right', @@ -887,7 +896,6 @@ function canUseWebP() { return false; // var elem = document.createElement('canvas'); - // if (!!(elem.getContext && elem.getContext('2d'))) { // var testString = !(window.mozInnerScreenX == null) ? 'png' : 'webp'; // // was able or not to get WebP representation diff --git a/ui/src/version.ts b/ui/src/version.ts index 9abc8bce..5b91764c 100644 --- a/ui/src/version.ts +++ b/ui/src/version.ts @@ -1 +1 @@ -export const version: string = 'v0.6.71'; +export const version: string = 'v0.6.73'; diff --git a/ui/translations/fr.json b/ui/translations/fr.json index 82714249..f7457b2e 100644 --- a/ui/translations/fr.json +++ b/ui/translations/fr.json @@ -28,7 +28,7 @@ "community_reqs": "en minuscule, sans espace et avec tiret du bas.", "create_private_message": "Créer un message privé", "send_secure_message": "Envoyer le message sécurisé", - "send_message": "Enovyer le message", + "send_message": "Envoyer le message", "message": "Message", "edit": "éditer", "reply": "répondre", @@ -58,14 +58,14 @@ "remove_as_admin": "Supprimer comme admin", "appoint_as_admin": "Nommer comme admin", "remove": "retirer", - "removed": "retiré", + "removed": "retiré par le modérateur", "locked": "bloqué", "stickied": "épinglé", "reason": "Raison", "mark_as_read": "marquer comme lu", "mark_as_unread": "marquer comme non-lu", "delete": "supprimer", - "deleted": "supprimé", + "deleted": "supprimé par le créateur", "delete_account": "Supprimer le compte", "delete_account_confirm": "Avertissement : cette action supprimera toutes vos données de façons permanente ! Saisissez votre mot de passe pour confirmer.", "restore": "restaurer", @@ -171,7 +171,7 @@ "theme": "Thème", "sponsors": "Sponsors", "sponsors_of_lemmy": "Sponsors de Lemmy", - "sponsor_message": "Lemmy est un logiciel libre et <1>open-source</1>, c’est à dire, il fonctionne sans publicité et sans monétisation aucune. Vos dons soutiennent directement le développement du projet à temps plein. Merci à toutes ces personnes :", + "sponsor_message": "Lemmy est un logiciel libre et <1>open-source</1>, sans jamais aucune publicité, ni monétisation ou capital-risque. Vos dons soutiennent directement le développement du projet à temps plein. Merci à toutes ces personnes :", "support_on_patreon": "Soutenir sur Patreon", "support_on_liberapay": "Soutenir sur Liberapay", "donate_to_lemmy": "Faire un don à Lemmy", @@ -251,5 +251,7 @@ "number_of_downvotes_plural": "{{count}} votes contre", "downvote": "Voter contre", "emoji_picker": "Sélecteur d’émojis", - "silver_sponsors": "Les sponsors argent sont ceux et celles qui ont fait une donation de 40$ à Lemmy." + "silver_sponsors": "Les sponsors argent sont ceux et celles qui ont fait une donation de 40$ à Lemmy.", + "select_a_community": "Sélectionner une communauté", + "invalid_username": "Nom d'utilisateur invalide." } diff --git a/ui/translations/hu.json b/ui/translations/hu.json index 0967ef42..35f82675 100644 --- a/ui/translations/hu.json +++ b/ui/translations/hu.json @@ -1 +1,18 @@ -{} +{ + "post": "Elküld", + "remove_post": "Bejegyzés eltávolítása", + "no_posts": "Nincs bejegyzés.", + "create_post": "Új bejegyzés létrehozása", + "create_a_post": "Új bejegyzés létrehozása", + "number_of_posts": "{{count}} bejegyzés", + "number_of_posts_plural": "{{count}} bejegyzés", + "posts": "Bejegyzések", + "related_posts": "Ezek a bejegyzések kapcsolódhatnak", + "cross_posts": "Ez a hivatkozás itt is be lett küldve:", + "cross_post": "keresztbejegyzés", + "comments": "Hozzászólások", + "remove_comment": "Hozzászólások eltávolítása", + "cross_posted_to": "beküldve ide is: ", + "number_of_comments": "{{count}} hozzászólás", + "number_of_comments_plural": "{{count}} hozzászólás" +} |