Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
whatsappweb
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mauro Paolo Josue Zuñiga Mallqui
whatsappweb
Commits
1ca0d994
Commit
1ca0d994
authored
8 months ago
by
Mauro Paolo Josue Zuñiga Mallqui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ADD] AVANCES
parent
29d3aef0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
6 deletions
+27
-6
Dockerfile
Dockerfile
+2
-2
WhatsappRest.java
src/main/java/sacooliveros/whatsappweb/api/WhatsappRest.java
+4
-2
MVCConfig.java
src/main/java/sacooliveros/whatsappweb/config/MVCConfig.java
+17
-0
application.properties
src/main/resources/application.properties
+4
-2
No files found.
Dockerfile
View file @
1ca0d994
FROM
openjdk:21
ARG
JAR_FILE=target/*.war
COPY
${JAR_FILE} app.war
ENTRYPOINT
["java","-jar","/app.war"]
\ No newline at end of file
ENTRYPOINT
["java","-jar","app.war"]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/sacooliveros/whatsappweb/api/WhatsappRest.java
View file @
1ca0d994
...
...
@@ -35,7 +35,7 @@ public class WhatsappRest {
}
@GetMapping
(
"qr"
)
public
ResponseEntity
<?>
getQR
()
{
public
ResponseEntity
<?>
getQR
()
throws
ExecutionException
,
InterruptedException
,
TimeoutException
{
Whatsapp
w
=
whatsappBean
.
getWhatsapp
();
WhatsappUtils
utils
=
new
WhatsappUtils
();
...
...
@@ -43,6 +43,7 @@ public class WhatsappRest {
return
ResponseEntity
.
status
(
Response
.
SC_OK
).
body
(
utils
.
generateQR
());
}
w
.
connect
().
get
(
5
,
TimeUnit
.
SECONDS
);
if
(
w
.
isConnected
())
{
return
ResponseEntity
.
status
(
Response
.
SC_OK
).
body
(
"Already connected"
);
}
...
...
@@ -85,7 +86,8 @@ public class WhatsappRest {
return
ResponseEntity
.
status
(
Response
.
SC_OK
).
body
(
"Not connected"
);
}
try
{
w
.
connect
().
get
(
10
,
TimeUnit
.
SECONDS
);
w
.
reconnect
().
get
(
5
,
TimeUnit
.
SECONDS
);
System
.
out
.
println
(
w
.
store
().
about
());
if
(
w
.
isConnected
())
{
whatsappService
.
send
(
payload
,
files
,
w
);
return
ResponseEntity
.
status
(
Response
.
SC_OK
).
body
(
payload
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/sacooliveros/whatsappweb/config/MVCConfig.java
0 → 100644
View file @
1ca0d994
package
sacooliveros
.
whatsappweb
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.lang.NonNull
;
import
org.springframework.web.servlet.config.annotation.CorsRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
@Configuration
public
class
MVCConfig
implements
WebMvcConfigurer
{
@Override
public
void
addCorsMappings
(
@NonNull
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/**"
)
.
allowedMethods
(
"HEAD"
,
"GET"
,
"PUT"
,
"POST"
,
"DELETE"
,
"PATCH"
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/application.properties
View file @
1ca0d994
spring.application.name
=
whatsappweb
server.port
=
8083
\ No newline at end of file
#server.address=127.0.0.1
server.port
=
8082
server.address
=
0.0.0.0
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment