Commit ac6c630c authored by joe-narvaez's avatar joe-narvaez
Browse files

hotfix

parent c077be83
Pipeline #572984024 failed with stages
in 1 minute and 39 seconds
......@@ -20,7 +20,6 @@ checks:
build:
stage: build
script:
- yarn update-data
- yarn build
- rm -rf build/nonbuild
artifacts:
......
This diff is collapsed.
......@@ -4,11 +4,8 @@ sidebar_label: Getting Started
---
import Icons from '../../src/components/Icons';
import glossary from '../../data/glossary.json';
<Icons
data={glossary.filter(({category}) => category === 'devServices')}/>
<Icons category='dev-services' />
<br/>
Dev Services are used to build a modern apps. It aims to have feature parity or surpass a cloud provider's most popular features.
......
......@@ -9,7 +9,6 @@ The following is a list of all software used by Sway (dev services, personal ser
<br/>
import Items from "../../src/components/Items";
import data from "../../data/glossary.json";
<Items data={data}/>
<Items/>
......@@ -5,11 +5,9 @@ sidebar_label: Getting Started
import Icons from '../../src/components/Icons';
import glossary from '../../data/glossary.json';
<Icons
data={glossary.filter(({category}) => category === 'personalServices')}/>
<Icons category="personal-services"/>
<br/>
......@@ -34,7 +32,8 @@ The following diagram shows the main high level components.
All installations have a primary server, which hosts databases and daemons. If you chose Home Assistant its will need a separate server/OS installation.
<h4>Example Deployment</h4>
<img src="../../static/img/deployment.svg" style={{width: "100%"}}/>
![](../../static/img/deployment.svg)
<br/>
<br/>
......
......@@ -18,7 +18,7 @@ Sway Speaker is a smart speaker, with the [mycroft project](https://github.com/m
## Installation
1. Download the img from from the [here](https://minio.swayme.xyz/imgs/speaker.img).
1. Download the img from from the [here](https://minio.sway.cx/imgs/speaker.img).
2. Run (replacing `X` with the letter assigned to your microSD):
```
......
......@@ -18,7 +18,7 @@ This asks for some proficiency in rom installation. If you get stuck, first look
## Installation
1. Get the sway fastboot [here](https://minio.swayme.xyz/img/watch.fastboot) and the .ext4 image [here](https://minio.sway-me.xyz/img/watch.ext4).
1. Get the sway fastboot [here](https://minio.sway.cx/img/watch.fastboot) and the .ext4 image [here](https://minio.sway-me.xyz/img/watch.ext4).
2. Check the signature with keytool (optional)
`keytool -list -printcert -jarfile lineage-microG.zip`
the printed fingerprints should match with these
......
module.exports = {
title: "S W A Y",
tagline: "Selfhost your ecosystem",
url: "https://swayme.xyz",
url: "https://sway.cx",
baseUrl: "/",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
......@@ -28,7 +28,7 @@ module.exports = {
navbar: {
logo: {
target: "_self",
href: "https://beta.swayme.xyz",
href: "https://beta.sway.cx",
src: "img/logo_white.svg",
},
items: [
......
......@@ -8,7 +8,6 @@
"serve": "docusaurus serve",
"clear": "docusaurus clear",
"gen-css": "node src/scripts/genSvgCss.js",
"update-data": "node src/scripts/updateData.js",
"preflight": "gitlab-ci-lint --token $GITLAB_TOKEN",
"format": "prettier --check src/",
"lint": "eslint --ext js,jsx src --quiet",
......
import React from "react";
import React, { useEffect, useState } from "react";
export default function Icons({ data, size = 55 }) {
export default function Icons({ category, size = 55 }) {
const [data, setData] = useState([]);
useEffect(() => {
let isMounted = true;
fetch("https://minio.sway.cx/data/data.json")
.then((res) => res.json())
.then((json) => {
if (isMounted) {
setData(json.filter((j) => j.category === category));
}
});
return () => {
isMounted = false;
};
}, []);
if (!data.length) {
return <h5>...loading</h5>;
}
return (
<div
style={{
......
import React from "react";
import React, { useEffect, useState } from "react";
import { round } from "../scripts/utils";
const LinkWithStars = ({ name, url, rating }) => (
<span>
{" "}
&nbsp;| &nbsp; <a href={url}>{name}</a> <b>{round(rating)}</b> 🌟
&nbsp;| &nbsp; <a href={url}>{name}</a> <b>{round(rating)}</b>
</span>
);
export default ({ data }) =>
data.map(({ name, description, options }) => (
export default () => {
const [data, setData] = useState([]);
useEffect(() => {
let isMounted = true;
fetch("https://minio.sway.cx/data/data.json")
.then((res) => res.json())
.then((json) => {
if (isMounted) {
setData(json);
}
});
return () => {
isMounted = false;
};
}, []);
if (!data.length) {
return <h1>...loading</h1>;
}
return data.map(({ name, description, ...rest }) => (
<div key={name}>
<hr />
<div style={{ display: "flex", alignItems: "center" }}>
......@@ -28,7 +48,7 @@ export default ({ data }) =>
/>
<div>
<b>Source Code:</b>
{options.map((props, i) => (
{rest["repo-data"].map((props, i) => (
<LinkWithStars key={i} name={name} {...props} />
))}
</div>
......@@ -36,3 +56,4 @@ export default ({ data }) =>
</div>
</div>
));
};
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
const { writeFileSync, readFileSync } = require("fs");
const names = JSON.parse(readFileSync("data/glossary.json").toString()).map(
({ name }) => name
);
// jacked:https://github.com/F1LT3R/svg-to-dataurl/blob/master/index.js, 'light'
const svgDataRule = (name, svgStr) => {
const encoded = encodeURIComponent(svgStr)
.replace(/'/g, "%27")
.replace(/"/g, "%22");
const header = "data:image/svg+xml,";
return `--${name}: url("${header + encoded}") no-repeat;`;
};
const getFiles = (mode) =>
names.map((name) => ({
name,
file: readFileSync(`static/nonbuild/${mode}/${name}.svg`).toString(),
}));
const root = `
/**
* DO NOT EDIT. This file was generated via \`yarn gen-css\`
*/
:root {
${getFiles("light")
.map(({ name, file }) => svgDataRule(name, file))
.join("\n\t")}
}\n`;
const theme = `
[data-theme="dark"] {
${getFiles("dark")
.map(({ name, file }) => svgDataRule(name, file))
.join("\n\t")}
}\n`;
const classes = `
${names.map((name) => `.${name} {background: var(--${name});}`).join("\n")}
${names.map((name) => `.${name}`)} {
height: 100px;
width: 100px;
flex-shrink: 0;
background-size:contain;
background-position:center;
}`;
writeFileSync("src/css/svg.css", root + theme + classes);
// eslint-disable-next-line import/no-extraneous-dependencies
const fetch = require("node-fetch");
(async () => {
const payload = await fetch(
"https://minio.sway.cx/data/data.json"
).then((res) => res.json());
const names = payload.map(({ name }) => name);
const svgDataRule = (name, svgStr) => {
const encoded = encodeURIComponent(svgStr)
.replace(/'/g, "%27")
.replace(/"/g, "%22");
const header = "data:image/svg+xml,";
return `--${name}: url("${header + encoded}") no-repeat;`;
};
const getFiles = (mode) =>
names.map((name) => ({
name,
file: readFileSync(`static/nonbuild/${mode}/${name}.svg`).toString(),
}));
const root = `
/**
* DO NOT EDIT. This file was generated via \`yarn gen-css\`
*/
:root {
${getFiles("light")
.map(({ name, file }) => svgDataRule(name, file))
.join("\n\t")}
}\n`;
const theme = `
[data-theme="dark"] {
${getFiles("dark")
.map(({ name, file }) => svgDataRule(name, file))
.join("\n\t")}
}\n`;
const classes = `
${names.map((name) => `.${name} {background: var(--${name});}`).join("\n")}
${names.map((name) => `.${name}`)} {
height: 100px;
width: 100px;
flex-shrink: 0;
background-size:contain;
background-position:center;
}`;
writeFileSync("src/css/svg.css", root + theme + classes);
})();
// eslint-disable-next-line import/no-extraneous-dependencies
const fetch = require("node-fetch");
const { promises, readFileSync } = require("fs");
const fetchData = (url, query) =>
fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`,
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({ query }),
}).then((res) => res.json());
const fetchGitlab = async (owner, name) => {
const gitlabQuery = `{ project(fullPath: "${owner}/${name}") { starCount }}`;
const {
data: {
project: { starCount },
},
} = await fetchData("https://gitlab.com/api/graphql", gitlabQuery);
return starCount;
};
const fetchGithub = async (owner, name) => {
const gitHubQuery = `{ repository(name: "${name}", owner: "${owner}"){ stargazerCount } }`;
const {
data: {
repository: { stargazerCount },
},
} = await fetchData("https://api.github.com/graphql", gitHubQuery);
return stargazerCount;
};
const fetchRating = (url) => {
const [owner, name] = url.split("/").slice(-2);
if (url.includes("github.com")) {
return fetchGithub(owner, name);
}
if (url.includes("gitlab.com")) {
return fetchGitlab(owner, name);
}
return "";
};
const glossary = JSON.parse(readFileSync("data/glossary.json").toString());
const updateGlossary = async () => {
const payload = await Promise.all(
glossary.map(async ({ options, ...rest }) => ({
...rest,
options: await Promise.all(
options.map(async ({ rating, ...nestedRest }) => {
const updatedRating = await fetchRating(nestedRest.url);
return {
...nestedRest,
rating: updatedRating,
};
})
),
}))
);
await promises.writeFile("data/glossary.json", JSON.stringify(payload));
};
updateGlossary().then();
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment