Skip to content

Commit

Permalink
Merge pull request #37 from BC-SECURITY/dev
Browse files Browse the repository at this point in the history
1.2.4
  • Loading branch information
vinnybod authored Jul 5, 2020
2 parents b02c5c8 + fd1cb3c commit c0990d5
Show file tree
Hide file tree
Showing 15 changed files with 1,355 additions and 1,285 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-plusplus': 'off',
'import/no-cycle': 'off',
},
parserOptions: {
parser: 'babel-eslint',
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.2.4] - 2020-07-04
- Move external fonts (icons + google font) to internal dependencies to allow for offline use (https://github.com/BC-SECURITY/Starkiller/issues/34)
- Change title of login url field
- Make the use of http/https prefixes in the empire url optional. Will default to https if no prefix provided

## [1.2.3] - 2020-05-24
- Fix a bug that didn't allow 0 values when creating listeners, stagers
- Updated agent tab ui to have centered tabs
Expand Down Expand Up @@ -45,4 +50,4 @@ Including but not limited to:
- Axios dependency upgraded

## [1.0.0] - 2020-03-08
- Initial Release
- Initial Release
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starkiller",
"version": "1.2.3",
"version": "1.2.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand All @@ -19,17 +19,20 @@
},
"main": "background.js",
"dependencies": {
"@fortawesome/fontawesome-free": "^5.13.1",
"@mdi/font": "^5.3.45",
"axios": "0.18.1",
"chai-as-promised": "^7.1.1",
"core-js": "^3.4.4",
"electron-store": "^5.1.0",
"lodash.debounce": "^4.0.8",
"moment": "^2.24.0",
"semver": "^7.1.3",
"typeface-roboto": "^0.0.75",
"vue": "^2.6.10",
"vue-router": "^3.1.3",
"vue-splitpane": "^1.0.6",
"vuetify": "^2.2.22",
"vuetify": "2.2.34",
"vuetify-toast-snackbar": "^0.6.1",
"vuex": "^3.1.2",
"vuex-persistedstate": "^3.0.1"
Expand Down
3 changes: 0 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/@mdi/[email protected]/css/materialdesignicons.min.css" rel="stylesheet">
<link href="https://use.fontawesome.com/releases/v5.10.2/css/all.css" rel="stylesheet">
<title>starkiller</title>
</head>
<body>
Expand Down
9 changes: 6 additions & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export default {
},
computed: {
...mapGetters({
isLoggedIn: 'profile/isLoggedIn',
isDarkMode: 'profile/isDarkMode',
isLoggedIn: 'application/isLoggedIn',
isDarkMode: 'application/isDarkMode',
}),
...mapState({
empireVersion: state => state.profile.empireVersion,
empireVersion: state => state.application.empireVersion,
}),
isLoginPage() {
return this.$route.name === 'home';
Expand Down Expand Up @@ -106,6 +106,9 @@ export default {
<style lang="scss">
@import 'app.scss';
@import '../node_modules/@fortawesome/fontawesome-free/css/all.css';
@import '../node_modules/typeface-roboto/index.css';
#app {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
Expand Down
5 changes: 2 additions & 3 deletions src/api/axios-instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
import axios from 'axios';

// todo: I don't like this cyclic dependency, but struggling to find a better way atm.
// eslint-disable-next-line import/no-cycle
import store from '@/store/index';

// eslint-disable-next-line import/no-mutable-exports
export let axiosInstance = null;

export function setInstance(url, token) {
axiosInstance = axios.create({
baseURL: `https://${url}/api`,
baseURL: `${url}/api`,
headers: { 'Content-Type': 'application/json' },
params: {
token,
Expand All @@ -23,7 +22,7 @@ export function setInstance(url, token) {
response => response,
(err) => {
if (err.response.status === 401) {
store.dispatch('profile/logout');
store.dispatch('application/logout');
}
},
);
Expand Down
13 changes: 8 additions & 5 deletions src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
>
<v-text-field
v-model="form.url"
label="Name"
label="Url"
dense
outlined
/>
Expand Down Expand Up @@ -61,10 +61,10 @@ export default {
},
computed: {
...mapGetters({
isLoggedIn: 'profile/isLoggedIn',
isLoggedIn: 'application/isLoggedIn',
}),
...mapState({
loginError: state => state.profile.loginError,
loginError: state => state.application.loginError,
}),
},
watch: {
Expand All @@ -82,18 +82,21 @@ export default {
},
methods: {
submit() {
const cleanedUrl = (this.form.url.startsWith('http://') || this.form.url.startsWith('https://'))
? this.form.url
: `https://${this.form.url}`;
this.loading = true;
electronStore.set('rememberMe', this.rememberMe);
if (this.rememberMe === true) {
electronStore.set('url', this.form.url);
electronStore.set('url', cleanedUrl);
electronStore.set('username', this.form.username);
} else {
electronStore.delete('url');
electronStore.delete('username');
}
this.$store.dispatch('profile/login', this.form);
this.$store.dispatch('application/login', { url: cleanedUrl, username: this.form.username, password: this.form.password });
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/SideNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
two-line
>
<v-list-item-avatar>
<img src="https://raw.githubusercontent.com/BC-SECURITY/Starkiller/master/src/assets/icon.png">
<img src="../../src/assets/icon.png">
</v-list-item-avatar>

<v-list-item-content>
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/vuetify.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Vue from 'vue';
import Vuetify from 'vuetify';
import 'vuetify/dist/vuetify.min.css';
import colors from 'vuetify/lib/util/colors';
import 'vuetify/dist/vuetify.min.css';
import '@mdi/font/css/materialdesignicons.css';

// Migrating to Vuetify 2.3 will require some modifications to this $toast helper.
// https://github.com/eolant/vuetify-toast-snackbar/pull/44
import VuetifyToast from 'vuetify-toast-snackbar';

Vue.use(Vuetify);
Expand Down
4 changes: 2 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ const router = new VueRouter({
});

function isAuthenticated() {
return store.getters['profile/token'].length > 0;
return store.getters['application/token'].length > 0;
}

function isAdmin() {
return store.getters['profile/isAdmin'] === true;
return store.getters['application/isAdmin'] === true;
}

// Auth
Expand Down
8 changes: 4 additions & 4 deletions src/store/ProfileModule.js → src/store/ApplicationModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export default {
async login(context, { url, username, password }) {
try {
context.commit('setLoginError', '');
const token = await axios.post(`https://${url}/api/admin/login`,
const token = await axios.post(`${url}/api/admin/login`,
{ username, password },
{ headers: { 'Content-Type': 'application/json' } });

const user = await axios.get(`https://${url}/api/users/me?token=${token.data.token}`);
const version = await axios.get(`https://${url}/api/version?token=${token.data.token}`);
const user = await axios.get(`${url}/api/users/me?token=${token.data.token}`);
const version = await axios.get(`${url}/api/version?token=${token.data.token}`);
context.commit('setApplicationState', {
token: token.data.token, url, user: user.data, version: version.data.version,
});
Expand All @@ -62,7 +62,7 @@ export default {
}
},
async logout(context) {
axios.post(`https://${context.state.url}/api/admin/logout?token=${context.state.token}`);
axios.post(`${context.state.url}/api/admin/logout?token=${context.state.token}`);
context.commit('setLogout');
},
darkMode(context, val) {
Expand Down
11 changes: 5 additions & 6 deletions src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-cycle */
import Vue from 'vue';
import Vuex from 'vuex';

Expand All @@ -11,7 +10,7 @@ import StagerModule from './StagerModule';
import AgentModule from './AgentModule';
import ModuleModule from './ModuleModule';
import CredentialModule from './CredentialModule';
import ProfileModule from './ProfileModule';
import ApplicationModule from './ApplicationModule';


Vue.use(Vuex);
Expand All @@ -30,13 +29,13 @@ export default new Vuex.Store({
agent: AgentModule,
module: ModuleModule,
credential: CredentialModule,
profile: ProfileModule,
application: ApplicationModule,
},
plugins: [createPersistedState({
paths: ['profile'],
paths: ['application'],
rehydrated: ({ state }) => { // todo handle code duplication here?
setInstance(state.profile.url, state.profile.token);
initNamespacedStore(state.profile.url);
setInstance(state.application.url, state.application.token);
initNamespacedStore(state.application.url);
},
})],
});
8 changes: 4 additions & 4 deletions src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ export default {
},
computed: {
...mapState({
user: state => state.profile.user,
darkMode: state => state.profile.darkMode,
user: state => state.application.user,
darkMode: state => state.application.darkMode,
}),
apiToken() {
return this.user.api_token;
Expand All @@ -123,7 +123,7 @@ export default {
},
darkModeSwitch: {
set(val) {
this.$store.dispatch('profile/darkMode', val);
this.$store.dispatch('application/darkMode', val);
},
get() {
return this.darkMode;
Expand All @@ -137,7 +137,7 @@ export default {
},
async logout() {
if (await this.$root.$confirm('', 'Are you sure you want to logout?', { color: 'green' })) {
this.$store.dispatch('profile/logout');
this.$store.dispatch('application/logout');
}
},
submit() {
Expand Down
2 changes: 1 addition & 1 deletion src/views/Users.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default {
users: state => state.user.users,
}),
...mapGetters({
isAdmin: 'profile/isAdmin',
isAdmin: 'application/isAdmin',
}),
},
mounted() {
Expand Down
Loading

0 comments on commit c0990d5

Please sign in to comment.