Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the instance picker #2006

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0a767cf
Base structure for the instance picker
thibaultamartin Jul 28, 2023
bca9573
Render the list dynamically from files
thibaultamartin Aug 2, 2023
fe1b6d4
Adding a few instances
thibaultamartin Aug 4, 2023
b59792d
Make sure the labels are consistent for filtering
thibaultamartin Sep 6, 2023
c884bc4
Display instance information on desktop
thibaultamartin Sep 7, 2023
ad6aafd
Fix alignment of the avatar and title in the modal
thibaultamartin Sep 7, 2023
68fba59
Use div instead of proper dialog because of how unmanageable the latt…
thibaultamartin Sep 8, 2023
2d84e69
Instance details are more responsive
thibaultamartin Sep 8, 2023
1ec053b
Make the domain stand out
thibaultamartin Sep 8, 2023
53fdec0
Add a workflow to update the instances (not yet scheduled)
thibaultamartin Sep 12, 2023
de0e625
Use the right path for the instances file
thibaultamartin Sep 12, 2023
4d69bdf
Remove 0wnz for now since they seem protective of their endpoints
thibaultamartin Sep 12, 2023
26119dc
No no, the right path
thibaultamartin Sep 12, 2023
675d10e
Use the right directory for the script now
thibaultamartin Sep 12, 2023
d2062e0
Commit updated instances data to the PR branch if triggered by a PR
thibaultamartin Sep 13, 2023
65aac89
Trigger the workflow on PRs to main
thibaultamartin Sep 13, 2023
61adbaf
No need for extra symbols in if
thibaultamartin Sep 13, 2023
fada18d
Switch to the correct branch
thibaultamartin Sep 13, 2023
ef19edd
No need for extra symbols in if
thibaultamartin Sep 13, 2023
28b014c
Test the update on this branch exclusively
thibaultamartin Sep 13, 2023
27ab251
No, on this branch
thibaultamartin Sep 13, 2023
e970886
Debugging the CI
thibaultamartin Sep 13, 2023
a553bd9
Commit the right file
thibaultamartin Sep 13, 2023
d43ee75
Update instances.toml
Sep 13, 2023
f331c43
Nobody likes infinite loops
thibaultamartin Sep 13, 2023
7e08075
Remove unused instances md files
thibaultamartin Sep 13, 2023
5f6b46a
Make the CI only trigger on schedule
thibaultamartin Sep 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/update-public-instances.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Update public instances
on:
schedule: [{cron: "0 0 * * *"}]

jobs:
run:
name: Update public instances
runs-on: ubuntu-latest
steps:
- name: Checkout matrix.org source
uses: actions/checkout@v4
with:
path: 'morg'

- name: Checkout the public instance updater
uses: actions/checkout@v4
with:
repository: 'thibaultamartin/public-instances-updater'
path: 'piu'

- name: Update public instance data on the runner
run: |
cp morg/content/public-instances/instances.toml piu/instances.toml
cd piu && yarn && yarn run update && cd ..
cp piu/instances.toml morg/content/public-instances/instances.toml

# Delete the if before merging to main
- name: Commit and push data (scheduled)
run: |
git config --global user.name "GitHub CI"
git config --global user.email "[email protected]"
git add content/public-instances/instances.toml
git commit -m "Update instances.toml"
git push
working-directory: morg
7 changes: 7 additions & 0 deletions content/public-instances/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
+++
title = "Matrix Server List"
template = "public-instances.html"
extra.summary = """
Find a server to securely host your Matrix account.
"""
+++
36 changes: 36 additions & 0 deletions content/public-instances/instances.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[[instances]]
title = "archaeo.social"
domain = "archaeo.social"
location = "CH"
hoster = "The archaeo social collective"
structure = "non-profit"
terms_of_service = "https://archaeo.social/about"
software = "Synapse"
version = "1.87.0"
creation_date = "1950-01-01"
description = """
An archaeology oriented instance.
"""

[instances.signup]
requires_email = true
requires_captcha = true

[[instances]]
title = "Matrix.org"
domain = "matrix.org"
location = "GB"
hoster = "The Matrix.org Foundation"
structure = "non-profit"
software = "Synapse"
version = "1.92.1 (b=matrix-org-hotfixes,3bb8cce692)"
privacy_policy = "https://matrix.org/legal/privacy-notice/"
terms_of_service = "https://matrix.org/legal/terms-and-conditions/"
creation_date = "2014-09-01"
description = """
The largest open network for secure, decentralised communications.
"""

[instances.signup]
requires_email = true
requires_captcha = true
176 changes: 176 additions & 0 deletions sass/_public-instances.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
.public-instances {

.total-and-filters {
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap;

.filters {
margin-inline: 0;
}

.total {
font-weight: 700;
}
}

#all-instances {
.project-card {

color: var(--color-text);
text-align: center;
text-decoration: none;

&:hover {
color: var(--color-text);
}

p {
line-height: 140%;
}
}
}

ul.details {
padding: 0;
display: flex;
gap: .2rem;
flex-wrap: wrap;
justify-content: center;
margin-block-start: auto;

li {
list-style: none;
background: #E9E9E9;
border-radius: 16px;
padding: .375rem .625rem;

font-style: normal;
font-weight: 400;
font-size: 1rem;
line-height: 120%;
color: #000000;
}
}

.avatar {
width: 60px;
height: 60px;
background-color: #000000;
color: #fff;
display: grid;
place-content: center;
font-size: 32px;
clip-path: circle(30px);
}

.dialog {
display: none;
background-color: #fff;;
border: 2px solid #d2d2d2;
border-radius: 20px;
position: fixed;
padding: 2.5rem 1.5rem;
z-index: 200;

top: 50%;
left: 50%;
transform: translate(-50%, -50%);

overflow: auto;

@media (max-width: 767px) {
left: -2px;
right: -2px;
top: 20%;
bottom: -20px;
padding-block-end: calc(2.5rem + 20px);
transform: unset;
}

&.display {
display: block;
}

a {
color: #000;
font-weight: 700;
text-decoration: underline;
}

form {
display: flex;
}

.close-button {
background-color: #000000;
border-color: transparent;
display: grid;
place-content: center;
padding: 10px;
clip-path: circle(15px at center);

position: absolute;
top: 1rem;
right: 1rem;

img {
width: 10px;
height: 10px;
}
}

.instance-header {
display: flex;
gap: 1rem;
margin-inline-end: 3rem;
flex-wrap: wrap;

.avatar {
margin-block: auto;
}

.title-row {
display: flex;
justify-content: flex-start;
gap: 1rem;
flex-wrap: wrap;

ul.details {
margin-block: auto;
}
}
}

.instance-body {
padding-block: 0;
display: grid;
grid-template-columns: repeat(2, 1fr);
@media (max-width: 767px) {
grid-template-columns: 1fr;
}
gap: 2rem;

h2 {
font-size: 1.1rem;
border-block-end: 1px solid #d2d2d2;
padding-block-end: .8rem;
margin-block-end: .8rem;
}

ul {
padding-inline-start: 1em;
}
}

footer {
margin-block-start: 2rem;

.domain {
font-family: 'Courier New', Courier, monospace;
font-weight: 700;
}
}
}
}
1 change: 1 addition & 0 deletions sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
@import '_try-matrix';
@import '_support';
@import '_howitworks';
@import '_public-instances';
3 changes: 3 additions & 0 deletions static/assets/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 45 additions & 0 deletions static/js/public-instances.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { AllOfFilter, AnyOfFilter, refreshCardsView } from "./projects.js";

document.addEventListener('DOMContentLoaded', (event) => {

var filters = [];
let structureFilter = new AnyOfFilter("filter-structure", "all-instances", filters);
let signupFilter = new AnyOfFilter("filter-signup", "all-instances", filters);
let locationFilter = new AnyOfFilter("filter-location", "all-instances", filters);
let softwareFilter = new AnyOfFilter("filter-software", "all-instances", filters)
filters.push(
structureFilter,
signupFilter,
locationFilter,
softwareFilter
);
refreshCardsView("all-instances", filters);
for (const filter of filters) {
filter.refreshActiveState();
}

const dialogOpeners = document.querySelectorAll("#all-instances > div > a");
const overlay = document.getElementById("filters-overlay");
for(var opener of dialogOpeners) {
const modal = document.getElementById(opener.id + "-modal");
const closers = modal.getElementsByClassName("close-button");
for(const closer of closers) {
closer.addEventListener('click', () => {
modal.classList.remove("display");
overlay.classList.remove("display");
});
}
opener.addEventListener('click', () => {
modal.classList.add("display");
overlay.classList.add("display");
});
overlay.addEventListener('click', () => {
modal.classList.remove("display");
});
document.addEventListener('keydown', (e) => {
if(e.key == "Escape") {
modal.classList.remove("display");
}
})
}
})
Loading
Loading