Skip to content

Commit 93c648c

Browse files
committed
dependency upgrades
1 parent a72fd20 commit 93c648c

File tree

6 files changed

+28
-32
lines changed

6 files changed

+28
-32
lines changed

demo/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"start": "next start"
99
},
1010
"dependencies": {
11-
"axios": "^0.21.0",
12-
"next": "10.0.3",
13-
"react": "17.0.1",
14-
"react-dom": "17.0.1"
11+
"axios": "^0.21.1",
12+
"next": "^11.0.0",
13+
"react": "^17.0.2",
14+
"react-dom": "^17.0.2"
1515
}
1616
}

demo/pages/index.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ import Head from "next/head";
22
import { useEffect, useState } from "react";
33
import axios from "axios";
44

5-
//const CDN_URL = "REPLACE_WITH_YOUR_CDN_URL";
6-
7-
const CDN_URL = "https://zeaque-dev.ams3.digitaloceanspaces.com/files/";
85
const Gallery = () => {
96
const [loading, setLoading] = useState(true);
107
const [images, setImages] = useState([]);
118
const [progress, setProgress] = useState(0);
129

10+
const SERVER_URL = process.env.NEXT_PUBLIC_SERVER_URL;
11+
1312
useEffect(() => {
1413
loadImages();
1514
}, []);
1615

1716
const loadImages = () => {
1817
setLoading(true);
1918
axios
20-
.get("http://localhost:8080/get/images")
19+
.get(`${SERVER_URL}/get/images`)
2120
.then((response) => {
2221
setImages(response.data);
2322
setLoading(false);
@@ -30,7 +29,7 @@ const Gallery = () => {
3029
const deleteImage = (id) => {
3130
setLoading(true);
3231
axios
33-
.delete("http://localhost:8080/delete/image/" + id)
32+
.delete(`${SERVER_URL}/delete/image/${id}`)
3433
.then((response) => {
3534
loadImages();
3635
})
@@ -44,17 +43,13 @@ const Gallery = () => {
4443
formData.append("image", image);
4544
let config = {
4645
onUploadProgress: (progressEvent) => {
47-
console.log(
48-
"progress event:: ",
49-
Math.round((progressEvent.loaded * 100) / progressEvent.total)
50-
);
5146
setProgress(
5247
Math.round((progressEvent.loaded * 100) / progressEvent.total)
5348
);
5449
},
5550
};
5651
axios
57-
.put("http://localhost:8080/save/image", formData, config)
52+
.put(`${SERVER_URL}/save/image`, formData, config)
5853
.then((response) => {
5954
loadImages();
6055
setProgress(0);
@@ -141,7 +136,7 @@ const Gallery = () => {
141136
/>
142137
</button>
143138
<img
144-
src={`${CDN_URL}${image.name}.${image.ext}`}
139+
src={`${process.env.NEXT_PUBLIC_DO_SPACES_URL}/files/${image.name}.${image.ext}`}
145140
alt={image.name}
146141
className="image"
147142
/>

src/main/java/io/thepro/dospaces/configs/DoConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class DoConfig {
2626
private String doSpaceRegion;
2727

2828
@Bean
29-
public AmazonS3 getCredentials() {
29+
public AmazonS3 getS3() {
3030
BasicAWSCredentials creds = new BasicAWSCredentials(doSpaceKey, doSpaceSecret);
3131
return AmazonS3ClientBuilder.standard()
3232
.withEndpointConfiguration(new EndpointConfiguration(doSpaceEndpoint, doSpaceRegion))
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package io.thepro.dospaces.repositories;
22

3-
import org.springframework.data.repository.CrudRepository;
3+
import org.springframework.data.repository.PagingAndSortingRepository;
44
import org.springframework.stereotype.Repository;
55

66
import io.thepro.dospaces.entities.Image;
77

88
@Repository
9-
public interface ImageRepository extends CrudRepository<Image, Long>{
9+
public interface ImageRepository extends PagingAndSortingRepository<Image, Long>{
1010

1111
}

src/main/java/io/thepro/dospaces/services/ImageStorageServiceImpl.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,18 @@
2424
@Service
2525
public class ImageStorageServiceImpl implements ImageStorageService {
2626

27+
@Autowired
28+
ImageRepository imageRepo;
29+
30+
@Autowired
31+
AmazonS3 s3Client;
32+
33+
2734
@Value("${do.space.bucket}")
2835
private String doSpaceBucket;
2936

3037
String FOLDER = "files/";
3138

32-
@Autowired
33-
AmazonS3 s3Client;
34-
35-
@Autowired
36-
ImageRepository imageRepo;
37-
3839
@Override
3940
public void saveFile(MultipartFile multipartFile) throws IOException {
4041
String extension = FilenameUtils.getExtension(multipartFile.getOriginalFilename());

src/main/resources/application.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
## DO properties
12
do:
23
spaces:
3-
access:
4-
key: ${DO_SPACE_KEY}
5-
secret: ${DO_SPACE_SECRET}
6-
endpoint: ${DO_SPACE_ENDPOINT}
7-
region: ${DO_SPACE_REGION}
8-
bucket: ${DO_SPACE_BUCKET}
4+
key: ${DO_SPACE_KEY}
5+
secret: ${DO_SPACE_SECRET}
6+
endpoint: ${DO_SPACE_ENDPOINT}
7+
region: ${DO_SPACE_REGION}
8+
bucket: ${DO_SPACE_BUCKET}
99

10-
11-
10+
11+
## Database Properties
1212
spring:
1313
datasource:
1414
url: jdbc:h2:file:${PATH_TO_DB_FILE};DB_CLOSE_ON_EXIT=FALSE

0 commit comments

Comments
 (0)