mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-11-22 04:11:15 +00:00
Adding autogen instance data. Fixes #29
This commit is contained in:
parent
625b5a5139
commit
fa6dc565cf
9 changed files with 116 additions and 324 deletions
4
.gitmodules
vendored
4
.gitmodules
vendored
|
@ -10,3 +10,7 @@
|
|||
path = lemmy-translations
|
||||
url = https://github.com/lemmynet/lemmy-translations
|
||||
branch = main
|
||||
[submodule "lemmy-instance-stats"]
|
||||
path = lemmy-instance-stats
|
||||
url = https://github.com/LemmyNet/lemmy-instance-stats
|
||||
branch = main
|
||||
|
|
|
@ -3,8 +3,22 @@ const fs = require("fs");
|
|||
const translationDir = "joinlemmy-translations/translations/";
|
||||
const outDir = "src/shared/translations/";
|
||||
const translatorsJsonFile = "lemmy-translations/translators.json";
|
||||
const statsFile = "lemmy-instance-stats/stats.json";
|
||||
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
|
||||
// Write the stats file
|
||||
try {
|
||||
const json = JSON.parse(fs.readFileSync(statsFile, "utf8"));
|
||||
let data = `export const instance_stats = \n `;
|
||||
data += JSON.stringify(json, null, 2) + ";";
|
||||
const target = outDir + "instance_stats.ts";
|
||||
fs.writeFileSync(target, data);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
// Write the translations
|
||||
fs.readdir(translationDir, (_err, files) => {
|
||||
files.forEach(filename => {
|
||||
const lang = filename.split(".")[0];
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ebe8ea2849178fcc5c36c769ced31dbb3c14a78f
|
||||
Subproject commit 922a2219bd850bdfdf1ba6c92fccf5bd4db66f44
|
1
lemmy-instance-stats
Submodule
1
lemmy-instance-stats
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit cf294efd45886f60522eb6c021813c5e2c851d9b
|
|
@ -76,8 +76,8 @@ server.get("/*", async (req, res) => {
|
|||
height: 100%;
|
||||
background:
|
||||
linear-gradient(
|
||||
rgba(0, 0, 0, 0.0),
|
||||
rgba(0, 0, 0, 0.0)
|
||||
rgba(0, 0, 0, 0.5),
|
||||
rgba(0, 0, 0, 0.5)
|
||||
),
|
||||
url('/static/assets/images/main_img.webp');
|
||||
-webkit-filter: blur(7px);
|
||||
|
|
|
@ -1,336 +1,70 @@
|
|||
import { Component } from "inferno";
|
||||
import { Helmet } from "inferno-helmet";
|
||||
import { i18n } from "../i18next";
|
||||
import { instance_stats } from "../translations/instance_stats";
|
||||
import { numToSI } from "../utils";
|
||||
|
||||
const title = i18n.t("join_title");
|
||||
|
||||
// TODO wait until new lemmy-instances is written to refactor this
|
||||
|
||||
export class Instances extends Component<any, any> {
|
||||
constructor(props: any, context: any) {
|
||||
super(props, context);
|
||||
}
|
||||
|
||||
header() {
|
||||
return (
|
||||
<i>
|
||||
{i18n.t("instance_totals", {
|
||||
instances: numToSI(instance_stats.crawled_instances),
|
||||
users: numToSI(instance_stats.total_users),
|
||||
})}
|
||||
</i>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
let instances = instance_stats.instance_details;
|
||||
return (
|
||||
<div>
|
||||
<Helmet title={title}>
|
||||
<meta property={"title"} content={title} />
|
||||
</Helmet>
|
||||
<div class="container">
|
||||
<h1>{i18n.t("lemmy_servers")}</h1>
|
||||
<h1 class="is-marginless">{i18n.t("lemmy_servers")}</h1>
|
||||
{this.header()}
|
||||
<br />
|
||||
<br />
|
||||
<p>{i18n.t("choose_and_join")}</p>
|
||||
|
||||
<div class="row">
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">lemmy.ml</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>5.9k users</i>
|
||||
</h4>
|
||||
{instances.map(i => (
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">{i.domain}</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>
|
||||
{numToSI(i.users_active_month)} {i18n.t("users")} /{" "}
|
||||
{i18n.t("month")}
|
||||
</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src={i.icon || "/static/assets/images/lemmy.svg"}
|
||||
/>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="/static/assets/images/lemmy.svg"
|
||||
/>
|
||||
<br />
|
||||
<p class="join-desc">{i.description}</p>
|
||||
<footer>
|
||||
<a class="button primary" href={`https://${i.domain}`}>
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">The flagship instance of lemmy.</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://lemmy.ml">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">lemmygrad.ml</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>2.3k users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://lemmygrad.ml/pictrs/image/YI2XNWaVUv.png?format=webp"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">
|
||||
A collection of leftist communities, for memes, learning, news,
|
||||
discussion, media, or anything you like.
|
||||
</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://lemmygrad.ml">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">lemmy.161.social</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>50 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://lemmy.161.social/pictrs/image/n3Stw3I1g0.png?format=webp"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">
|
||||
An anti-authoritarian and emancipatory space for german speaking
|
||||
anti-fascists.
|
||||
</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://lemmy.161.social">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">baraza.africa</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>20 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="/static/assets/images/lemmy.svg"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">
|
||||
baraza is a digital public square as imagined in Bantu
|
||||
philosophy, one premised on the assumption that deliberative
|
||||
dialogue is a path to better societies.
|
||||
</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://baraza.africa">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">lemmy.glasgow.social</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>60 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://glasgow.social/system/site_uploads/files/000/000/001/original/fuller_street1_sq.jpg?1579523706"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">
|
||||
A place for communities in and around Glasgow, Scotland.
|
||||
</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://lemmy.glasgow.social">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">lemmy.cat</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>30 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://lemmy.cat/pictrs/image/p63LCl9dD2.jpg?format=webp&thumbnail=3000"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">
|
||||
A Lemmy instance for people of Catalan culture.
|
||||
</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://lemmy.cat">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">lemmy.ca</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>11 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://lemmy.ca/pictrs/image/YMyO670EYs.png?format=webp&thumbnail=3000"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">
|
||||
A Lemmy geared toward Canucks, hosted in Canuckistan, and run by
|
||||
a Canuck.
|
||||
</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://lemmy.ca">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">lemmy.eus</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>100 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="/static/assets/images/lemmy.svg"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">A Basque Lemmy instance.</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://lemmy.eus">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">sopuli.xyz</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>10 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://sopuli.xyz/pictrs/image/RmuyRzuchU.png?format=webp&thumbnail=3000"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">A general-purpose Finnish instance.</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://sopuli.xyz">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">stammtisch.hallertau.social</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>~10 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://stammtisch.hallertau.social/pictrs/image/TbUbi4vFwZ.jpg?format=webp&thumbnail=3000"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">Sitz de hera, samma mehra.</p>
|
||||
<footer>
|
||||
<a
|
||||
class="button primary"
|
||||
href="https://stammtisch.hallertau.social"
|
||||
>
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">szmer.info</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>300 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="/static/assets/images/lemmy.svg"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">A polish anti-fascist instance.</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://szmer.info">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">diversa.social</h4>
|
||||
<h4 class="col text-right">
|
||||
<i>~ 10 users</i>
|
||||
</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src="https://diversa.social/pictrs/image/Slw1Nu62Gm.png?format=webp&thumbnail=3000"
|
||||
/>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">
|
||||
Instancia multitemática en español con un enfoque constructivo y
|
||||
solidario.
|
||||
</p>
|
||||
<footer>
|
||||
<a class="button primary" href="https://diversa.social">
|
||||
Join
|
||||
</a>
|
||||
</footer>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -3,3 +3,27 @@ let DOCS_LANGUAGES = ["en", "es", "fr"];
|
|||
export function getDocsLanguage(lang: string): string {
|
||||
return DOCS_LANGUAGES.includes(lang) ? lang : "en";
|
||||
}
|
||||
|
||||
export function numToSI(value: any) {
|
||||
var newValue = value;
|
||||
if (value >= 1000) {
|
||||
var suffixes = ["", "k", "m", "b", "t"];
|
||||
var suffixNum = Math.floor(("" + value).length / 3);
|
||||
var shortValue: any = "";
|
||||
for (var precision = 2; precision >= 1; precision--) {
|
||||
shortValue = parseFloat(
|
||||
(suffixNum != 0
|
||||
? value / Math.pow(1000, suffixNum)
|
||||
: value
|
||||
).toPrecision(precision)
|
||||
);
|
||||
var dotLessShortValue = (shortValue + "").replace(/[^a-zA-Z 0-9]+/g, "");
|
||||
if (dotLessShortValue.length <= 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shortValue % 1 != 0) shortValue = shortValue.toFixed(1);
|
||||
newValue = shortValue + suffixes[suffixNum];
|
||||
}
|
||||
return newValue;
|
||||
}
|
||||
|
|
25
update_submodules.sh
Executable file
25
update_submodules.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
pushd ../joinlemmy-translations
|
||||
git fetch weblate
|
||||
git merge weblate/main
|
||||
git push
|
||||
popd
|
||||
|
||||
pushd ../lemmy-translations
|
||||
git fetch weblate
|
||||
git merge weblate/main
|
||||
git push
|
||||
|
||||
popd
|
||||
pushd ../lemmy-instance-stats
|
||||
./update.sh
|
||||
popd
|
||||
|
||||
git submodule update --remote
|
||||
git add joinlemmy-translations
|
||||
git add lemmy-translations
|
||||
git add lemmy-instance-stats
|
||||
|
||||
git commit -m"Updating submodules"
|
||||
git push
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
pushd ../joinlemmy-translations
|
||||
git fetch weblate
|
||||
git merge weblate/main
|
||||
git push
|
||||
popd
|
||||
git submodule update --remote
|
||||
git add joinlemmy-translations
|
||||
git commit -m"Updating joinlemmy-translations."
|
||||
git push
|
Loading…
Reference in a new issue