Browse Source

fix: remove unused generic, adjusted css from modal close, adjusted new route

pull/231/head
Ruan 1 year ago
parent
commit
8dff0d9887
  1. 70
      docs/openapi.yaml
  2. 2
      readme.md
  3. 2
      src/config/settings.go
  4. 11
      src/go.sum
  5. 7
      src/views/assets/app.css
  6. 72
      src/views/components/AccountUserCheck.js
  7. 50
      src/views/components/generic/FormCheckUserRecipient.js

70
docs/openapi.yaml

@ -1,7 +1,7 @@
openapi: "3.0.0"
info:
title: WhatsApp API MultiDevice
version: 5.1.0
version: 5.1.2
description: This API is used for sending whatsapp via API
servers:
- url: http://localhost:3000
@ -153,6 +153,38 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ErrorInternalServer'
/user/check:
get:
operationId: userCheck
tags:
- user
summary: Check user is on whatsapp
parameters:
- name: phone
in: query
schema:
type: string
example: '6289685028129@s.whatsapp.net'
description: Phone number with country code
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UserCheckResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorBadRequest'
'500':
description: Internal Server Error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorInternalServer'
/user/avatar:
get:
operationId: userAvatar
@ -1229,6 +1261,10 @@ paths:
$ref: '#/components/schemas/ErrorInternalServer'
components:
securitySchemes:
basicAuth: # <-- arbitrary name for the security scheme
type: http
scheme: basic
schemas:
CreateGroupResponse:
type: object
@ -1370,6 +1406,34 @@ components:
AD:
type: boolean
example: true
UserCheckResponse:
type: object
required:
- code
- message
- results
properties:
code:
type: string
example: SUCCESS
message:
type: string
example: Success
results:
type: object
properties:
is_in_whatsapp:
type: boolean
example: true
jid:
type: string
example: 554887954@s.whatsapp.net
verified_name:
type: string
example: Aldino Kemal
query:
type: string
example: 5549887954@s.whatsapp.net
UserAvatarResponse:
type: object
properties:
@ -1768,4 +1832,6 @@ components:
example: 0
AddRequest:
type: string
example: null
example: null
security:
- basicAuth: []

2
readme.md

@ -205,7 +205,7 @@ You can fork or edit this source code !
| Reaction Message | ![Reaction Message](https://i.ibb.co.com/fNqJXF0/react-Message.png) |
| Edit Message | ![Edit Message](https://i.ibb.co.com/Vx5cQMg/update-Message.png) |
| User Info | ![User Info](https://i.ibb.co.com/qd7J7Nd/Search-User-Info.png) |
| Check User | ![Check User ](https://i.ibb.co/92gVZrx/Check-User.png?v=1) |
| Check User | ![Check User ](https://i.ibb.co/jkHpRF4y/Check-User.png) |
| User Avatar | ![User Avatar](https://i.ibb.co.com/zbSzpP3/Search-Avatar.png) |
| My Privacy | ![My Privacy](https://i.ibb.co.com/HCLxGHr/My-Privacy.png) |
| My Group | ![My Group](https://i.ibb.co.com/p19dFQ5/list-Group.png) |

2
src/config/settings.go

@ -5,7 +5,7 @@ import (
)
var (
AppVersion = "v5.1.0"
AppVersion = "v5.1.2"
AppPort = "3000"
AppDebug = false
AppOs = "AldinoKemal"

11
src/go.sum

@ -79,7 +79,6 @@ github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
@ -101,10 +100,6 @@ go.mau.fi/libsignal v0.1.1 h1:m/0PGBh4QKP/I1MQ44ti4C0fMbLMuHb95cmDw01FIpI=
go.mau.fi/libsignal v0.1.1/go.mod h1:QLs89F/OA3ThdSL2Wz2p+o+fi8uuQUz0e1BRa6ExdBw=
go.mau.fi/util v0.8.4 h1:mVKlJcXWfVo8ZW3f4vqtjGpqtZqJvX4ETekxawt2vnQ=
go.mau.fi/util v0.8.4/go.mod h1:MOfGTs1CBuK6ERTcSL4lb5YU7/ujz09eOPVEDckuazY=
go.mau.fi/whatsmeow v0.0.0-20250104105216-918c879fcd19 h1:uVS+Zct5fF8rSXV9lfs87zoXdge0JXTzVGNkjmZ61UU=
go.mau.fi/whatsmeow v0.0.0-20250104105216-918c879fcd19/go.mod h1:TLzm2XkwgufONEmiVAsFny+9uBqyEZnUoPrQAfMyuSU=
go.mau.fi/whatsmeow v0.0.0-20250130221717-faf72d668860 h1:jQhAJJGC42rwZ562nz6V9SXBCVz+QhORusd0r9cxiww=
go.mau.fi/whatsmeow v0.0.0-20250130221717-faf72d668860/go.mod h1:PG1x7fBW66I9q/e8a9mU2qF9M94+kK32MceMWgxBoiw=
go.mau.fi/whatsmeow v0.0.0-20250204095649-a75587ab11d7 h1:eLT0TKTpSeNcszoyasSylaxFCNU82XCP72DjbInFpzg=
go.mau.fi/whatsmeow v0.0.0-20250204095649-a75587ab11d7/go.mod h1:PG1x7fBW66I9q/e8a9mU2qF9M94+kK32MceMWgxBoiw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@ -116,8 +111,6 @@ golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ss
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68=
golang.org/x/image v0.23.0/go.mod h1:wJJBTdLfCCf3tiHa1fNxpZmUI4mmoZvwMCPP0ddoNKY=
golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ=
golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@ -157,8 +150,6 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
@ -186,8 +177,6 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.3 h1:82DV7MYdb8anAVi3qge1wSnMDrnKK7ebr+I0hHRN1BU=
google.golang.org/protobuf v1.36.3/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

7
src/views/assets/app.css

@ -83,6 +83,8 @@ body {
to { transform: rotate(360deg); }
}
.main-header .ui.header {
position: relative;
z-index: 2;
@ -268,6 +270,11 @@ body {
padding: 1.5em !important;
}
.ui.modal > .close {
top: 0.5rem;
right: 0.5rem;
}
.ui.modal > .actions {
border-radius: 0 0 20px 20px !important;
background-color: rgba(248, 248, 248, 0.8) !important;

72
src/views/components/AccountUserCheck.js

@ -1,10 +1,5 @@
import FormCheckUserRecipient from "./generic/FormCheckUserRecipient.js";
export default {
name: 'AccountUserCheck',
components: {
FormCheckUserRecipient
},
data() {
return {
type: window.TYPEUSER,
@ -26,14 +21,28 @@ export default {
}
},
methods: {
async openModal() {
this.handleReset();
$('#modalUserCheck').modal('show');
openModal() {
$('#modalUserCheck').modal({
onApprove: function () {
return false;
}
}).modal('show');
},
isValidForm() {
if (!this.phone.trim()) {
return false;
}
return true;
},
async handleSubmit() {
if (!this.isValidForm() || this.loading) {
return;
}
try {
await this.submitApi();
showSuccessInfo("Info fetched")
const response = await this.submitApi();
showSuccessInfo(response);
} catch (err) {
showErrorInfo(err)
}
@ -71,8 +80,9 @@ export default {
}
},
template: `
<div class="green card" @click="openModal" style="cursor: pointer;">
<div class="green card" @click="openModal()" style="cursor: pointer;">
<div class="content">
<a class="ui olive right ribbon label">Account</a>
<div class="header">User Check</div>
<div class="description">
You can check if the user exists on whatapp
@ -81,7 +91,7 @@ export default {
</div>
<!-- Modal UserInfo -->
<!-- Modal UserCheck -->
<div class="ui small modal" id="modalUserCheck">
<i class="close icon"></i>
<div class="header">
@ -89,28 +99,38 @@ export default {
</div>
<div class="content">
<form class="ui form">
<FormCheckUserRecipient v-model:type="type" v-model:phone="phone"/>
<div class="field">
<label>Phone</label>
<input v-model="phone" type="text"
placeholder="Type your phone number"
aria-label="Phone">
<input :value="phone_id" disabled aria-label="whatsapp_id">
</div>
<button type="button" class="ui primary button" :class="{'loading': loading}"
@click="handleSubmit">
Search
</button>
</form>
</div>
<div class="actions">
<button class="ui approve positive right labeled icon button"
:class="{'disabled': !isValidForm() || loading}"
@click.prevent="handleSubmit">
Search
<i class="search icon"></i>
</button>
</div>
<div v-if="is_in_whatsapp != null" class="center">
<div v-if="is_in_whatsapp != null" class="center">
<ol>
<li>Name: {{ verified_name }}</li>
<li>JID: {{ jid }}</li>
</ol>
</div>
<div v-else class="center">
<div v-if="code == 'INVALID_JID'" class="center">
<ol>
<li>Name: {{ verified_name }}</li>
<li>JID: {{ jid }}</li>
</ol>
</div>
<div v-else class="center">
<div v-if="code == 'INVALID_JID'" class="center">
<ol>
<li>Name: {{ verified_name }}</li>
<li>JID: {{ jid }}</li>
</ol>
</div>
</div>
</div>
</div>
`

50
src/views/components/generic/FormCheckUserRecipient.js

@ -1,50 +0,0 @@
export default {
name: 'FormCheckUserRecipient',
props: {
type: {
type: String,
required: true
},
phone: {
type: String,
required: true
},
},
data() {
return {
recipientTypes: []
};
},
computed: {
phone_id() {
return this.phone + this.type;
}
},
mounted() {
this.recipientTypes = [
{ value: window.TYPEUSER, text: 'Private Message' },
];
},
methods: {
updateType(event) {
this.$emit('update:type', event.target.value);
},
updatePhone(event) {
this.$emit('update:phone', event.target.value);
}
},
template: `
<div class="field">
<label>Type</label>
<select name="type" @change="updateType" class="ui dropdown">
<option v-for="type in recipientTypes" :value="type.value">{{ type.text }}</option>
</select>
</div>
<div class="field">
<label>Phone</label>
<input :value="phone" aria-label="wa identifier" @input="updatePhone">
<input :value="phone_id" disabled aria-label="whatsapp_id">
</div>
`
}
Loading…
Cancel
Save