mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 09:51:36 +03:00
3a859ef585
link-server-hook exposes (parts of) the link-store over eyre, on the condition that the client is authenticated as the host ship. link-webext as committed is a very minimal web extension. When its toolbar button is clicked, it saves the current webpage to /private in the link-store. In the future, this should support choosing a target to save to, highlighting already-saved pages, and many other features.
21 lines
473 B
JavaScript
21 lines
473 B
JavaScript
// use synced storage if supported, fall back to local
|
|
const storage = browser.storage.sync || browser.storage.local;
|
|
|
|
const setEndpoint = (endpoint) => {
|
|
return storage.set({endpoint});
|
|
}
|
|
|
|
const getEndpoint = () => {
|
|
return new Promise((resolve, reject) => {
|
|
storage.get("endpoint").then((res) => {
|
|
if (res && res.endpoint) {
|
|
resolve(res.endpoint);
|
|
} else {
|
|
resolve(null);
|
|
}
|
|
}, (err) => {
|
|
resolve(null);
|
|
});
|
|
});
|
|
}
|