Skip to content

Commit

Permalink
format automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
cookiell546 committed Nov 6, 2024
1 parent 2b1a864 commit 1735b9b
Show file tree
Hide file tree
Showing 6 changed files with 236 additions and 98 deletions.
30 changes: 15 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
target-branch: main
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
target-branch: main
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
target-branch: main
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
target-branch: main
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
target-branch: main
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
target-branch: main
34 changes: 17 additions & 17 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ name: Validate and process static files
on: [pull_request, push]

jobs:
static:
runs-on: ubuntu-latest
static:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: pip
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: npm
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip

- run: sudo apt-get update
- run: sudo apt-get -y install libxml2-utils yajl-tools moreutils zopfli
- run: npm ci --ignore-scripts
- run: 'pip install --require-hashes --only-binary :all: -r requirements.txt'
- run: sudo apt-get update
- run: sudo apt-get -y install libxml2-utils yajl-tools moreutils zopfli
- run: npm ci --ignore-scripts
- run: "pip install --require-hashes --only-binary :all: -r requirements.txt"

- name: process static
run: ./process-static
- name: process static
run: ./process-static
12 changes: 6 additions & 6 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ export default [
{
languageOptions: {
globals: {
...globals.browser
...globals.browser,
},
ecmaVersion: 2022,
sourceType: "module"
sourceType: "module",
},
rules: {
indent: ["error", 4],
"linebreak-style": ["error", "unix"],
quotes: ["error", "double"],
semi: ["error", "always"],
"no-unused-vars": ["error", {caughtErrors: "none"}],
"no-var": ["error"]
}
}
"no-unused-vars": ["error", { caughtErrors: "none" }],
"no-var": ["error"],
},
},
];
65 changes: 51 additions & 14 deletions static/js/redirect.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,23 @@ const redirects = new Map([
["/usage#default-connections", "/faq#default-connections"],
["/usage#sandboxed-google-play-esim", "/usage#esim-support"],
["/usage#sandboxed-play-services", "/usage#sandboxed-google-play"],
["/usage#sandboxed-play-services-installation", "/usage#sandboxed-google-play-installation"],
["/usage#sandboxed-play-services-limitations", "/usage#sandboxed-google-play-limitations"],
[
"/usage#sandboxed-play-services-installation",
"/usage#sandboxed-google-play-installation",
],
[
"/usage#sandboxed-play-services-limitations",
"/usage#sandboxed-google-play-limitations",
],
["/usage#google-camera", "/usage#pixel-camera"],

["/faq#dns", "/faq#custom-dns"],
["/faq#when-devices", "/faq#future-devices"],


["/features#usb-c-port-control", "/features#usb-c-port-and-pogo-pins-control"],
[
"/features#usb-c-port-control",
"/features#usb-c-port-and-pogo-pins-control",
],

["/hiring#qualitifations", "/hiring#qualifications"],

Expand Down Expand Up @@ -55,36 +63,65 @@ const redirects = new Map([
["/releases#blueline-beta", "/faq#legacy-devices"],

// legacy servers
["/articles/grapheneos-servers#apps.grapheneos.org", "/articles/grapheneos-servers#releases.grapheneos.org"],
["/articles/grapheneos-servers#time.grapheneos.org", "/articles/grapheneos-servers#grapheneos.network"],
[
"/articles/grapheneos-servers#apps.grapheneos.org",
"/articles/grapheneos-servers#releases.grapheneos.org",
],
[
"/articles/grapheneos-servers#time.grapheneos.org",
"/articles/grapheneos-servers#grapheneos.network",
],

// preserve links to CLI install guide from when it was /install
["/install/#prerequisites", "/install/cli#prerequisites"],
["/install/#enabling-oem-unlocking", "/install/cli#enabling-oem-unlocking"],
["/install/#opening-terminal", "/install/cli#opening-terminal"],
["/install/#obtaining-fastboot", "/install/cli#obtaining-fastboot"],
["/install/#standalone-platform-tools", "/install/cli#standalone-platform-tools"],
["/install/#checking-fastboot-version", "/install/cli#checking-fastboot-version"],
[
"/install/#standalone-platform-tools",
"/install/cli#standalone-platform-tools",
],
[
"/install/#checking-fastboot-version",
"/install/cli#checking-fastboot-version",
],
["/install/#fastboot-as-non-root", "/install/cli#flashing-as-non-root"],
["/install/#connecting-phone", "/install/cli#connecting-phone"],
["/install/#unlocking-the-bootloader", "/install/cli#unlocking-the-bootloader"],
[
"/install/#unlocking-the-bootloader",
"/install/cli#unlocking-the-bootloader",
],
["/install/#obtaining-signify", "/install/cli#obtaining-openssh"],
["/install/#obtaining-factory-images", "/install/cli#obtaining-factory-images"],
["/install/#flashing-factory-images", "/install/cli#flashing-factory-images"],
[
"/install/#obtaining-factory-images",
"/install/cli#obtaining-factory-images",
],
[
"/install/#flashing-factory-images",
"/install/cli#flashing-factory-images",
],
["/install/#troubleshooting", "/install/cli#troubleshooting"],
["/install/#locking-the-bootloader", "/install/cli#locking-the-bootloader"],
["/install/#post-installation", "/install/cli#post-installation"],
["/install/#booting", "/install/cli#booting"],
["/install/#disabling-oem-unlocking", "/install/cli#disabling-oem-unlocking"],
["/install/#replacing-grapheneos-with-the-stock-os", "/install/cli#replacing-grapheneos-with-the-stock-os"],
[
"/install/#disabling-oem-unlocking",
"/install/cli#disabling-oem-unlocking",
],
[
"/install/#replacing-grapheneos-with-the-stock-os",
"/install/cli#replacing-grapheneos-with-the-stock-os",
],
["/install/#further-information", "/install/cli#further-information"],
["/install/web#connecting-phone", "/install/web#connecting-device"],
["/install/cli#connecting-phone", "/install/cli#connecting-device"],
]);

function handleHash() {
if (window.location.hash) {
const redirect = redirects.get(window.location.pathname + window.location.hash);
const redirect = redirects.get(
window.location.pathname + window.location.hash,
);
if (redirect) {
window.location.replace(redirect);
}
Expand Down
78 changes: 54 additions & 24 deletions static/js/releases.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT

const baseUrl = "https://releases.grapheneos.org/";
const devices = ["comet", "komodo", "caiman", "tokay", "akita", "husky", "shiba", "felix", "tangorpro", "lynx", "cheetah", "panther", "bluejay", "raven", "oriole", "barbet", "redfin", "bramble", "sunfish", "coral", "flame"];
const devices = [
"comet",
"komodo",
"caiman",
"tokay",
"akita",
"husky",
"shiba",
"felix",
"tangorpro",
"lynx",
"cheetah",
"panther",
"bluejay",
"raven",
"oriole",
"barbet",
"redfin",
"bramble",
"sunfish",
"coral",
"flame",
];
const legacyFactoryDevices = new Set(["sunfish", "coral", "flame"]);
const channels = ["stable", "beta", "alpha"];
const delayMs = 1000 * 60 * 5;
Expand All @@ -11,29 +33,37 @@ async function updateReleases() {

for (const channel of channels) {
for (const device of devices) {
requests.push(fetch(`${baseUrl}${device}-${channel}`).then(response => {
if (!response.ok) {
return Promise.reject();
}
return response.text();
}).then(text => {
const metadata = text.trim().split(" ");

const factoryFormat = legacyFactoryDevices.has(device) ? "factory" : "install";
const factoryFilename = `${device}-${factoryFormat}-${metadata[0]}.zip`;
const factoryUrl = baseUrl + factoryFilename;

const updateFilename = `${device}-ota_update-${metadata[0]}.zip`;
const updateUrl = baseUrl + updateFilename;

const release = document.getElementById(`${device}-${channel}`);
const links = release.getElementsByTagName("a");

links[0].setAttribute("href", "#" + metadata[0]);
links[1].setAttribute("href", factoryUrl);
links[2].setAttribute("href", factoryUrl + ".sig");
links[3].setAttribute("href", updateUrl);
}));
requests.push(
fetch(`${baseUrl}${device}-${channel}`)
.then((response) => {
if (!response.ok) {
return Promise.reject();
}
return response.text();
})
.then((text) => {
const metadata = text.trim().split(" ");

const factoryFormat = legacyFactoryDevices.has(device)
? "factory"
: "install";
const factoryFilename = `${device}-${factoryFormat}-${metadata[0]}.zip`;
const factoryUrl = baseUrl + factoryFilename;

const updateFilename = `${device}-ota_update-${metadata[0]}.zip`;
const updateUrl = baseUrl + updateFilename;

const release = document.getElementById(
`${device}-${channel}`,
);
const links = release.getElementsByTagName("a");

links[0].setAttribute("href", "#" + metadata[0]);
links[1].setAttribute("href", factoryUrl);
links[2].setAttribute("href", factoryUrl + ".sig");
links[3].setAttribute("href", updateUrl);
}),
);
}
}

Expand Down
Loading

0 comments on commit 1735b9b

Please sign in to comment.