mirror of
https://github.com/LemmyNet/joinlemmy-site.git
synced 2024-11-22 04:11:15 +00:00
Filter instance list at crawl time
This commit is contained in:
parent
7df77b14c3
commit
bc0e4be16a
6 changed files with 160552 additions and 210027 deletions
16
crawl.mjs
16
crawl.mjs
|
@ -1,11 +1,10 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { exit } from "process";
|
||||
import { spawn } from "child_process";
|
||||
|
||||
const outDir = "src/shared/translations/";
|
||||
const recommendationsFile = "recommended-instances.json";
|
||||
const instanceStatsFile = "src/shared/instance_stats.ts";
|
||||
const min_monthly_users = 5;
|
||||
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
|
||||
|
@ -26,6 +25,7 @@ try {
|
|||
"run",
|
||||
"--",
|
||||
"--json",
|
||||
"--max-crawl-distance", "0",
|
||||
"--start-instances",
|
||||
all_recommended,
|
||||
"--exclude-instances",
|
||||
|
@ -50,7 +50,17 @@ try {
|
|||
});
|
||||
|
||||
run.on("close", exitCode => {
|
||||
const stats = JSON.parse(savedOutput);
|
||||
var stats = JSON.parse(savedOutput);
|
||||
stats = stats.instance_details
|
||||
.filter(
|
||||
i =>
|
||||
i.site_info.site_view.local_site.registration_mode != "closed"
|
||||
)
|
||||
.filter(
|
||||
i =>
|
||||
i.site_info.site_view.counts.users_active_month >
|
||||
min_monthly_users
|
||||
);
|
||||
|
||||
let stats2 = {
|
||||
stats: stats,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 14eef8c998578f60c895a38f55f58c29691f7c23
|
||||
Subproject commit 892abc1ef57966c8945f165a67eb11e83623706b
|
|
@ -1 +1 @@
|
|||
Subproject commit ed6a393329b79fd23964231e26cfa00347b8fc83
|
||||
Subproject commit 788a3dd6e02fbe153e6d7c6315601ade15637f8c
|
|
@ -1 +1 @@
|
|||
Subproject commit a241fe1255a6363c7ae1ec5a09520c066745e6ce
|
||||
Subproject commit 5a9d44656e2658ab7cb2dbec3fd1bfaf57654533
|
|
@ -4,8 +4,6 @@ import { i18n } from "../i18next";
|
|||
import { instance_stats } from "../instance_stats";
|
||||
import { numToSI } from "../utils";
|
||||
|
||||
const min_monthly_users = 5;
|
||||
|
||||
export class Instances extends Component<any, any> {
|
||||
constructor(props: any, context: any) {
|
||||
super(props, context);
|
||||
|
@ -101,52 +99,42 @@ export class Instances extends Component<any, any> {
|
|||
<div>
|
||||
<h2>{header}</h2>
|
||||
<div class="row">
|
||||
{instances
|
||||
.filter(
|
||||
i =>
|
||||
i.site_info.site_view.local_site.registration_mode != "closed"
|
||||
)
|
||||
.filter(
|
||||
i =>
|
||||
i.site_info.site_view.counts.users_active_month >
|
||||
min_monthly_users
|
||||
)
|
||||
.map(instance => {
|
||||
let domain = instance.domain;
|
||||
let description = instance.site_info.site_view.site.description;
|
||||
let icon = instance.site_info.site_view.site.icon;
|
||||
let require_application =
|
||||
instance.site_info.site_view.local_site.registration_mode ==
|
||||
"requireapplication";
|
||||
return (
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">{domain}</h4>
|
||||
</div>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src={icon || "/static/assets/images/lemmy.svg"}
|
||||
/>
|
||||
{instances.map(instance => {
|
||||
let domain = instance.domain;
|
||||
let description = instance.site_info.site_view.site.description;
|
||||
let icon = instance.site_info.site_view.site.icon;
|
||||
let require_application =
|
||||
instance.site_info.site_view.local_site.registration_mode ==
|
||||
"requireapplication";
|
||||
return (
|
||||
<div class="card col-6">
|
||||
<header>
|
||||
<div class="row">
|
||||
<h4 class="col">{domain}</h4>
|
||||
</div>
|
||||
<br />
|
||||
<p class="join-desc">{description}</p>
|
||||
<footer>
|
||||
{require_application ? (
|
||||
<a class="button primary" href={`https://${domain}`}>
|
||||
{i18n.t("apply_to_join")}
|
||||
</a>
|
||||
) : (
|
||||
<a class="button primary" href={`https://${domain}`}>
|
||||
{i18n.t("join")}
|
||||
</a>
|
||||
)}
|
||||
</footer>
|
||||
</header>
|
||||
<div class="is-center">
|
||||
<img
|
||||
class="join-banner"
|
||||
src={icon || "/static/assets/images/lemmy.svg"}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<br />
|
||||
<p class="join-desc">{description}</p>
|
||||
<footer>
|
||||
{require_application ? (
|
||||
<a class="button primary" href={`https://${domain}`}>
|
||||
{i18n.t("apply_to_join")}
|
||||
</a>
|
||||
) : (
|
||||
<a class="button primary" href={`https://${domain}`}>
|
||||
{i18n.t("join")}
|
||||
</a>
|
||||
)}
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
370477
src/shared/instance_stats.ts
370477
src/shared/instance_stats.ts
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue