Compare commits
10 Commits
83ae6b44f0
...
a7620d9d35
Author | SHA1 | Date |
---|---|---|
Gabriel | a7620d9d35 | 2 years ago |
Gabriel | 35d9611fdd | 2 years ago |
Gabriel | 0adb7561d9 | 2 years ago |
Gabriel | 559ad1fecb | 2 years ago |
Gabriel | 521619df38 | 2 years ago |
Gabriel | 4f512480ea | 2 years ago |
Gabriel | 8a121f00a4 | 2 years ago |
Gabriel | 50b1fa78f6 | 2 years ago |
Gabriel | a16c9c87e6 | 2 years ago |
Gabriel | 2b85654732 | 2 years ago |
@ -1,23 +0,0 @@
|
||||
function fetchback(url,cback){
|
||||
fetch(url).then((request)=>request.json()).then((data)=>cback(data));
|
||||
}
|
||||
|
||||
function interverse_data(url,cback){
|
||||
url = interverse_proxy+"/initial?url="+url
|
||||
fetch(url).then((response)=> {
|
||||
if (!response.ok){
|
||||
return {}
|
||||
}
|
||||
return response.json();
|
||||
}).then((data)=>cback(data))
|
||||
|
||||
}
|
||||
|
||||
// https://davidwalsh.name/query-string-javascript
|
||||
function getUrlParameter(name) {
|
||||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
||||
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
||||
var results = regex.exec(location.search);
|
||||
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
|
||||
};
|
||||
|
@ -0,0 +1,4 @@
|
||||
# Client
|
||||
|
||||
You can simply serve the client with `python -m http.sever` in this folder.
|
||||
|
@ -0,0 +1,33 @@
|
||||
# Getting started
|
||||
|
||||
## Create your interverse file
|
||||
|
||||
This file is essentially your 'listing'.
|
||||
|
||||
1. Grab the [example file](../interverse-example.json) or modify the [Libre Solutions Network](https://libresolutions.network/.well-known/interverse) one.
|
||||
2. Make your changes, feel free to reference the [format](readme.md)
|
||||
3. Ensure that the file is formatted as valid [JSON](https://www.json.org/json-en.html).
|
||||
Any errors will fail completely.
|
||||
|
||||
## Getting online
|
||||
|
||||
### Option A (ideal)
|
||||
* You must serve valid JSON from `/.well-known/interverse`
|
||||
* The header `access-control-allow-origin *` must also be [added](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
|
||||
|
||||
### Option B (simple)
|
||||
* Serve valid JSON from either:
|
||||
|
||||
* `/.well-known/interverse`
|
||||
* `/interverse.json`
|
||||
|
||||
Omitting the CORS header means that the client needs to ask a server to load the data, this can have performance impacts.
|
||||
|
||||
## How do I see my listing?
|
||||
|
||||
Interverse is a fully-decentralized system. You can [setup your instance]() or preview yourself at `https://libresolutions.network/interverse?url={your.domain}`.
|
||||
|
||||
*Note: libresolutions.network uses a fairly long cache value when no results are returned.*
|
||||
If you want to see your changes reflected immediately, consider adding the CORS header.
|
||||
|
||||
You can also run your own [instance](instance.md)
|
@ -0,0 +1,20 @@
|
||||
# Running your own instance
|
||||
|
||||
The reference instance is running at [libresolutions.network](https://libresolutions.network/interverse)
|
||||
|
||||
If all your connections are adding the [CORS header](getting-started.md) all you need is to serve the content of [Client/index.html](../Client/index.html) from your page.
|
||||
|
||||
That file is written so that it can be easily pasted into an existing page, or used as a hugo shortcode.
|
||||
|
||||
|
||||
Known instances:
|
||||
|
||||
* [jamespearson.xyz](https://jamespearson.xyz/interverse/)
|
||||
|
||||
|
||||
## interverse-proxy
|
||||
|
||||
For compatibility with [Discover](https://codeberg.org/onasaft/Discover) or for displaying previews of sites not serving the CORS header you'll want to setup the [server](../Server/)
|
||||
|
||||
### Can I create my own client/Server?
|
||||
**Please do!**
|
@ -0,0 +1,26 @@
|
||||
# Interverse-proxy
|
||||
|
||||
A very simple flask server that caches interverse requests
|
||||
|
||||
## Endpoints:
|
||||
Both require an `url` parameter
|
||||
`example.com` for example
|
||||
|
||||
`/inital`
|
||||
|
||||
Returns the data from a specified site.
|
||||
Searches the following locations:
|
||||
|
||||
* `/.well-known/interverse`
|
||||
* `/interverse.json`
|
||||
* `/.well-known/discover.json` (for [Discover](https://codeberg.org/onasaft/Discover) compatibility)
|
||||
|
||||
Has to change `preview_connections` into `connection_groups`
|
||||
|
||||
`/complete`
|
||||
|
||||
Returns initial in the `main` object then connection data in the `connections` object
|
||||
|
||||
## Running
|
||||
|
||||
The server can be run with [uwsgi](https://uwsgi-docs.readthedocs.io/en/latest/) with `start.sh`
|
Binary file not shown.
After Width: | Height: | Size: 1.6 MiB |
Binary file not shown.
Loading…
Reference in New Issue