From f97a1fcedfac149b56e50c05e39745d11f95d7db Mon Sep 17 00:00:00 2001 From: M Sarmad Qadeer Date: Mon, 1 May 2023 02:31:23 +0500 Subject: [PATCH] website: add docs to website (#2080) * website: add fontmatter & improve image URLs where necessary * website: add docs to website * website: add prismjs for code highlighting * website: change npm install position in web.sh * website: fix an image URL in lang/cs/README.md * website: improve image paths in lang/cs/translations.md * website: add responsiveness & improve stylings of docs * website: add dir to navbar in blog & docs * website: remove scroll in mobile dropdown menu * website: remove rfcs & add guide docs to website * website: remove file renaming script from web.sh * website: add menu to docs in nav * website: add hash list & add scroll to headers * website: customize docs frontmatter through JS * website: remove supported_languages.json * website: move merge_translations.js to JS folder * website: add the following changes to docs - add frontmatter to new doc merged from master - add ignoreForWeb property to frontmatter of README.md docs * website: remove package-lock.json from .gitignore * website: add package-lock.json from .gitignore * website: add no docs message to docs dropdown * website: improve the sidebar of docs * website: add revision date to docs * website: add script to add version to docs frontmatter * website: add layout to display message in docs if its version is old * website: improve nav responsiveness * website: remove frontmatter form main README & rfcs * website: remove rfcs from website folder * website: add ignore condition for rfcs in .eleventy * website: remove frontmatter from lang README docs * website: remove README from website's lang docs * website: add guides menu in nav * website: following changes - add docs_dropdown.json - extend reference menu in nav - remove docs menu from nav * website: fix in docs sidebar * website: revert main docs README.md files * website: revert main docs README.md files * website: move scripts out of js that are for build * website: remove displayAt form guide docs * website: create a docs_sidebar.json & shift to that approach * update navigation * website: set navbar * website: add icons to external links * website: change the approach for docs sidebar creation * website: update docs template * website: add some strings to en.json and map them accordingly * remove icon --------- Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- .gitignore | 2 +- docs/ANDROID.md | 5 + docs/CLI.md | 5 + docs/CONTRIBUTING.md | 5 + docs/SERVER.md | 5 + docs/SIMPLEX.md | 5 + docs/SQL.md | 5 + docs/TRANSLATIONS.md | 5 + docs/WEBRTC.md | 5 + docs/XFTP-SERVER.md | 4 + docs/guide/README.md | 3 + docs/guide/app-settings.md | 3 + docs/guide/audio-video-calls.md | 3 + docs/guide/chat-profiles.md | 3 + docs/guide/making-connections.md | 3 + docs/guide/managing-data.md | 3 + docs/guide/privacy-security.md | 3 + docs/guide/secret-groups.md | 3 + docs/guide/send-messages.md | 3 + docs/lang/cs/ANDROID.md | 4 + docs/lang/cs/CLI.md | 12 +- docs/lang/cs/CONTRIBUTING.md | 4 + docs/lang/cs/SERVER.md | 6 +- docs/lang/cs/SIMPLEX.md | 4 + docs/lang/cs/SQL.md | 4 + docs/lang/cs/TRANSLATIONS.md | 8 +- docs/lang/cs/WEBRTC.md | 10 +- docs/lang/fr/ANDROID.md | 4 + docs/lang/fr/CLI.md | 4 + docs/lang/fr/CONTRIBUTING.md | 4 + docs/lang/fr/SERVER.md | 4 + docs/lang/fr/SIMPLEX.md | 4 + docs/lang/fr/SQL.md | 4 + docs/lang/fr/TRANSLATIONS.md | 4 + docs/lang/fr/WEBRTC.md | 4 + docs/protocol/simplex-chat.md | 4 + website/.eleventy.js | 121 +++++- website/customize_docs_frontmatter.js | 90 +++++ website/langs/en.json | 24 +- website/merge_translations.js | 8 +- website/package.json | 3 +- website/src/_data/docs_dropdown.json | 32 ++ website/src/_data/docs_sidebar.json | 38 ++ website/src/_data/guide_dropdown.json | 40 ++ website/src/_includes/footer.html | 41 +- website/src/_includes/layouts/article.html | 2 + website/src/_includes/layouts/doc.html | 123 ++++++ website/src/_includes/navbar.html | 151 +++++--- website/src/css/doc.css | 412 +++++++++++++++++++++ website/src/css/prism.min.css | 4 + website/src/css/style.css | 19 +- website/src/js/docs.js | 91 +++++ website/src/js/prism.min.js | 49 +++ website/web.sh | 6 +- 54 files changed, 1321 insertions(+), 94 deletions(-) create mode 100644 website/customize_docs_frontmatter.js create mode 100644 website/src/_data/docs_dropdown.json create mode 100644 website/src/_data/docs_sidebar.json create mode 100644 website/src/_data/guide_dropdown.json create mode 100644 website/src/_includes/layouts/doc.html create mode 100644 website/src/css/doc.css create mode 100644 website/src/css/prism.min.css create mode 100644 website/src/js/docs.js create mode 100644 website/src/js/prism.min.js diff --git a/.gitignore b/.gitignore index d4b4d6cb33..44fd61e359 100644 --- a/.gitignore +++ b/.gitignore @@ -49,8 +49,8 @@ logs/ # for website website/node_modules/ website/src/blog/ +website/src/docs/ website/translations.json -website/src/_data/supported_languages.json website/src/img/images/ website/src/images/ # Generated files diff --git a/docs/ANDROID.md b/docs/ANDROID.md index 2b86ea9c34..55e6ef976f 100644 --- a/docs/ANDROID.md +++ b/docs/ANDROID.md @@ -1,3 +1,8 @@ +--- +title: Accessing files in Android app +revision: 07.02.2023 +--- + | 07.02.2023 | EN, [CZ](/docs/lang/cs/ANDROID.md), [FR](/docs/lang/fr/ANDROID.md) | # Accessing files in Android app diff --git a/docs/CLI.md b/docs/CLI.md index 52a5f01471..65de29e601 100644 --- a/docs/CLI.md +++ b/docs/CLI.md @@ -1,3 +1,8 @@ +--- +title: Terminal CLI +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/CLI.md), [CZ](/docs/lang/cs/CLI.md) | # SimpleX Chat terminal (console) app for Linux/MacOS/Windows diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 2694396b62..ef58bfec04 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -1,3 +1,8 @@ +--- +title: Contributing guide +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/CONTRIBUTING.md), [CZ](/docs/lang/cs/CONTRIBUTING.md) | # Contributing guide diff --git a/docs/SERVER.md b/docs/SERVER.md index 5c53e9add8..07594ca10c 100644 --- a/docs/SERVER.md +++ b/docs/SERVER.md @@ -1,3 +1,8 @@ +--- +title: Hosting your own SMP Server +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/SERVER.md), [CZ](/docs/lang/cs/SERVER.md) | # Hosting your own SMP Server diff --git a/docs/SIMPLEX.md b/docs/SIMPLEX.md index c00adafd20..7ed01efa3c 100644 --- a/docs/SIMPLEX.md +++ b/docs/SIMPLEX.md @@ -1,3 +1,8 @@ +--- +title: SimpleX platform +revision: 07.02.2023 +--- + | Updated 07.02.2023 | Languages: EN, [FR](/docs/lang/fr/SIMPLEX.md), [CZ](/docs/lang/cs/SIMPLEX.md) | # SimpleX platform - motivation and comparison diff --git a/docs/SQL.md b/docs/SQL.md index d320e36042..d5b469050d 100644 --- a/docs/SQL.md +++ b/docs/SQL.md @@ -1,3 +1,8 @@ +--- +title: Accessing messages in the database +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/SQL.md), [CZ](/docs/lang/cs/SQL.md) | # Accessing messages in the database diff --git a/docs/TRANSLATIONS.md b/docs/TRANSLATIONS.md index e231610382..bb8764b148 100644 --- a/docs/TRANSLATIONS.md +++ b/docs/TRANSLATIONS.md @@ -1,3 +1,8 @@ +--- +title: Contributing translations to SimpleX Chat +revision: 19.03.2023 +--- + | 19.03.2023 | EN, [CZ](/docs/lang/cs/TRANSLATIONS.md), [FR](/docs/lang/fr/TRANSLATIONS.md) | # Contributing translations to SimpleX Chat diff --git a/docs/WEBRTC.md b/docs/WEBRTC.md index 850a288347..304f29d812 100644 --- a/docs/WEBRTC.md +++ b/docs/WEBRTC.md @@ -1,3 +1,8 @@ +--- +title: Using custom WebRTC ICE servers in SimpleX Chat +revision: 31.01.2023 +--- + | Updated 31.01.2023 | Languages: EN, [FR](/docs/lang/fr/WEBRTC.md), [CZ](/docs/lang/cs/WEBRTC.md) | # Using custom WebRTC ICE servers in SimpleX Chat diff --git a/docs/XFTP-SERVER.md b/docs/XFTP-SERVER.md index 1359616ed1..567ae63b01 100644 --- a/docs/XFTP-SERVER.md +++ b/docs/XFTP-SERVER.md @@ -1,3 +1,7 @@ +--- +title: Hosting your own XFTP Server +revision: 21.04.2023 +--- # Hosting your own XFTP Server ## Overview diff --git a/docs/guide/README.md b/docs/guide/README.md index 7836b0b406..04e7538968 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -1,3 +1,6 @@ +--- +title: Quick start +--- # SimpleX Chat User Guide The first messaging platform that has no user identifiers of any kind — 100% private by design. diff --git a/docs/guide/app-settings.md b/docs/guide/app-settings.md index 90adf335bf..26817a20f2 100644 --- a/docs/guide/app-settings.md +++ b/docs/guide/app-settings.md @@ -1,3 +1,6 @@ +--- +title: App settings +--- # App settings ## Opening the app settings diff --git a/docs/guide/audio-video-calls.md b/docs/guide/audio-video-calls.md index 23101d2d63..8fc2bf95b2 100644 --- a/docs/guide/audio-video-calls.md +++ b/docs/guide/audio-video-calls.md @@ -1,3 +1,6 @@ +--- +title: Audio & video Calls +--- # Audio and Video Calls SimpleX Chat allows you to make end-to-end encrypted audio and video calls with your contacts via WebRTC. Note: Group calls are not supported at this time. diff --git a/docs/guide/chat-profiles.md b/docs/guide/chat-profiles.md index 9cede5b8c6..d20790037a 100644 --- a/docs/guide/chat-profiles.md +++ b/docs/guide/chat-profiles.md @@ -1,3 +1,6 @@ +--- +title: Chat profiles +--- # Your chat profiles ## Creating additional chat profiles diff --git a/docs/guide/making-connections.md b/docs/guide/making-connections.md index 55465f1f60..0cf46aecde 100644 --- a/docs/guide/making-connections.md +++ b/docs/guide/making-connections.md @@ -1,3 +1,6 @@ +--- +title: Making connections +--- # Connect to somebody in the chat _Work in progress_ diff --git a/docs/guide/managing-data.md b/docs/guide/managing-data.md index 3324189cf7..c524825746 100644 --- a/docs/guide/managing-data.md +++ b/docs/guide/managing-data.md @@ -1,3 +1,6 @@ +--- +title: Managing data +--- # Managing Your Data ## Automatic message deletion diff --git a/docs/guide/privacy-security.md b/docs/guide/privacy-security.md index 43ece140ad..849a17f65d 100644 --- a/docs/guide/privacy-security.md +++ b/docs/guide/privacy-security.md @@ -1,3 +1,6 @@ +--- +title: Privacy & security +--- # Privacy and Security SimpleX Chat default configuration aims to balance privacy, security and convenience. You may want to change the default options. diff --git a/docs/guide/secret-groups.md b/docs/guide/secret-groups.md index 9ecdc7e4c5..5cdbcf86da 100644 --- a/docs/guide/secret-groups.md +++ b/docs/guide/secret-groups.md @@ -1,3 +1,6 @@ +--- +title: Secret groups +--- # Secret groups Secret groups are anonymous and private, they are designed to be hard to track by outsiders. Every message and file gets sent separately to every member in the group, which makes secret groups only fit for smaller groups. diff --git a/docs/guide/send-messages.md b/docs/guide/send-messages.md index 9762e86f43..8292bd5747 100644 --- a/docs/guide/send-messages.md +++ b/docs/guide/send-messages.md @@ -1,3 +1,6 @@ +--- +title: Sending messages +--- # Sending, editing and deleting messages Sending text messages on SimpleX Chat is pretty straightforward, tap on your contact and then tap on text area, type in your message and tap on "Send" button. diff --git a/docs/lang/cs/ANDROID.md b/docs/lang/cs/ANDROID.md index c0fb859cac..38dd105bb5 100644 --- a/docs/lang/cs/ANDROID.md +++ b/docs/lang/cs/ANDROID.md @@ -1,3 +1,7 @@ +--- +title: Přístup k souborům v aplikaci Android +revision: 07.02.2023 +--- | Aktualizováno 07.02.2023 | Jazyky: CZ, [EN](/docs/ANDROID.md) | # Přístup k souborům v aplikaci Android diff --git a/docs/lang/cs/CLI.md b/docs/lang/cs/CLI.md index f6b9dbe0ed..731e236661 100644 --- a/docs/lang/cs/CLI.md +++ b/docs/lang/cs/CLI.md @@ -1,3 +1,7 @@ +--- +title: SimpleX Chat terminálová +revision: 31.01.2023 +--- | Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/CLI.md), [FR](/docs/lang/fr/CLI.md) | # SimpleX Chat terminálová (konzolová) aplikace pro Linux/MacOS/Windows @@ -174,7 +178,7 @@ Po spuštění chatu budete vyzváni k zadání svého "zobrazovacího jména" a Následující schéma ukazuje, jak se připojit ke kontaktu a poslat mu zprávu:
- +
Po nastavení místního profilu zadejte `/c` (pro `/connect`) pro vytvoření nového spojení a vygenerování pozvánky. Tuto pozvánku odešlete svému kontaktu prostřednictvím jakéhokoli jiného kanálu. @@ -193,7 +197,7 @@ Seznam dostupných příkazů zobrazíte pomocí `/help` v chatu. Skupinu vytvoříte příkazem `/g ` a kontakty do ní přidáte příkazem `/a `. Do skupiny pak můžete posílat zprávy zadáním `# `. Pro další příkazy použijte `/help groups`. -![simplex-chat](../images/groups.gif) +![simplex-chat](/images/groups.gif) > **Upozornění**: skupiny nejsou uloženy na žádném serveru, jsou vedeny jako seznam členů v databázi aplikace, kterým budou zprávy zasílány. @@ -201,7 +205,7 @@ Skupinu vytvoříte příkazem `/g ` a kontakty do ní přidáte příkaz Soubor můžete odeslat kontaktu pomocí `/f @ ` - příjemce jej bude muset před odesláním přijmout. Pro další příkazy použijte `/help files`. -![simplex-chat](../images/files.gif) +![simplex-chat](/images/files.gif) Soubory můžete posílat skupině pomocí `/f # `. @@ -215,7 +219,7 @@ Uživatelská adresa je "dlouhodobá" v tom smyslu, že se jedná o odkaz pro v Pro ostatní příkazy použijte `/help address`. -![simplex-chat](../images/user-addresses.gif) +![simplex-chat](/images/user-addresses.gif) ### Přístup k historii chatu diff --git a/docs/lang/cs/CONTRIBUTING.md b/docs/lang/cs/CONTRIBUTING.md index 7fc14f5a9c..26c746e7d2 100644 --- a/docs/lang/cs/CONTRIBUTING.md +++ b/docs/lang/cs/CONTRIBUTING.md @@ -1,3 +1,7 @@ +--- +title: Průvodce přispíváním +revision: 31.01.2023 +--- | Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/CONTRIBUTING.md), [FR](/docs/lang/fr/CONTRIBUTING.md) | # Průvodce přispíváním diff --git a/docs/lang/cs/SERVER.md b/docs/lang/cs/SERVER.md index ba7dc3efd7..1620ec2e1a 100644 --- a/docs/lang/cs/SERVER.md +++ b/docs/lang/cs/SERVER.md @@ -1,3 +1,7 @@ +--- +title: Hostování vlastního serveru SMP +revision: 31.01.2023 +--- | Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/SERVER.md), [FR](/docs/lang/fr/SERVER.md) | # Hostování vlastního serveru SMP @@ -327,4 +331,4 @@ Adresu svého serveru můžete také sdílet se svými přáteli tak, že je nec _Upozornění_: pro podporu hesla je třeba mít SMP server verze 4.0. Pokud již máte nasazený server, můžete heslo přidat přidáním do souboru INI serveru. -       +       diff --git a/docs/lang/cs/SIMPLEX.md b/docs/lang/cs/SIMPLEX.md index 2727d2b9d9..33d45cec65 100644 --- a/docs/lang/cs/SIMPLEX.md +++ b/docs/lang/cs/SIMPLEX.md @@ -1,3 +1,7 @@ +--- +title: Platforma SimpleX +revision: 07.02.2023 +--- | Aktualizováno 07.02.2023 | Jazyky: CZ, [EN](/docs/SIMPLEX.md), [FR](/docs/lang/fr/SIMPLEX.md) | # Platforma SimpleX - motivace a srovnání diff --git a/docs/lang/cs/SQL.md b/docs/lang/cs/SQL.md index d9ea8f2365..71ef0007c1 100644 --- a/docs/lang/cs/SQL.md +++ b/docs/lang/cs/SQL.md @@ -1,3 +1,7 @@ +--- +title: Přístup ke zprávám v databázi +revision: 31.01.2023 +--- | Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/SQL.md), [FR](/docs/lang/fr/SQL.md) | # Přístup ke zprávám v databázi diff --git a/docs/lang/cs/TRANSLATIONS.md b/docs/lang/cs/TRANSLATIONS.md index 0cdd13a2b0..b260bd12a6 100644 --- a/docs/lang/cs/TRANSLATIONS.md +++ b/docs/lang/cs/TRANSLATIONS.md @@ -1,3 +1,7 @@ +--- +title: Přispívání překladů do SimpleX Chat +revision: 07.02.2023 +--- | Aktualizováno 07.02.2023 | Jazyky: CZ, [EN](/docs/TRANSLATIONS.md) | # Přispívání překladů do SimpleX Chat @@ -22,7 +26,7 @@ Tento dokument vznikl proto, abychom tento proces urychlili, a podělili se s v 2. Některé řetězce není třeba překládat, ale přesto je třeba je překopírovat - v uživatelském rozhraní Weblate je k tomu tlačítko: -weblate: zkopírovat zdroj do překladu +weblate: zkopírovat zdroj do překladu 3. Weblate má také automatické návrhy, které mohou proces urychlit. Někdy je lze použít tak, jak jsou, jindy je třeba je upravit - kliknutím je použijete v překladu. @@ -30,7 +34,7 @@ Tento dokument vznikl proto, abychom tento proces urychlili, a podělili se s v 5. Při překladu [aplikace pro iOS](https://hosted.weblate.org/projects/simplex-chat/ios/) je velká část řetězců naprosto stejná - lze je jedním kliknutím překopírovat do sekce glosář. Vizuální nápovědou, že to lze provést, je to, že celý zdrojový řetězec je zvýrazněn žlutě. Mnoho dalších řetězců je velmi podobných, liší se pouze syntaxí interpolace nebo způsobem použití tučného písma - vyžadují minimální úpravy. Existují některé řetězce, které jsou jedinečné pro platformu iOS - ty je třeba přeložit zvlášť. -weblate: automatické návrhy +weblate: automatické návrhy ## Po dokončení překladu diff --git a/docs/lang/cs/WEBRTC.md b/docs/lang/cs/WEBRTC.md index 3a9dc30a86..64ebc91093 100644 --- a/docs/lang/cs/WEBRTC.md +++ b/docs/lang/cs/WEBRTC.md @@ -1,3 +1,7 @@ +--- +title: Použití vlastních serverů WebRTC ICE v SimpleX Chat +revision: 31.01.2023 +--- | Aktualizováno 31.01.2023 | Jazyky: CZ, [EN](/docs/WEBRTC.md), [FR](/docs/lang/fr/WEBRTC.md) | # Použití vlastních serverů WebRTC ICE v SimpleX Chat @@ -124,7 +128,7 @@ To je vše - nyní můžete uskutečňovat audio a video hovory prostřednictví 2. Do části **Sestavit seznam serverů ICE** přidejte: - . + . - `STUN: stun::` a stiskněte `Add STUN`. - `TURN: turn::`, `Username: `, `Credential: ` a stiskněte `Add TURN` @@ -133,10 +137,10 @@ To je vše - nyní můžete uskutečňovat audio a video hovory prostřednictví 3. Měli byste vidět své servery v sekci **ICE server list**. Pokud je vše správně nastaveno, stiskněte `Start test`: - + 4. V části **Výsledky** byste měli vidět něco takového: - + Pokud výsledky zobrazují kandidáty `srflx` a `relay`, je vše nastaveno správně! diff --git a/docs/lang/fr/ANDROID.md b/docs/lang/fr/ANDROID.md index 6af2de5ee9..905af50152 100644 --- a/docs/lang/fr/ANDROID.md +++ b/docs/lang/fr/ANDROID.md @@ -1,3 +1,7 @@ +--- +title: Accès aux fichiers dans l'application Android +revision: 07.02.2023 +--- | 07.02.2023 | FR, [EN](/docs/ANDROID.md), [CZ](/docs/lang/cs/ANDROID.md) | # Accès aux fichiers dans l'application Android diff --git a/docs/lang/fr/CLI.md b/docs/lang/fr/CLI.md index 289e9d9722..2c4a88e2d7 100644 --- a/docs/lang/fr/CLI.md +++ b/docs/lang/fr/CLI.md @@ -1,3 +1,7 @@ +--- +title: Application de terminal +revision: 31.01.2023 +--- | 31.01.2023 | FR, [EN](/docs/CLI.md), [CZ](/docs/lang/cs/CLI.md) | # Application de terminal (console) SimpleX Chat pour Linux/MacOS/Windows diff --git a/docs/lang/fr/CONTRIBUTING.md b/docs/lang/fr/CONTRIBUTING.md index c9965e0240..81515b09b2 100644 --- a/docs/lang/fr/CONTRIBUTING.md +++ b/docs/lang/fr/CONTRIBUTING.md @@ -1,3 +1,7 @@ +--- +title: Guide pour contribuer +revision: 31.01.2023 +--- | 31.01.2023 | FR, [EN](/docs/CONTRIBUTING.md), [CZ](/docs/lang/cs/CONTRIBUTING.md) | # Guide pour contribuer diff --git a/docs/lang/fr/SERVER.md b/docs/lang/fr/SERVER.md index 7bbffd772d..6f9c7c5990 100644 --- a/docs/lang/fr/SERVER.md +++ b/docs/lang/fr/SERVER.md @@ -1,3 +1,7 @@ +--- +title: Héberger votre propre serveur SMP +revision: 31.01.2023 +--- | 31.01.2023 | FR, [EN](/docs/SERVER.md), [CZ](/docs/lang/cs/SERVER.md) | # Héberger votre propre serveur SMP diff --git a/docs/lang/fr/SIMPLEX.md b/docs/lang/fr/SIMPLEX.md index 10c55ee05b..a7134205d0 100644 --- a/docs/lang/fr/SIMPLEX.md +++ b/docs/lang/fr/SIMPLEX.md @@ -1,3 +1,7 @@ +--- +title: Plateforme SimpleX +revision: 07.02.2023 +--- | 07.02.2023 | FR, [EN](/docs/SIMPLEX.md), [CZ](/docs/lang/cs/SIMPLEX.md) | # Plateforme SimpleX - motivation et comparaison diff --git a/docs/lang/fr/SQL.md b/docs/lang/fr/SQL.md index d1f19abd58..d141153d65 100644 --- a/docs/lang/fr/SQL.md +++ b/docs/lang/fr/SQL.md @@ -1,3 +1,7 @@ +--- +title: Accès aux messages de la base de données +revision: 31.01.2023 +--- | 31.01.2023 | FR, [EN](/docs/SQL.md), [CZ](/docs/lang/cs/SQL.md) | # Accès aux messages de la base de données diff --git a/docs/lang/fr/TRANSLATIONS.md b/docs/lang/fr/TRANSLATIONS.md index 7eb7969daa..e85a4a8513 100644 --- a/docs/lang/fr/TRANSLATIONS.md +++ b/docs/lang/fr/TRANSLATIONS.md @@ -1,3 +1,7 @@ +--- +title: Contribuer aux traductions de SimpleX Chat +revision: 19.03.2023 +--- | 19.03.2023 | FR, [EN](/docs/TRANSLATIONS.md), [CZ](/docs/lang/cs/TRANSLATIONS.md) | # Contribuer aux traductions de SimpleX Chat diff --git a/docs/lang/fr/WEBRTC.md b/docs/lang/fr/WEBRTC.md index 48f529d6ba..e06ca46c18 100644 --- a/docs/lang/fr/WEBRTC.md +++ b/docs/lang/fr/WEBRTC.md @@ -1,3 +1,7 @@ +--- +title: Utilisation de serveurs WebRTC ICE personnalisés dans SimpleX Chat +revision: 31.01.2023 +--- | 31.01.2023 | FR, [EN](/docs/WEBRTC.md), [CZ](/docs/lang/cs/WEBRTC.md) | # Utilisation de serveurs WebRTC ICE personnalisés dans SimpleX Chat diff --git a/docs/protocol/simplex-chat.md b/docs/protocol/simplex-chat.md index 0dd61d2921..95069c794c 100644 --- a/docs/protocol/simplex-chat.md +++ b/docs/protocol/simplex-chat.md @@ -1,3 +1,7 @@ +--- +title: SimpleX Chat Protocol +revision: 08.08.2022 +--- DRAFT Revision 0.1, 2022-08-08 Evgeny Poberezkin diff --git a/website/.eleventy.js b/website/.eleventy.js index 7dc872b6aa..07815958e5 100644 --- a/website/.eleventy.js +++ b/website/.eleventy.js @@ -15,7 +15,7 @@ const globalConfig = { } const translationsDirectoryPath = './langs' -const supportedRoutes = ["blog", "contact", "invitation", ""] +const supportedRoutes = ["blog", "contact", "invitation", "docs", ""] let supportedLangs = [] fs.readdir(translationsDirectoryPath, (err, files) => { if (err) { @@ -26,7 +26,7 @@ fs.readdir(translationsDirectoryPath, (err, files) => { return file.endsWith('.json') && fs.statSync(translationsDirectoryPath + '/' + file).isFile() }) supportedLangs = jsonFileNames.map(file => file.replace('.json', '')) -}); +}) const translations = require("./translations.json") @@ -40,18 +40,41 @@ module.exports = function (ty) { return "en" }) - ty.addShortcode("getlangRoute", (path) => { - const lang = path.split("/")[1] - if (supportedRoutes.includes(lang)) return "" - if (supportedLangs.includes(lang)) return `/${lang}` - return "/en" + ty.addFilter("getlang", (path) => { + const urlParts = path.split("/") + if (urlParts[1] === "docs") { + if (urlParts[2] === "lang") { + return urlParts[3] + } + return "en" + } + else { + if (supportedRoutes.includes(urlParts[1])) return "en" + else if (supportedLangs.includes(urlParts[1])) return urlParts[1] + return "en" + } }) ty.addShortcode("completeRoute", (obj) => { const urlParts = obj.url.split("/") + if (supportedRoutes.includes(urlParts[1])) { if (urlParts[1] == "blog") return `/blog` + + else if (urlParts[1] === "docs") { + if (urlParts[2] === "lang") { + if (obj.lang === "en") + return `/docs/${urlParts.slice(4).join('/')}` + return `/docs/lang/${obj.lang}/${urlParts.slice(4).join('/')}` + } + else { + if (obj.lang === "en") + return `${obj.url}` + return `/docs/lang/${obj.lang}/${urlParts.slice(2).join('/')}` + } + } + else if (obj.lang === "en") return `${obj.url}` return `/${obj.lang}${obj.url}` @@ -73,7 +96,7 @@ module.exports = function (ty) { '*': 'en' }, defaultLocale: 'en', - }); + }) // Keeps the same directory structure. ty.addPassthroughCopy("src/assets/") @@ -87,7 +110,10 @@ module.exports = function (ty) { ty.addPassthroughCopy("src/hero-phone") ty.addPassthroughCopy("src/hero-phone-dark") ty.addPassthroughCopy("src/blog/images") - supportedLangs.forEach(lang => ty.addPassthroughCopy(`src/${lang}/blog/images`)) + ty.addPassthroughCopy("src/docs/*.png") + ty.addPassthroughCopy("src/docs/images") + ty.addPassthroughCopy("src/docs/protocol/diagrams") + ty.addPassthroughCopy("src/docs/protocol/*.json") ty.addPassthroughCopy("src/images") ty.addPassthroughCopy("src/CNAME") ty.addPassthroughCopy("src/.well-known") @@ -96,6 +122,83 @@ module.exports = function (ty) { return collection.getFilteredByGlob('src/blog/*.md').reverse() }) + ty.addCollection('docs', function (collection) { + const docs = collection.getFilteredByGlob('src/docs/**/*.md') + .map(doc => { + return { url: doc.url, title: doc.data.title, inputPath: doc.inputPath } + }) + + let referenceContent = fs.readFileSync(path.resolve(__dirname, 'src/_data/docs_sidebar.json'), 'utf-8') + referenceContent = JSON.parse(referenceContent).items + + const newDocs = [] + + referenceContent.forEach(referenceMenu => { + referenceMenu.data.forEach(referenceSubmenu => { + docs.forEach(doc => { + const url = doc.url.replace("/docs/", "") + const urlParts = url.split("/") + + if (doc.inputPath.includes(referenceSubmenu)) { + if (urlParts.length === 1 && urlParts[0] !== "") { + const index = newDocs.findIndex((ele) => ele.lang === 'en' && ele.menu === referenceMenu.menu) + if (index !== -1) { + newDocs[index].data.push(doc) + } + else { + newDocs.push({ + lang: 'en', + menu: referenceMenu.menu, + data: [doc], + }) + } + } + else if (urlParts.length > 1 && urlParts[0] !== "" && urlParts[0] !== "lang") { + const index = newDocs.findIndex((ele) => ele.lang === 'en' && ele.menu === referenceMenu.menu) + if (index !== -1) { + newDocs[index].data.push(doc) + } else { + newDocs.push({ + lang: 'en', + menu: referenceMenu.menu, + data: [doc], + }) + } + } + else if (urlParts.length === 3 && urlParts[0] === "lang" && urlParts[2] !== '') { + const index = newDocs.findIndex((ele) => ele.lang === urlParts[1] && ele.menu === referenceMenu.menu) + if (index !== -1) { + newDocs[index].data.push(doc) + } + else { + newDocs.push({ + lang: urlParts[1], + menu: referenceMenu.menu, + data: [doc], + }) + } + } + else if (urlParts.length > 3 && urlParts[0] === "lang" && urlParts[2] !== '') { + const index = newDocs.findIndex((ele) => ele.lang === urlParts[1] && ele.menu === referenceMenu.menu) + if (index !== -1) { + newDocs[index].data.push(doc) + } + else { + newDocs.push({ + lang: urlParts[1], + menu: referenceMenu.menu, + data: [doc], + }) + } + } + } + }) + }) + }) + + return newDocs + }) + ty.addWatchTarget("src/css") ty.addWatchTarget("markdown/") ty.addWatchTarget("components/Card.js") diff --git a/website/customize_docs_frontmatter.js b/website/customize_docs_frontmatter.js new file mode 100644 index 0000000000..8f2546e168 --- /dev/null +++ b/website/customize_docs_frontmatter.js @@ -0,0 +1,90 @@ +const fs = require('fs'); +const path = require('path'); +const matter = require('gray-matter'); + +const directoryPath = path.resolve(__dirname, 'src/docs'); +const langFolder = 'lang'; +const enFiles = {}; + +function traverseDirectory(directory, currentLanguage = 'en', result = {}, callback) { + const filesAndDirectories = fs.readdirSync(directory); + + filesAndDirectories.forEach((fileOrDirectoryName) => { + const fullPath = path.join(directory, fileOrDirectoryName); + + if (fs.statSync(fullPath).isDirectory()) { + // If the subdirectory is inside the 'lang' folder, update the current language + if (directory.endsWith('/lang')) { + currentLanguage = fileOrDirectoryName; + } + + // Recursively traverse the subdirectories + traverseDirectory(fullPath, currentLanguage, result, callback); + } else { + // Process the file only if it has the '.md' extension + if (path.extname(fullPath) === '.md') { + // Add the language to the file's language array or create a new array if it doesn't exist + const fileName = path.basename(fullPath, '.md'); + if (!result[fileName]) { + result[fileName] = []; + } + result[fileName].push(currentLanguage); + } + if (callback) { + callback(fullPath, currentLanguage); + } + } + }); + + return result; +} + +const fileLanguageMapping = traverseDirectory(directoryPath); + +// Update the frontmatter of each Markdown file +Object.entries(fileLanguageMapping).forEach(([fileName, languages]) => { + // Find and update the frontmatter of each Markdown file + traverseDirectory(directoryPath, null, {}, (fullPath, currentLanguage) => { + if (path.basename(fullPath) === `${fileName}.md`) { + // Read the existing frontmatter + const fileContent = fs.readFileSync(fullPath, 'utf-8'); + const parsedMatter = matter(fileContent); + const relativePath = path.relative(directoryPath, fullPath); + + // Calculate the permalink based on the file's location + const linkPath = path.relative(directoryPath, fullPath).replace(/\.md$/, '.html'); + const permalink = `/docs/${linkPath}`.toLowerCase(); + parsedMatter.data.permalink = permalink; + + // Update the frontmatter with the new languages list + parsedMatter.data.supportedLangsForDoc = languages; + + // Add the layout value + parsedMatter.data.layout = 'layouts/doc.html'; + + if (fullPath.startsWith(path.join(directoryPath, langFolder))) { + // Non-English files + const [language, ...rest] = relativePath.split(path.sep).slice(1); + const enFilePath = path.join(directoryPath, ...rest); + + if (enFiles[enFilePath]) { + const enRevision = new Date(enFiles[enFilePath].revision); + const currentRevision = new Date(parsedMatter.data.revision); + + const isOld = currentRevision < enRevision; + // Add the version value + parsedMatter.data.version = isOld ? 'old' : 'new'; + } + } else { + // English files + enFiles[fullPath] = { revision: parsedMatter.data.revision }; + // Add the version value + parsedMatter.data.version = 'new'; + } + + // Save the updated frontmatter and content back to the file + const updatedFileContent = matter.stringify(parsedMatter.content, parsedMatter.data); + fs.writeFileSync(fullPath, updatedFileContent, 'utf-8'); + } + }); +}); diff --git a/website/langs/en.json b/website/langs/en.json index 1a8b0baa85..7b0f35b1c1 100644 --- a/website/langs/en.json +++ b/website/langs/en.json @@ -209,5 +209,27 @@ "comparison-section-list-point-5": "Does not protect users' metadata", "comparison-section-list-point-6": "While P2P are distributed, they are not federated - they operate as a single network", "comparison-section-list-point-7": "P2P networks either have a central authority or the whole network can be compromised", - "see-here": "see here" + "see-here": "see here", + "guide-dropdown-1": "Quick start", + "guide-dropdown-2": "Sending messages", + "guide-dropdown-3": "Secret groups", + "guide-dropdown-4": "Chat profiles", + "guide-dropdown-5": "Managing data", + "guide-dropdown-6": "Audio & video Calls", + "guide-dropdown-7": "Privacy & security", + "guide-dropdown-8": "App settings", + "guide-dropdown-9": "Making connections", + "guide": "Guide", + "docs-dropdown-1": "SimpleX platform", + "docs-dropdown-2": "Accessing Android files", + "docs-dropdown-3": "Accessing chat database", + "docs-dropdown-4": "Host SMP Server", + "docs-dropdown-5": "Host XFTP Server", + "docs-dropdown-6": "WebRTC servers", + "docs-dropdown-7": "Translate SimpleX Chat", + "newer-version-of-eng-msg": "There is a newer version of this page in English.", + "click-to-see": "Click to see", + "menu": "Menu", + "on-this-page": "On this page", + "back-to-top": "Back to top" } \ No newline at end of file diff --git a/website/merge_translations.js b/website/merge_translations.js index 37de897de8..163606d5e1 100644 --- a/website/merge_translations.js +++ b/website/merge_translations.js @@ -9,11 +9,11 @@ const jsonFileNames = files.filter(file => file.endsWith('.json')); supportedLangs = jsonFileNames.map(file => file.replace('.json', '')) // keys of the english language are used as the base keys -const enStrings = require("./langs/en.json") +const enStrings = require(path.resolve(__dirname, "langs/en.json")) const languages = {} for (const lang of supportedLangs) { - languages[lang] = require(`./langs/${lang}.json`) + languages[lang] = require(path.resolve(__dirname, `langs/${lang}.json`)) } // this program generates a combined translations.json file @@ -27,9 +27,7 @@ for (const key in enStrings) { translations[key] = langStrings } -saveFile("translations.json", translations) -// the list in the supported_languages.json file is used as the reference list for displaying available languages on the frontend -saveFile("src/_data/supported_languages.json", {"langs": supportedLangs}) +saveFile(path.resolve(__dirname, "translations.json"), translations) function saveFile(relPath, data) { filePath = path.resolve(__dirname, relPath) diff --git a/website/package.json b/website/package.json index 5560e7bece..758e2f62a5 100644 --- a/website/package.json +++ b/website/package.json @@ -28,6 +28,7 @@ "tailwindcss": "^3.2.7" }, "dependencies": { - "eleventy-plugin-i18n": "^0.1.3" + "eleventy-plugin-i18n": "^0.1.3", + "gray-matter": "^4.0.3" } } diff --git a/website/src/_data/docs_dropdown.json b/website/src/_data/docs_dropdown.json new file mode 100644 index 0000000000..ff05242c81 --- /dev/null +++ b/website/src/_data/docs_dropdown.json @@ -0,0 +1,32 @@ +{ + "items": [ + { + "title": "docs-dropdown-1", + "url": "/docs/simplex.html" + }, + { + "title": "docs-dropdown-2", + "url": "/docs/android.html" + }, + { + "title": "docs-dropdown-3", + "url": "/docs/sql.html" + }, + { + "title": "docs-dropdown-4", + "url": "/docs/server.html" + }, + { + "title": "docs-dropdown-5", + "url": "/docs/xftp-server.html" + }, + { + "title": "docs-dropdown-6", + "url": "/docs/webrtc.html" + }, + { + "title": "docs-dropdown-7", + "url": "/docs/translations.html" + } + ] +} \ No newline at end of file diff --git a/website/src/_data/docs_sidebar.json b/website/src/_data/docs_sidebar.json new file mode 100644 index 0000000000..f05ae0ab1a --- /dev/null +++ b/website/src/_data/docs_sidebar.json @@ -0,0 +1,38 @@ +{ + "items": [ + { + "menu": "Guide", + "data": [ + "README.md", + "send-messages.md", + "secret-groups.md", + "chat-profiles.md", + "managing-data.md", + "audio-video-calls.md", + "privacy-security.md", + "app-settings.md", + "making-connections.md" + ] + }, + { + "menu": "Reference", + "data": [ + "SIMPLEX.md", + "ANDROID.md", + "CLI.md", + "SQL.md", + "CONTRIBUTING.md", + "SERVER.md", + "TRANSLATIONS.md", + "WEBRTC.md", + "XFTP-SERVER.md" + ] + }, + { + "menu": "Protocol", + "data": [ + "simplex-chat.md" + ] + } + ] +} \ No newline at end of file diff --git a/website/src/_data/guide_dropdown.json b/website/src/_data/guide_dropdown.json new file mode 100644 index 0000000000..fc6383c709 --- /dev/null +++ b/website/src/_data/guide_dropdown.json @@ -0,0 +1,40 @@ +{ + "items": [ + { + "title": "guide-dropdown-1", + "url": "/docs/guide/readme.html" + }, + { + "title": "guide-dropdown-2", + "url": "/docs/guide/send-messages.html" + }, + { + "title": "guide-dropdown-3", + "url": "/docs/guide/secret-groups.html" + }, + { + "title": "guide-dropdown-4", + "url": "/docs/guide/chat-profiles.html" + }, + { + "title": "guide-dropdown-5", + "url": "/docs/guide/managing-data.html" + }, + { + "title": "guide-dropdown-6", + "url": "/docs/guide/audio-video-calls.html" + }, + { + "title": "guide-dropdown-7", + "url": "/docs/guide/privacy-security.html" + }, + { + "title": "guide-dropdown-8", + "url": "/docs/guide/app-settings.html" + }, + { + "title": "guide-dropdown-9", + "url": "/docs/guide/making-connections.html" + } + ] +} \ No newline at end of file diff --git a/website/src/_includes/footer.html b/website/src/_includes/footer.html index a3b984be38..42d8591fda 100644 --- a/website/src/_includes/footer.html +++ b/website/src/_includes/footer.html @@ -1,38 +1,51 @@ +{% set lang = page.url | getlang %}
- logo - + logo +
- SimpleX Whitepaper + class="text-grey-black dark:text-white text-[14px] font-medium leading-[28px] tracking-[0.01em] mb-3 flex items-center gap-1"> + SimpleX Whitepaper + + - {{ "simplex-chat-protocol" | i18n({}, lang ) | safe }} + class="text-grey-black dark:text-white text-[14px] font-medium leading-[28px] tracking-[0.01em] mb-3 flex items-center gap-1"> + {{ "simplex-chat-protocol" | i18n({}, lang ) | safe }} + + - {{ "terms-and-privacy-policy" | i18n({}, lang ) | safe }} + class="text-grey-black dark:text-white text-[14px] font-medium leading-[28px] tracking-[0.01em] mb-3 flex items-center gap-1"> + {{ "terms-and-privacy-policy" | i18n({}, lang ) | safe }} + + - {{ "donate" | i18n({}, lang ) | safe }} + class="text-grey-black dark:text-white text-[14px] font-medium leading-[28px] tracking-[0.01em] mb-3 flex items-center gap-1"> + {{ "donate" | i18n({}, lang ) | safe }} + +
- {{ "terminal-cli" | i18n({}, lang ) | safe }} + class="text-grey-black dark:text-white text-[14px] font-medium leading-[28px] tracking-[0.01em] mb-3 flex items-center gap-1"> + {{ "terminal-cli" | i18n({}, lang ) | safe }} + + - TypeScript SDK + class="text-grey-black dark:text-white text-[14px] font-medium leading-[28px] tracking-[0.01em] mb-3 flex items-center gap-1"> + TypeScript SDK + +
diff --git a/website/src/_includes/layouts/article.html b/website/src/_includes/layouts/article.html index 922d9905a1..a4cf610ae3 100644 --- a/website/src/_includes/layouts/article.html +++ b/website/src/_includes/layouts/article.html @@ -25,6 +25,7 @@ + @@ -41,6 +42,7 @@
{% include "footer.html" %} + diff --git a/website/src/_includes/layouts/doc.html b/website/src/_includes/layouts/doc.html new file mode 100644 index 0000000000..04b4b99928 --- /dev/null +++ b/website/src/_includes/layouts/doc.html @@ -0,0 +1,123 @@ +{% set lang = page.url | getlang %} + + + + + + + + {{ title }} + + + + + + + + + + + +
+ {% include "navbar.html" %} +
+ +
+
+
+ + +
+
+
+ + {% include "footer.html" %} + + + + + + \ No newline at end of file diff --git a/website/src/_includes/navbar.html b/website/src/_includes/navbar.html index a756701416..49836649e1 100644 --- a/website/src/_includes/navbar.html +++ b/website/src/_includes/navbar.html @@ -1,16 +1,24 @@ +{% set lang = page.url | getlang %} +{% set langName = "aaa" %} +{% for language in languages.languages %} + {% if language.label == page.url | getlang %} + {% set langName = language.name %} + {% endif %} +{% endfor %} +
- - - - + + + +