mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-12-22 19:01:28 +00:00
Autogen instance data (#54)
* Adding autogen instance data. Fixes #29 * Updating submodules * Fixing husky * Updating submodules * Updating submodules
This commit is contained in:
parent
65f4baf3ca
commit
b6c4306457
12 changed files with 123 additions and 331 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 2f55f8dc7a4da3aa7e73e3961a2b963446feb091
|
||||
Subproject commit 19ff27de57476beb1e6294707c594003ff9d55e2
|
1
lemmy-instance-stats
Submodule
1
lemmy-instance-stats
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit c8841c0dcd9024091752198c9167ae1fba6ee559
|
|
@ -1 +1 @@
|
|||
Subproject commit e6e82ba80ff4bf3762c602fedc71f5967098f190
|
||||
Subproject commit cb91fdeb05054ed28cb1a47ee3e4e39ab83cde33
|
|
@ -8,9 +8,9 @@
|
|||
"build:prod": "webpack --mode=production",
|
||||
"clean": "yarn run rimraf dist",
|
||||
"lint": "node generate_translations.js && tsc --noEmit && eslint --report-unused-disable-directives --ext .js,.ts,.tsx src",
|
||||
"postinstall": "husky install",
|
||||
"prebuild:dev": "yarn clean && node generate_translations.js",
|
||||
"prebuild:prod": "yarn clean && node generate_translations.js",
|
||||
"prepare": "husky install",
|
||||
"start": "yarn build:dev --watch"
|
||||
},
|
||||
"repository": "https://github.com/LemmyNet/joinlemmy-site",
|
||||
|
@ -46,7 +46,7 @@
|
|||
"css-loader": "^5.1.3",
|
||||
"eslint": "^7.20.0",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"husky": "^5.2.0",
|
||||
"husky": "^6.0.0",
|
||||
"lint-staged": "^10.5.4",
|
||||
"mini-css-extract-plugin": "^1.3.8",
|
||||
"node-sass": "^5.0.0",
|
||||
|
|
|
@ -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}`}>
|
||||
{i18n.t("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
|
|
@ -3997,10 +3997,10 @@ humanize-ms@^1.2.1:
|
|||
dependencies:
|
||||
ms "^2.0.0"
|
||||
|
||||
husky@^5.2.0:
|
||||
version "5.2.0"
|
||||
resolved "https://registry.yarnpkg.com/husky/-/husky-5.2.0.tgz#fc5e1c2300d34855d47de4753607d00943fc0802"
|
||||
integrity sha512-AM8T/auHXRBxlrfPVLKP6jt49GCM2Zz47m8G3FOMsLmTv8Dj/fKVWE0Rh2d4Qrvmy131xEsdQnb3OXRib67PGg==
|
||||
husky@^6.0.0:
|
||||
version "6.0.0"
|
||||
resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e"
|
||||
integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ==
|
||||
|
||||
i18next@^19.8.9:
|
||||
version "19.9.2"
|
||||
|
|
Loading…
Reference in a new issue