Browse Source

feat: add FE and docs

pull/153/head
Aldino Kemal 2 years ago
parent
commit
fb5dc87721
  1. 60
      docs/openapi.yaml
  2. 49
      readme.md
  3. 2
      src/config/settings.go
  4. 106
      src/views/components/MessageDelete.js
  5. 4
      src/views/index.html

60
docs/openapi.yaml

@ -1,7 +1,7 @@
openapi: 3.0.0
info:
title: WhatsApp API MultiDevice
version: 3.11.0
version: 4.0.0
description: This API is used for sending whatsapp via API
servers:
- url: http://localhost:3000
@ -200,7 +200,7 @@ paths:
summary: Send Message
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
@ -427,7 +427,7 @@ paths:
summary: Send Contact
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
@ -470,7 +470,7 @@ paths:
summary: Send Link
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
@ -513,7 +513,7 @@ paths:
summary: Send Location
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
@ -618,7 +618,49 @@ paths:
description: Message ID
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
phone:
type: string
example: '6289685024051@s.whatsapp.net'
description: Phone number with country code
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SendResponse'
'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'
/message/{message_id}/delete:
post:
operationId: deleteMessage
tags:
- message
summary: Delete Message
parameters:
- in: path
name: message_id
schema:
type: string
required: true
description: Message ID
requestBody:
content:
application/json:
schema:
type: object
properties:
@ -660,7 +702,7 @@ paths:
description: Message ID
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
@ -840,7 +882,7 @@ paths:
summary: Join group with link
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:
@ -874,7 +916,7 @@ paths:
summary: Leave group
requestBody:
content:
multipart/form-data:
application/json:
schema:
type: object
properties:

49
readme.md

@ -92,15 +92,18 @@ docker run --detach --publish=3000:3000 --name=whatsapp --restart=always --volum
You can fork or edit this source code !
### Current API
- [Api Specification Document](https://bump.sh/aldinokemal/doc/go-whatsapp-web-multidevice)
- You can check [docs/openapi.yml](./docs/openapi.yaml) for detail API or paste to [SwaggerEditor](https://editor.swagger.io).
- You can check [docs/openapi.yml](./docs/openapi.yaml) for detail API or paste
to [SwaggerEditor](https://editor.swagger.io).
- Furthermore you can generate HTTP Client from this API using [openapi-generator](https://openapi-generator.tech/#try)
| Feature | Menu | Method | URL |
|---------|------------------------------|--------|-----------------------------|
|---------|------------------------------|--------|-------------------------------|
| ✅ | Login | GET | /app/login |
| ✅ | Logout | GET | /app/logout |
| ✅ | Reconnect | GET | /app/reconnect |
| ✅ | Devices | GET | /app/devices |
| ✅ | User Info | GET | /user/info |
| ✅ | User Avatar | GET | /user/avatar |
| ✅ | User My Group List | GET | /user/my/groups |
@ -115,7 +118,8 @@ You can fork or edit this source code !
| ✅ | Send Location | POST | /send/location |
| ✅ | Send Poll / Vote | POST | /send/poll |
| ✅ | Revoke Message | POST | /message/:message_id/revoke |
| ✅ | React Message | POST | /message/:message_id/react |
| ✅ | React Message | POST | /message/:message_id/reaction |
| ✅ | Delete Message | POST | /message/:message_id/delete |
| ✅ | Edit Message | POST | /message/:message_id/update |
| ✅ | Join Group With Link | POST | /group/join-with-link |
| ✅ | Leave Group | POST | /group/leave |
@ -132,25 +136,26 @@ You can fork or edit this source code !
### App User Interface
1. Homepage ![Homepage](https://i.ibb.co/Wn3H1L9/homepage.png)
2. Login ![Login](https://i.ibb.co/jkcB15R/login.png?v=1)
3. Send Message ![Send Message](https://i.ibb.co/rc3NXMX/send-message.png?v1)
4. Send Image ![Send Image](https://i.ibb.co/BcFL3SD/send-image.png?v1)
5. Send File ![Send File](https://i.ibb.co/f4yxjpp/send-file.png)
6. Send Video ![Send Video](https://i.ibb.co/PrD3P51/send-video.png)
7. Send Contact ![Send Contact](https://i.ibb.co/4810H7N/send-contact.png)
8. Send Location ![Send Location](https://i.ibb.co/TWsy09G/send-location.png)
9. Send Audio ![Send Location](https://i.ibb.co/p1wL4wh/Send-Audio.png)
10. Send Poll ![Send Poll](https://i.ibb.co/mq2fGHz/send-poll.png)
11. Revoke Message ![Revoke Message](https://i.ibb.co/yswhvQY/revoke.png?v1)
12. Reaction Message ![Revoke Message](https://i.ibb.co/BfHgSHG/react-message.png)
13. Edit Message ![Edit Message](https://i.ibb.co/kXfpqJw/update-message.png)
14. User Info ![User Info](https://i.ibb.co/3zjX6Cz/user-info.png?v=1)
15. User Avatar ![User Avatar](https://i.ibb.co/ZmJZ4ZW/search-avatar.png?v=1)
16. My Privacy ![My Privacy](https://i.ibb.co/Cw1sMQz/my-privacy.png)
17. My Group ![My Group](https://i.ibb.co/WB268Xy/list-group.png)
18. Auto Reply ![Auto Reply](https://i.ibb.co/D4rTytX/IMG-20220517-162500.jpg)
19. Basic Auth Prompt ![Basic Auth](https://i.ibb.co/PDjQ92W/Screenshot-2022-11-06-at-14-06-29.png)
1. Homepage ![Homepage](https://i.ibb.co.com/Wn3H1L9/homepage.png)
2. Login ![Login](https://i.ibb.co.com/jkcB15R/login.png?v=1)
3. Send Message ![Send Message](https://i.ibb.co.com/rc3NXMX/send-message.png?v1)
4. Send Image ![Send Image](https://i.ibb.co.com/BcFL3SD/send-image.png?v1)
5. Send File ![Send File](https://i.ibb.co.com/f4yxjpp/send-file.png)
6. Send Video ![Send Video](https://i.ibb.co.com/PrD3P51/send-video.png)
7. Send Contact ![Send Contact](https://i.ibb.co.com/4810H7N/send-contact.png)
8. Send Location ![Send Location](https://i.ibb.co.com/TWsy09G/send-location.png)
9. Send Audio ![Send Location](https://i.ibb.co.com/p1wL4wh/Send-Audio.png)
10. Send Poll ![Send Poll](https://i.ibb.co.com/mq2fGHz/send-poll.png)
11. Revoke Message ![Revoke Message](https://i.ibb.co.com/yswhvQY/revoke.png?v1)
12. Delete Message ![Delete Message](https://i.ibb.co.com/F70SZ84/image.png)
13. Reaction Message ![Revoke Message](https://i.ibb.co.com/BfHgSHG/react-message.png)
14. Edit Message ![Edit Message](https://i.ibb.co.com/kXfpqJw/update-message.png)
15. User Info ![User Info](https://i.ibb.co.com/3zjX6Cz/user-info.png?v=1)
16. User Avatar ![User Avatar](https://i.ibb.co.com/ZmJZ4ZW/search-avatar.png?v=1)
17. My Privacy ![My Privacy](https://i.ibb.co.com/Cw1sMQz/my-privacy.png)
18. My Group ![My Group](https://i.ibb.co.com/WB268Xy/list-group.png)
19. Auto Reply ![Auto Reply](https://i.ibb.co.com/D4rTytX/IMG-20220517-162500.jpg)
20. Basic Auth Prompt ![Basic Auth](https://i.ibb.co.com/PDjQ92W/Screenshot-2022-11-06-at-14-06-29.png)
### Mac OS NOTE

2
src/config/settings.go

@ -5,7 +5,7 @@ import (
)
var (
AppVersion = "v4.13.0"
AppVersion = "v4.14.0"
AppPort = "3000"
AppDebug = false
AppOs = "AldinoKemal"

106
src/views/components/MessageDelete.js

@ -0,0 +1,106 @@
export default {
name: 'DeleteMessage',
data() {
return {
type: 'user',
phone: '',
message_id: '',
loading: false,
}
},
computed: {
phone_id() {
return this.type === 'user' ? `${this.phone}@${window.TYPEUSER}` : `${this.phone}@${window.TYPEGROUP}`
}
},
methods: {
openModal() {
$('#modalMessageDelete').modal({
onApprove: function () {
return false;
}
}).modal('show');
},
async handleSubmit() {
try {
let response = await this.submitApi()
showSuccessInfo(response)
$('#modalMessageDelete').modal('hide');
} catch (err) {
showErrorInfo(err)
}
},
async submitApi() {
this.loading = true;
try {
const payload = {phone: this.phone_id, message: this.new_message}
let response = await window.http.post(`/message/${this.message_id}/delete`, payload)
this.handleReset();
return response.data.message;
} catch (error) {
if (error.response) {
throw new Error(error.response.data.message);
}
throw new Error(error.message);
} finally {
this.loading = false;
}
},
handleReset() {
this.type = 'user';
this.phone = '';
this.message_id = '';
this.new_message = '';
this.loading = false;
},
},
template: `
<div class="red card" @click="openModal()" style="cursor: pointer">
<div class="content">
<a class="ui red right ribbon label">Message</a>
<div class="header">Delete Message</div>
<div class="description">
Delete your sent message
</div>
</div>
</div>
<!-- Modal MessageDelete -->
<div class="ui small modal" id="modalMessageDelete">
<i class="close icon"></i>
<div class="header">
Delete Message
</div>
<div class="content">
<form class="ui form">
<div class="field">
<label>Type</label>
<select name="type" v-model="type" aria-label="type">
<option value="group">Group Message</option>
<option value="user">Private Message</option>
</select>
</div>
<div class="field">
<label>Phone / Group ID</label>
<input v-model="phone" type="text" placeholder="6289..."
aria-label="phone">
<input :value="phone_id" disabled aria-label="whatsapp_id">
</div>
<div class="field">
<label>Message ID</label>
<input v-model="message_id" type="text" placeholder="Please enter your message id"
aria-label="message id">
</div>
</form>
</div>
<div class="actions">
<div class="ui approve positive right labeled icon button" :class="{'loading': this.loading}"
@click="handleSubmit">
Delete
<i class="send icon"></i>
</div>
</div>
</div>
`
}

4
src/views/index.html

@ -68,6 +68,7 @@
</div>
<div class="ui three column doubling grid cards">
<message-delete></message-delete>
<message-revoke></message-revoke>
<message-react></message-react>
<message-update></message-update>
@ -136,6 +137,7 @@
import SendLocation from "./components/SendLocation.js";
import SendAudio from "./components/SendAudio.js";
import SendPoll from "./components/SendPoll.js";
import MessageDelete from "./components/MessageDelete.js";
import MessageUpdate from "./components/MessageUpdate.js";
import MessageReact from "./components/MessageReact.js";
import MessageRevoke from "./components/MessageRevoke.js";
@ -170,7 +172,7 @@
components: {
AppLogin, AppLogout, AppReconnect,
SendMessage, SendImage, SendFile, SendVideo, SendContact, SendLocation, SendAudio, SendPoll,
MessageUpdate, MessageReact, MessageRevoke,
MessageDelete, MessageUpdate, MessageReact, MessageRevoke,
GroupList, GroupCreate, GroupJoinWithLink, GroupAddParticipants,
AccountAvatar, AccountUserInfo, AccountPrivacy
},

Loading…
Cancel
Save