Skip to content

Commit

Permalink
Fix secret
Browse files Browse the repository at this point in the history
  • Loading branch information
cesxhin committed Jun 17, 2023
1 parent 23f28de commit 935df60
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ example:
NUXT_PUBLIC_WEB_BASE: "http://localhost:33333" #http://localhost:3000 [default]

#--- AUTH ---
NUXT_SECRET: "secret" #animemanga [default]
NUXT_PUBLIC_SECRET: "secret" #animemanga [default]
```
4 changes: 2 additions & 2 deletions src/composables/useAuth.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function useAuth(){
});

try{
const token = cry.AES.encrypt(JSON.stringify(data), config.secret).toString();
const token = cry.AES.encrypt(JSON.stringify(data), config.public.secret).toString();
auth.value = token;
}catch(err){
console.log(err);
Expand All @@ -39,7 +39,7 @@ export default function useAuth(){
});

if(!isNil(token.value))
return JSON.parse(cry.AES.decrypt(token.value, config.secret).toString(cry.enc.Utf8));
return JSON.parse(cry.AES.decrypt(token.value, config.public.secret).toString(cry.enc.Utf8));
else
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions src/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ export default defineNuxtConfig({
},
runtimeConfig:{
apiBase: process.env.API_BASE || 'http://localhost:5000',
secret: 'animemanga',

public: {
socketBase: process.env.SOCKET_BASE || 'ws://localhost:1234/room',
httpBase: process.env.HTTP_BASE || 'http://localhost:5002',
basePath: process.env.BASE_PATH || '/public',
webBase: process.env.WEB_BASE || 'http://localhost:3000'
webBase: process.env.WEB_BASE || 'http://localhost:3000',
secret: 'animemanga',
}

},
Expand Down
26 changes: 14 additions & 12 deletions src/stores/useStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ export const useStore = defineStore('store', {
return state.schemas;
},
getSchemasBySelectSearch(state){
const key = state.currentSelectSearch.split("-")[1];

for (const index in state.schemas) {

let name = _.get(state.schemas[index], 'name');
let type = _.get(state.schemas[index], 'type');
if(name === key)
{
return {
nameCfg: index,
type
};
if(!isNil(state.currentSelectSearch)){
const key = state.currentSelectSearch.split("-")[1];

for (const index in state.schemas) {

let name = _.get(state.schemas[index], 'name');
let type = _.get(state.schemas[index], 'type');
if(name === key)
{
return {
nameCfg: index,
type
};
}
}
}
return null;
Expand Down

0 comments on commit 935df60

Please sign in to comment.