Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use API v2 in web client #1153

Merged
merged 24 commits into from
Nov 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
basic ui
  • Loading branch information
RomainMaillot committed Oct 23, 2022
commit 89868bcc52fb0186383f638459c2f51c8f355926
3,082 changes: 2,543 additions & 539 deletions web/client/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"vue": "2.6.12",
"vue-class-component": "7.2.6",
"vue-json-viewer": "^2.2.22",
"vue-phone-number-input": "^1.12.13",
"vue-property-decorator": "9.1.2",
"vue-router": "3.5.1",
"vue-tel-input-vuetify": "^1.5.3",
"vuex": "3.6.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export default {
appName: "PhoneInfoga",
appDescription:
"Advanced information gathering & OSINT tool for phone numbers",
apiUrl: "http://localhost:3000/api", // /api
apiUrl: "/api",
};
6 changes: 6 additions & 0 deletions web/client/src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Vue from "vue";
import VueRouter from "vue-router";
import Scan from "../views/Scan.vue";
import Number from "../views/Number.vue";
import NotFound from "../views/NotFound.vue";

Vue.use(VueRouter);
Expand All @@ -11,6 +12,11 @@ const routes = [
name: "Scan",
component: Scan,
},
{
path: "/numbers/:number",
name: "Number",
component: Number,
},
{
path: "*",
name: "NotFound",
Expand Down
1 change: 1 addition & 0 deletions web/client/src/shims-vue.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ declare module "*.vue" {
export default Vue;
}
declare module "vue-json-viewer" {}
declare module "vue-phone-number-input" {}
101 changes: 101 additions & 0 deletions web/client/src/views/Number.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<template>
<div>
<b-container v-if="isLookup" class="border p-4 mb-3">
<h3 class="text-center">Local</h3>
<b-container>
<b-row v-for="(value, name) in localData" :key="name" align-v="center">
<h5 class="text-capitalize m-0 mr-4">{{ name }}:</h5>
<p class="m-0">{{ value }}</p>
</b-row>
</b-container>
</b-container>

<b-container v-if="isLookup" class="border p-4">
<h3 class="text-center">Scanners</h3>
<Scanner name="GoogleSearch" scanId="googlesearch" />
<Scanner name="Numverify Scan" scanId="numverify" />
<Scanner name="OVH Telecom scan" scanId="ovh" />
</b-container>
</div>
</template>

<script lang="ts">
import Vue from "vue";
import { mapMutations, mapState } from "vuex";
import { formatNumber, isValid } from "../utils";
import Scanner from "../components/Scanner.vue";
import axios, { AxiosResponse } from "axios";
import config from "@/config";

interface Data {
loading: boolean;
isLookup: boolean;
localData: {
raw_local: string;
local: string;
e164: string;
international: string;
country_code: string;
country: string;
};
}

export type ScanResponse<T> = AxiosResponse<{
success: boolean;
result: T;
error: string;
}>;

export default Vue.extend({
components: { Scanner },
computed: {
...mapState(["number"]),
...mapMutations(["pushError"]),
},
data(): Data {
return {
loading: false,
isLookup: false,
localData: {
raw_local: "",
local: "",
e164: "",
international: "",
country_code: "",
country: "",
},
};
},
mounted() {
this.runScans();
},
methods: {
async runScans(): Promise<void> {
if (!isValid(this.$route.params.number)) {
this.$store.commit("pushError", { message: "Number is not valid." });
return;
}

this.loading = true;

this.$store.commit("setNumber", formatNumber(this.$route.params.number));

try {
const res = await axios.get(
`${config.apiUrl}/numbers/${this.$store.state.number}/scan/local`,
{
validateStatus: () => true,
}
);

this.localData = res.data.result;
} catch (error) {
this.$store.commit("pushError", { message: error });
}

this.isLookup = true;
this.loading = false;
},
},
});
</script>
72 changes: 43 additions & 29 deletions web/client/src/views/Scan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,40 @@
label-for="input-1"
description="Only accepts E164 and International formats as input."
>
<b-form-input
id="input-number"
v-model="inputNumber"
type="text"
required
placeholder="e.g: 33678132393"
:disabled="loading"
></b-form-input>
<b-input-group>
<!-- <b-form-input
id="input-number"
v-model="inputNumber"
type="text"
required
placeholder="e.g: 33678132393"
:disabled="loading"
></b-form-input> -->
<VuePhoneNumberInput
v-model="inputNumberVal"
:disabled="loading"
@update="updateInputNumber"
/>
<b-button
size="sm"
variant="dark"
v-on:click="runScans"
:disabled="loading"
>
<b-icon-play-fill></b-icon-play-fill>
Lookup
</b-button>

<b-button
variant="light"
size="sm"
v-on:click="clearData"
v-show="number"
:disabled="loading"
>Reset
</b-button>
</b-input-group>
</b-form-group>

<b-button
size="sm"
variant="dark"
v-on:click="runScans"
:disabled="loading"
class="m-1"
>
<b-icon-play-fill></b-icon-play-fill>
Lookup
</b-button>

<b-button
variant="light"
size="sm"
v-on:click="clearData"
v-show="number"
:disabled="loading"
>Reset
</b-button>
</b-form>

<hr />
Expand Down Expand Up @@ -68,6 +73,7 @@
import Vue from "vue";
import { mapMutations, mapState } from "vuex";
import { formatNumber, isValid } from "../utils";
import VuePhoneNumberInput from "vue-phone-number-input";
import Scanner from "../components/Scanner.vue";
// import LocalScan from "../components/LocalScan.vue";
// import NumverifyScan from "../components/NumverifyScan.vue";
Expand All @@ -80,6 +86,7 @@ interface Data {
loading: boolean;
isLookup: boolean;
inputNumber: string;
inputNumberVal: string;
scanEvent: Vue;
localData: {
raw_local: string;
Expand All @@ -98,7 +105,7 @@ export type ScanResponse<T> = AxiosResponse<{
}>;

export default Vue.extend({
components: { Scanner },
components: { Scanner, VuePhoneNumberInput },
computed: {
...mapState(["number"]),
...mapMutations(["pushError"]),
Expand All @@ -108,6 +115,7 @@ export default Vue.extend({
loading: false,
isLookup: false,
inputNumber: "",
inputNumberVal: "",
scanEvent: new Vue(),
localData: {
raw_local: "",
Expand Down Expand Up @@ -159,6 +167,12 @@ export default Vue.extend({
onSubmit(evt: Event) {
evt.preventDefault();
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
updateInputNumber(val: any) {
sundowndev marked this conversation as resolved.
Show resolved Hide resolved
this.inputNumber = val.e164;
},
},
});
</script>

<style src="vue-phone-number-input/dist/vue-phone-number-input.css"></style>
Loading