Skip to content

Commit

Permalink
Deploying to gh-pages from @ cef2cc4 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf4ood committed Sep 26, 2024
0 parents commit 2508e85
Show file tree
Hide file tree
Showing 4 changed files with 380 additions and 0 deletions.
245 changes: 245 additions & 0 deletions artifacts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
/* Code modified from the blender website
* https://www.blender.org/wp-content/themes/bthree/assets/js/get_os.js?x82196
*/

let options = {
windows64: "x86_64-pc-windows",
windows32: "i686-pc-windows",
windowsArm: "aarch64-pc-windows",

mac64: "x86_64-apple",
mac32: "i686-apple",
macSilicon: "aarch64-apple",

linux64: "x86_64-unknown-linux",
linux32: "i686-unknown-linux",
linuxArm: "aarch64-unknown-linux",

// ios: "ios",
// android: "linux-android",
// freebsd: "freebsd",
};

function isAppleSilicon() {
try {
var glcontext = document.createElement("canvas").getContext("webgl");
var debugrenderer = glcontext
? glcontext.getExtension("WEBGL_debug_renderer_info")
: null;
var renderername =
(debugrenderer &&
glcontext.getParameter(debugrenderer.UNMASKED_RENDERER_WEBGL)) ||
"";
if (renderername.match(/Apple M/) || renderername.match(/Apple GPU/)) {
return true;
}

return false;
} catch (e) {}
}

function getOS() {
var OS = options.windows64.default;
var userAgent = navigator.userAgent;
var platform = navigator.platform;

if (navigator.appVersion.includes("Win")) {
if (
!userAgent.includes("Windows NT 5.0") &&
!userAgent.includes("Windows NT 5.1") &&
(userAgent.indexOf("Win64") > -1 ||
platform == "Win64" ||
userAgent.indexOf("x86_64") > -1 ||
userAgent.indexOf("x86_64") > -1 ||
userAgent.indexOf("amd64") > -1 ||
userAgent.indexOf("AMD64") > -1 ||
userAgent.indexOf("WOW64") > -1)
) {
OS = options.windows64;
} else {
if (
window.external &&
window.external.getHostEnvironmentValue &&
window.external
.getHostEnvironmentValue("os-architecture")
.includes("ARM64")
) {
OS = options.windowsArm;
} else {
try {
var canvas = document.createElement("canvas");
var gl = canvas.getContext("webgl");

var debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
if (renderer.includes("Qualcomm")) OS = options.windowsArm;
} catch (e) {}
}
}
}

//MacOS, MacOS X, macOS
if (navigator.appVersion.includes("Mac")) {
if (
navigator.userAgent.includes("OS X 10.5") ||
navigator.userAgent.includes("OS X 10.6")
) {
OS = options.mac32;
} else {
OS = options.mac64;

const isSilicon = isAppleSilicon();
if (isSilicon) {
OS = options.macSilicon;
}
}
}

// linux
if (platform.includes("Linux")) {
OS = options.linux64;
// FIXME: Can we find out whether linux 32-bit or ARM are used?
}

// if (
// userAgent.includes("iPad") ||
// userAgent.includes("iPhone") ||
// userAgent.includes("iPod")
// ) {
// OS = options.ios;
// }
// if (platform.toLocaleLowerCase().includes("freebsd")) {
// OS = options.freebsd;
// }

return OS;
}

let os = getOS();
window.os = os;

// Unhide and hydrate selector with events
const archSelect = document.querySelector(".arch-select");
if (archSelect) {
archSelect.classList.remove("hidden");
const selector = document.querySelector("#install-arch-select");
if (selector) {
selector.addEventListener("change", onArchChange);
}
}

// Hydrate tab buttons with events
Array.from(document.querySelectorAll(".install-tab[data-id]")).forEach((tab) => {
tab.addEventListener("click", onTabClick);
});

function onArchChange(evt) {
// Get target
const target = evt.currentTarget.value;
// Find corresponding installer lists
const newContentEl = document.querySelector(`.arch[data-arch=${target}]`);
const oldContentEl = document.querySelector(`.arch[data-arch]:not(.hidden)`);
// Hide old content element (if applicable)
if (oldContentEl) {
oldContentEl.classList.add("hidden");
}
// Show new content element
newContentEl.classList.remove("hidden");
// Show the first tab's content if nothing was selected before
if (newContentEl.querySelectorAll(".install-tab.selected").length === 0) {
const firstContentChild = newContentEl.querySelector(".install-content:first-of-type");
const firstTabChild = newContentEl.querySelector(".install-tab:first-of-type");
firstContentChild.classList.remove("hidden");
if (firstTabChild) {
firstTabChild.classList.add("selected");
}
}
// Hide "no OS detected" message
const noDetectEl = document.querySelector(".no-autodetect");
noDetectEl.classList.add("hidden");
// Hide Mac hint
document.querySelector(".mac-switch").classList.add("hidden");
}

function onTabClick(evt) {
// Get target and ID
const {triple, id} = evt.currentTarget.dataset;
if (triple) {
// Find corresponding content elements
const newContentEl = document.querySelector(`.install-content[data-id="${String(id)}"][data-triple=${triple}]`);
const oldContentEl = document.querySelector(`.install-content[data-triple=${triple}][data-id]:not(.hidden)`);
// Find old tab to unselect
const oldTabEl = document.querySelector(`.install-tab[data-triple=${triple}].selected`);
// Hide old content element
if (oldContentEl && oldTabEl) {
oldContentEl.classList.add("hidden");
oldTabEl.classList.remove("selected");
}

// Unhide new content element
newContentEl.classList.remove("hidden");
// Select new tab element
evt.currentTarget.classList.add("selected");
}
}

const allPlatforms = Array.from(document.querySelectorAll(`.arch[data-arch]`));
let hit = allPlatforms.find(
(a) => {
// Show Intel Mac downloads if no M1 Mac downloads are available
if (
a.attributes["data-arch"].value.includes(options.mac64) &&
os.includes(options.macSilicon) &&
!allPlatforms.find(p => p.attributes["data-arch"].value.includes(options.macSilicon))) {
// Unhide hint
document.querySelector(".mac-switch").classList.remove("hidden");
return true;
}
return a.attributes["data-arch"].value.includes(os);
}
);

if (hit) {
hit.classList.remove("hidden");
const selectEl = document.querySelector("#install-arch-select");
selectEl.value = hit.dataset.arch;
const firstContentChild = hit.querySelector(".install-content:first-of-type");
const firstTabChild = hit.querySelector(".install-tab:first-of-type");
firstContentChild.classList.remove("hidden");
if (firstTabChild) {
firstTabChild.classList.add("selected");
}
} else {
const noDetectEl = document.querySelector(".no-autodetect");
if (noDetectEl) {
const noDetectElDetails = document.querySelector(".no-autodetect-details");
if (noDetectElDetails) {
noDetectElDetails.innerHTML = `We detected you're on ${os} but there don't seem to be installers for that. `
}
noDetectEl.classList.remove("hidden");
}
}

let copyButtons = Array.from(document.querySelectorAll("[data-copy]"));
if (copyButtons.length) {
copyButtons.forEach(function (element) {
element.addEventListener("click", () => {
navigator.clipboard.writeText(element.attributes["data-copy"].value);
});
});
}

// Toggle for pre releases
const checkbox = document.getElementById("show-prereleases");

if (checkbox) {
checkbox.addEventListener("click", () => {
const all = document.getElementsByClassName("pre-release");

if (all) {
for (var item of all) {
item.classList.toggle("hidden");
}
}
});
}
Binary file added favicon.ico
Binary file not shown.
132 changes: 132 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
<!DOCTYPE html>
<html lang="en" id="oranda" class="hacker">
<head>
<title>edc-rs</title>


<link rel="icon" href="/edc-rs/favicon.ico" />

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<meta property="og:type" content="website" />
<meta property="og:title" content="edc-rs" />



<meta http-equiv="Permissions-Policy" content="interest-cohort=()" />
<link rel="stylesheet" href="/edc-rs/oranda-v0.6.1.css" />


</head>
<body>
<div class="container">
<div class="page-body">


<main>
<header>

<h1 class="title">edc-rs</h1>

</header>




<div class="oranda-hide">
<h1>EDC-rs</h1>
</div>
<div>
<strong>
Rust client and tools for <a href="https://github.com/eclipse-edc/Connector" rel="noopener noreferrer">EDC</a>.
</strong>
</div>
<br>
<div>
<a href="https://github.com/dataspace-rs/edc-rs?query=workflow%3ATests" rel="noopener noreferrer">
<img src="https://github.com/dataspace-rs/edc-rs/workflows/Tests/badge.svg" alt="Tests status">
</a>
<a href="https://crates.io/crates/edc-connector-client" rel="noopener noreferrer">
<img src="https://img.shields.io/crates/d/edc-connector-client.svg?style=flat-square" alt="Download">
</a>
<a href="https://docs.rs/edc-connector-client" rel="noopener noreferrer">
<img src="https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square" alt="docs.rs docs">
</a>
<a href="https://opensource.org/licenses/Apache-2.0" rel="noopener noreferrer">
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="license">
</a>
<a href="https://deps.rs/repo/github/dataspace-rs/edc-rs" rel="noopener noreferrer">
<img src="https://deps.rs/repo/github/dataspace-rs/edc-rs/status.svg" alt="license">
</a>
</div>
<h2>edc-connector-client</h2>
<p>A Rust client for <a href="https://github.com/eclipse-edc/Connector" rel="noopener noreferrer">EDC</a>.</p>
<h3>Installation</h3>
<p>Install from <a href="https://crates.io/" rel="noopener noreferrer">crates.io</a></p>
<pre style="background-color:#263238;"><span style="color:#89ddff;">[dependencies]
</span><span style="color:#f07178;">edc-connector-client </span><span style="color:#89ddff;">= "</span><span style="color:#c3e88d;">0.1</span><span style="color:#89ddff;">"
</span></pre>

<h3>Examples</h3>
<h4>Basic usage</h4>
<p>Fetching an asset with id <code>1</code> and reading the <code>description</code> property as string.</p>
<pre style="background-color:#263238;"><span style="color:#c792ea;">use </span><span style="color:#eeffff;">edc_connector_client</span><span style="color:#89ddff;">::{</span><span style="color:#eeffff;">Auth</span><span style="color:#89ddff;">,</span><span style="color:#eeffff;"> EdcConnectorClient</span><span style="color:#89ddff;">};
</span><span style="color:#eeffff;">
</span><span style="color:#89ddff;">#[</span><span style="color:#eeffff;">tokio::main</span><span style="color:#89ddff;">]
</span><span style="color:#eeffff;">async </span><span style="font-style:italic;color:#c792ea;">fn </span><span style="color:#82aaff;">main</span><span style="color:#89ddff;">() -&gt; </span><span style="color:#eeffff;">Result</span><span style="color:#89ddff;">&lt;()</span><span style="color:#eeffff;">, Box</span><span style="color:#89ddff;">&lt;</span><span style="color:#eeffff;">dyn std</span><span style="color:#89ddff;">::</span><span style="color:#eeffff;">error</span><span style="color:#89ddff;">::</span><span style="color:#eeffff;">Error</span><span style="color:#89ddff;">&gt;&gt; {
</span><span style="color:#eeffff;"> </span><span style="font-style:italic;color:#c792ea;">let</span><span style="color:#eeffff;"> client </span><span style="color:#89ddff;">= </span><span style="color:#eeffff;">EdcConnectorClient</span><span style="color:#89ddff;">::</span><span style="color:#eeffff;">builder</span><span style="color:#89ddff;">()
</span><span style="color:#eeffff;"> .</span><span style="color:#82aaff;">management_url</span><span style="color:#89ddff;">("</span><span style="color:#c3e88d;">http://myedc</span><span style="color:#89ddff;">")
</span><span style="color:#eeffff;"> .</span><span style="color:#82aaff;">with_auth</span><span style="color:#89ddff;">(</span><span style="color:#eeffff;">Auth</span><span style="color:#89ddff;">::</span><span style="color:#eeffff;">api_token</span><span style="color:#89ddff;">("</span><span style="color:#c3e88d;">password</span><span style="color:#89ddff;">"))
</span><span style="color:#eeffff;"> .</span><span style="color:#82aaff;">build</span><span style="color:#89ddff;">()?;
</span><span style="color:#eeffff;">
</span><span style="color:#eeffff;"> </span><span style="font-style:italic;color:#c792ea;">let</span><span style="color:#eeffff;"> asset </span><span style="color:#89ddff;">=</span><span style="color:#eeffff;"> client.</span><span style="color:#82aaff;">assets</span><span style="color:#89ddff;">()</span><span style="color:#eeffff;">.</span><span style="color:#82aaff;">get</span><span style="color:#89ddff;">("</span><span style="color:#c3e88d;">1</span><span style="color:#89ddff;">")</span><span style="color:#eeffff;">.await</span><span style="color:#89ddff;">?;
</span><span style="color:#eeffff;">
</span><span style="color:#eeffff;"> println!</span><span style="color:#89ddff;">("</span><span style="color:#c3e88d;">Got </span><span style="color:#eeffff;">{:?}</span><span style="color:#89ddff;">",</span><span style="color:#eeffff;"> asset</span><span style="color:#89ddff;">);
</span><span style="color:#eeffff;">
</span><span style="color:#eeffff;"> println!</span><span style="color:#89ddff;">(
</span><span style="color:#eeffff;"> </span><span style="color:#89ddff;">"</span><span style="color:#c3e88d;">Property description: </span><span style="color:#eeffff;">{:?}</span><span style="color:#89ddff;">",
</span><span style="color:#eeffff;"> asset.property</span><span style="color:#89ddff;">::&lt;</span><span style="color:#eeffff;">String</span><span style="color:#89ddff;">&gt;("</span><span style="color:#c3e88d;">description</span><span style="color:#89ddff;">")</span><span style="color:#eeffff;">.</span><span style="color:#82aaff;">unwrap</span><span style="color:#89ddff;">()
</span><span style="color:#eeffff;"> </span><span style="color:#89ddff;">);
</span><span style="color:#eeffff;">
</span><span style="color:#eeffff;"> </span><span style="color:#ffcb6b;">Ok</span><span style="color:#89ddff;">(())
</span><span style="color:#89ddff;">}
</span></pre>

<h3>Development</h3>
<h4>Compiling</h4>
<pre style="background-color:#263238;"><span style="color:#eeffff;">git clone https://github.com/dataspace-rs/edc-rs.git
</span><span style="color:#eeffff;">cd edc-rs
</span><span style="color:#eeffff;">cargo build
</span></pre>

<h4>Testing</h4>
<p>Some tests run against a running instance of EDC.</p>
<p>You can use docker compose to start an instance for testing.</p>
<pre style="background-color:#263238;"><span style="color:#eeffff;">docker compose -f testing/docker-compose.yml up -d
</span><span style="color:#eeffff;">cargo test
</span></pre>

<p>The tests setup was mostly derived by the Typescript client <a href="https://github.com/Think-iT-Labs/edc-connector-client" rel="noopener noreferrer">edc-connector-client</a></p>



</main>
</div>

<footer>

<span>
edc-rs
</span>
</footer>
</div>







</body>
</html>
3 changes: 3 additions & 0 deletions oranda-v0.6.1.css

Large diffs are not rendered by default.

0 comments on commit 2508e85

Please sign in to comment.