Skip to content

Commit 52c087a

Browse files
gideonairexCMCDragonkai
authored andcommitted
chore: use hash mode
1 parent cdc5e85 commit 52c087a

File tree

5 files changed

+164
-146
lines changed

5 files changed

+164
-146
lines changed

src/renderer/components/configuration/Configuration.vue

Lines changed: 76 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -78,75 +78,85 @@
7878
</template>
7979

8080
<script lang="ts">
81-
import { Component, Vue, Prop } from 'vue-property-decorator';
82-
import { namespace } from 'vuex-class';
83-
import { polykeyClient } from '@/store';
84-
import { getConfiguration } from '@/store/modules/Configuration';
81+
import { defineComponent } from 'vue'
8582
86-
const configuration = namespace('Configuration');
87-
88-
const namingRule = name =>
89-
/^\b[\w]+(?:['-]?[\w]+)*\b$/.test(name) || !name || 'Name must only contain letters, numbers and hyphens';
90-
91-
@Component({})
92-
export default class Configuration extends Vue {
93-
@configuration.State
94-
public activeNodePath!: string;
95-
96-
@configuration.State
97-
public nodePathList!: string[];
98-
99-
@configuration.Action
100-
public loadNodePathList!: () => Promise<void>;
101-
102-
public valid: boolean = false;
103-
public secretName = '';
104-
public secretNameRules = [namingRule];
105-
public secretContent = '';
106-
selectedVaultIndex = 0
107-
108-
newKeyNode() {
109-
this.$router.push('Configuration/NewKeyNode')
110-
}
111-
112-
validate(): boolean {
113-
return (<any>this.$refs.newVaultForm).validate();
114-
}
115-
reset() {
116-
(<any>this.$refs.newVaultForm).reset();
117-
}
118-
resetValidation() {
119-
this.reset();
120-
}
121-
async newSecret() {
122-
if (this.validate()) {
123-
// const successful = await polykeyClient.createSecret(
124-
// getConfiguration().activeNodePath,
125-
// this.selectedVaultName,
126-
// this.secretName,
127-
// Buffer.from(this.secretContent),
128-
// );
129-
// console.log(successful);
130-
// if (successful) {
131-
// this.$router.back();
132-
// }
133-
} else {
134-
alert('Please address errors');
83+
export default defineComponent({
84+
setup () {
85+
return {
86+
newKeyNode: () => {},
87+
deleteVault: () => {}
13588
}
13689
}
137-
138-
cancel() {
139-
this.$router.back();
140-
}
141-
142-
constructor() {
143-
super()
144-
this.loadNodePathList().then(() => {
145-
console.log(this.nodePathList);
146-
147-
})
148-
}
149-
}
90+
})
91+
// import { Component, Vue, Prop } from 'vue-property-decorator';
92+
// import { namespace } from 'vuex-class';
93+
// import { polykeyClient } from '@/store';
94+
// import { getConfiguration } from '@/store/modules/Configuration';
95+
96+
// const configuration = namespace('Configuration');
97+
98+
// const namingRule = name =>
99+
// /^\b[\w]+(?:['-]?[\w]+)*\b$/.test(name) || !name || 'Name must only contain letters, numbers and hyphens';
100+
101+
// @Component({})
102+
// export default class Configuration extends Vue {
103+
// @configuration.State
104+
// public activeNodePath!: string;
105+
106+
// @configuration.State
107+
// public nodePathList!: string[];
108+
109+
// @configuration.Action
110+
// public loadNodePathList!: () => Promise<void>;
111+
112+
// public valid: boolean = false;
113+
// public secretName = '';
114+
// public secretNameRules = [namingRule];
115+
// public secretContent = '';
116+
// selectedVaultIndex = 0
117+
118+
// newKeyNode() {
119+
// this.$router.push('Configuration/NewKeyNode')
120+
// }
121+
122+
// validate(): boolean {
123+
// return (<any>this.$refs.newVaultForm).validate();
124+
// }
125+
// reset() {
126+
// (<any>this.$refs.newVaultForm).reset();
127+
// }
128+
// resetValidation() {
129+
// this.reset();
130+
// }
131+
// async newSecret() {
132+
// if (this.validate()) {
133+
// // const successful = await polykeyClient.createSecret(
134+
// // getConfiguration().activeNodePath,
135+
// // this.selectedVaultName,
136+
// // this.secretName,
137+
// // Buffer.from(this.secretContent),
138+
// // );
139+
// // console.log(successful);
140+
// // if (successful) {
141+
// // this.$router.back();
142+
// // }
143+
// } else {
144+
// alert('Please address errors');
145+
// }
146+
// }
147+
148+
// cancel() {
149+
// this.$router.back();
150+
// }
151+
152+
// constructor() {
153+
// super()
154+
// this.loadNodePathList().then(() => {
155+
// console.log(this.nodePathList);
156+
157+
// })
158+
// }
159+
// }
150160
</script>
151161

152162
<style scoped>

src/renderer/components/configuration/NewKeyNode.vue

Lines changed: 72 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -72,77 +72,86 @@
7272
</template>
7373

7474
<script lang="ts">
75-
import path from 'path';
76-
import { namespace } from 'vuex-class';
77-
import { polykeyClient } from '@/store';
78-
import { Component, Vue, Prop } from 'vue-property-decorator';
79-
import { getConfiguration } from '@/store/modules/Configuration';
80-
// const remote = window.require('electron').remote;
81-
// const { app, dialog, getCurrentWindow } = remote;
82-
// const fs = remote.require('fs');
75+
import { defineComponent } from 'vue'
8376
84-
const alert = namespace('Alert');
77+
export default defineComponent({
78+
setup () {
79+
return {
80+
openFileDialog: () => {}
81+
}
82+
}
83+
})
84+
// import path from 'path';
85+
// import { namespace } from 'vuex-class';
86+
// import { polykeyClient } from '@/store';
87+
// import { Component, Vue, Prop } from 'vue-property-decorator';
88+
// import { getConfiguration } from '@/store/modules/Configuration';
89+
// // const remote = window.require('electron').remote;
90+
// // const { app, dialog, getCurrentWindow } = remote;
91+
// // const fs = remote.require('fs');
8592
86-
// const namingRule = name =>
87-
// /^\b[\w]+(?:['-]?[\w]+)*\b$/.test(name) || !name || 'Name must only contain letters, numbers and hyphens';
88-
const emailRule = email =>
89-
/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test(
90-
email,
91-
) ||
92-
!email ||
93-
'Email is invalid';
93+
// const alert = namespace('Alert');
9494
95-
@Component({})
96-
export default class NewSecret extends Vue {
97-
@alert.Action
98-
public toggleAlert!: (props: { visible: boolean; message?: string }) => void;
95+
// // const namingRule = name =>
96+
// // /^\b[\w]+(?:['-]?[\w]+)*\b$/.test(name) || !name || 'Name must only contain letters, numbers and hyphens';
97+
// const emailRule = email =>
98+
// /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.test(
99+
// email,
100+
// ) ||
101+
// !email ||
102+
// 'Email is invalid';
99103
100-
valid = false;
101-
fullName = '';
102-
nameRules = [];
103-
email = '';
104-
emailRules = [emailRule];
105-
passphrase = '';
106-
// passphraseRules = [passphrase => passphrase || 'Passphrase is required'];
107-
passphraseRules = [];
104+
// @Component({})
105+
// export default class NewSecret extends Vue {
106+
// @alert.Action
107+
// public toggleAlert!: (props: { visible: boolean; message?: string }) => void;
108108
109-
// nodePath: string = path.join(app.getPath('home'), '.polykey');
110-
// nodePathRules = [
111-
// path => !fs.existsSync(path) || fs.readdirSync(path).length == 0 || 'Path already exists and is not empty',
112-
// ];
109+
// valid = false;
110+
// fullName = '';
111+
// nameRules = [];
112+
// email = '';
113+
// emailRules = [emailRule];
114+
// passphrase = '';
115+
// // passphraseRules = [passphrase => passphrase || 'Passphrase is required'];
116+
// passphraseRules = [];
113117
114-
validate(): boolean {
115-
return (<any>this.$refs.newKeyNodeForm).validate();
116-
}
117-
reset() {
118-
(<any>this.$refs.newKeyNodeForm).reset();
119-
}
120-
resetValidation() {
121-
this.reset();
122-
}
123-
async newKeyNode() {
124-
// TODO: remove this as you no longer have to create a node
125-
}
118+
// // nodePath: string = path.join(app.getPath('home'), '.polykey');
119+
// // nodePathRules = [
120+
// // path => !fs.existsSync(path) || fs.readdirSync(path).length == 0 || 'Path already exists and is not empty',
121+
// // ];
126122
127-
cancel() {
128-
this.$router.back();
129-
}
123+
// validate(): boolean {
124+
// return (<any>this.$refs.newKeyNodeForm).validate();
125+
// }
126+
// reset() {
127+
// (<any>this.$refs.newKeyNodeForm).reset();
128+
// }
129+
// resetValidation() {
130+
// this.reset();
131+
// }
132+
// async newKeyNode() {
133+
// // TODO: remove this as you no longer have to create a node
134+
// }
130135
131-
async openFileDialog() {
132-
//Synchronous
133-
// const result = await dialog.showOpenDialog(getCurrentWindow(), {
134-
// title: 'Select New Key Node Location',
135-
// defaultPath: this.nodePath,
136-
// buttonLabel: 'Select',
137-
// properties: ['openDirectory', 'createDirectory', 'showHiddenFiles', 'promptToCreate'],
138-
// });
139-
// if (!result.canceled) {
140-
// this.nodePath = result.filePaths[0];
141-
// }
142-
// console.log(result.bookmarks);
143-
// console.log(result.filePaths);
144-
}
145-
}
136+
// cancel() {
137+
// this.$router.back();
138+
// }
139+
140+
// async openFileDialog() {
141+
// //Synchronous
142+
// // const result = await dialog.showOpenDialog(getCurrentWindow(), {
143+
// // title: 'Select New Key Node Location',
144+
// // defaultPath: this.nodePath,
145+
// // buttonLabel: 'Select',
146+
// // properties: ['openDirectory', 'createDirectory', 'showHiddenFiles', 'promptToCreate'],
147+
// // });
148+
// // if (!result.canceled) {
149+
// // this.nodePath = result.filePaths[0];
150+
// // }
151+
// // console.log(result.bookmarks);
152+
// // console.log(result.filePaths);
153+
// }
154+
// }
146155
</script>
147156

148157
<style scoped>

src/renderer/components/navigation/Drawer.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<NavigationButton faIcon="lock" route="/Vaults" />
1111
<NavigationButton faIcon="users" route="/Social" />
1212
<NavigationButton faIcon="key" route="/Keys" />
13-
<NavigationButton faIcon="share-alt-square" route="/Sharing" />
13+
<NavigationButton faIcon="key" route="/Configuration" />
1414
</ui-nav>
1515
</ui-drawer-content>
1616
</ui-drawer>

src/renderer/components/navigation/NavigationButton.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<ui-nav-item href="javascript:void(0)" active @click="goToRoute(route)"><router-link to="/">{{route}}</router-link></ui-nav-item>
2+
<ui-nav-item href="javascript:void(0)" active @click="goToRoute(route)">{{route}}</ui-nav-item>
33
</template>
44

55
<script lang="ts">
@@ -14,7 +14,6 @@ export default defineComponent({
1414
const router = useRouter()
1515
return {
1616
goToRoute: route => {
17-
console.log(route)
1817
router.push(route)
1918
},
2019
faIcon,

src/renderer/router/index.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
createRouter,
3-
createWebHistory,
3+
createWebHashHistory,
44
RouteRecordRaw
55
} from 'vue-router'
66
import Vaults from '@/components/vaults/Vaults.vue'
@@ -13,8 +13,8 @@ import Social from '@/components/social/Social.vue'
1313
import Keys from '@/components/keys/Keys.vue'
1414
import NewKey from '@/components/keys/NewKey.vue'
1515

16-
// import Configuration from '@/components/configuration/Configuration.vue'
17-
// import NewKeyNode from '@/components/configuration/NewKeyNode.vue'
16+
import Configuration from '@/components/configuration/Configuration.vue'
17+
import NewKeyNode from '@/components/configuration/NewKeyNode.vue'
1818

1919
const routes: Array<RouteRecordRaw> = [
2020
// Vaults
@@ -49,19 +49,19 @@ const routes: Array<RouteRecordRaw> = [
4949
path: '/Keys/NewKey',
5050
component: NewKey
5151
},
52-
// // Configuration
53-
// {
54-
// path: '/Configuration',
55-
// component: Configuration
56-
// },
57-
// {
58-
// path: '/Configuration/NewKeyNode',
59-
// component: NewKeyNode
60-
// },
61-
];
52+
// Configuration
53+
{
54+
path: '/Configuration',
55+
component: Configuration
56+
},
57+
{
58+
path: '/Configuration/NewKeyNode',
59+
component: NewKeyNode
60+
}
61+
]
6262

6363
const router = createRouter({
64-
history: createWebHistory(),
64+
history: createWebHashHistory(),
6565
routes
6666
})
6767

0 commit comments

Comments
 (0)