mirror of
https://codeberg.org/Hyperpipe/Hyperpipe
synced 2025-06-28 13:08:01 +02:00
feat: option to restore settings via url
This commit is contained in:
parent
d1ff3d681b
commit
1b678b032c
4 changed files with 101 additions and 5 deletions
|
@ -24,7 +24,8 @@ const { t, setupLocale } = useI18n(),
|
|||
next = ref(false),
|
||||
compact = ref(false),
|
||||
prm = ref(false),
|
||||
cc = ref(false);
|
||||
cc = ref(false),
|
||||
restoreUrl = ref('');
|
||||
|
||||
getJson('https://piped-instances.kavin.rocks')
|
||||
.then(i => i || getJson('https://instances.tokhmi.xyz'))
|
||||
|
@ -40,6 +41,16 @@ getJson('https://raw.codeberg.page/Hyperpipe/pages/api/backend.json').then(
|
|||
},
|
||||
);
|
||||
|
||||
const getRestoreUrl = () => {
|
||||
const params = new URLSearchParams();
|
||||
Object.keys(window.localStorage).forEach(key => {
|
||||
params.set(key, window.localStorage.getItem(key));
|
||||
});
|
||||
restoreUrl.value = window.location.origin + '/restore/?' + params;
|
||||
};
|
||||
|
||||
getRestoreUrl();
|
||||
|
||||
function getBool(val) {
|
||||
return 'bi ' + (val ? 'bi-check2' : 'bi-x-lg');
|
||||
}
|
||||
|
@ -362,6 +373,9 @@ onMounted(() => {
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<h2>{{ t('title.restore_prefs') }}</h2>
|
||||
<a :href="restoreUrl">{{ restoreUrl }}</a>
|
||||
|
||||
<footer>
|
||||
{{ date }}
|
||||
<a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue