This commit is contained in:
j3d1 2023-05-28 21:05:22 +02:00
parent 3774a2f438
commit fda9f8e70f
5 changed files with 7 additions and 4 deletions

File diff suppressed because one or more lines are too long

View file

@ -48,6 +48,7 @@
<script> <script>
import {mapGetters, mapMutations} from 'vuex'; import {mapGetters, mapMutations} from 'vuex';
import * as BIcons from "bootstrap-icons-vue"; import * as BIcons from "bootstrap-icons-vue";
import moment from 'moment';
export default { export default {
name: 'Notifications', name: 'Notifications',

View file

@ -235,7 +235,7 @@ class ServerSet {
method: 'PUT', method: 'PUT',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
...auth.buildAuthHeader(url) ...auth.buildAuthHeader(url, data)
}, },
credentials: 'omit', credentials: 'omit',
body: JSON.stringify(data) body: JSON.stringify(data)
@ -351,6 +351,7 @@ function createSignAuth(username, signKey) {
return new authMethod(({signKey, username}, {url, data}) => { return new authMethod(({signKey, username}, {url, data}) => {
const json = JSON.stringify(data) const json = JSON.stringify(data)
const signature = nacl.crypto_sign_detached(nacl.encode_utf8(url + (data ? json : "")), signKey) const signature = nacl.crypto_sign_detached(nacl.encode_utf8(url + (data ? json : "")), signKey)
console.log('sign', nacl.to_hex(signature), url, json)
return {'Authorization': 'Signature ' + username + ':' + nacl.to_hex(signature)} return {'Authorization': 'Signature ' + username + ':' + nacl.to_hex(signature)}
}, context) }, context)
} }

View file

@ -172,6 +172,10 @@ export default createStore({
commit('setInventoryItems', {url: '/', items}) commit('setInventoryItems', {url: '/', items})
return items return items
}, },
async searchInventories({state, dispatch, getters}, {query}) {
const servers = await dispatch('getAllFriendsServers')
return await servers.get(getters.signAuth, '/api/inventory/search/?q=' + query)
},
async createInventoryItem({state, dispatch, getters}, item) { async createInventoryItem({state, dispatch, getters}, item) {
const servers = await dispatch('getHomeServers') const servers = await dispatch('getHomeServers')
const data = {availability_policy: 'private', ...item} const data = {availability_policy: 'private', ...item}

View file

@ -3,7 +3,6 @@ import {fileURLToPath, URL} from 'node:url'
import {defineConfig} from 'vite' import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
resolve: { resolve: {