diff options
author | 2017-11-20 15:04:38 +0300 | |
---|---|---|
committer | 2017-11-20 15:04:38 +0300 | |
commit | 2efaf52caa8c42ec30ba9967c5f5841e874e22f4 (patch) | |
tree | 6b55600860170307d1cae46e62c8706051fc11e6 /juick-www/src/main/java/com/juick/www/controllers/Settings.java | |
parent | 3f7645e8547f9215342b5c235177e381522154ad (diff) |
fix api and www tests
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers/Settings.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/controllers/Settings.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Settings.java b/juick-www/src/main/java/com/juick/www/controllers/Settings.java index b49c0f1c..db60acba 100644 --- a/juick-www/src/main/java/com/juick/www/controllers/Settings.java +++ b/juick-www/src/main/java/com/juick/www/controllers/Settings.java @@ -28,6 +28,7 @@ import com.juick.www.WebApp; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; @@ -60,8 +61,10 @@ import java.util.stream.IntStream; public class Settings { private static final Logger logger = LoggerFactory.getLogger(Settings.class); - @Inject - private WebApp webApp; + @Value("${img_path:/var/www/juick.com/i/}") + private String imgDir; + @Value("${upload_tmp_dir:/var/www/juick.com/i/tmp/}") + private String tmpDir; @Inject private TagService tagService; @Inject @@ -156,9 +159,9 @@ public class Settings { info.setCountry(request.getParameter("country")); info.setUrl(request.getParameter("url")); info.setDescription(request.getParameter("descr")); - String avatarTmpPath = HttpUtils.receiveMultiPartFile(avatar, webApp.getTmpDir()); + String avatarTmpPath = HttpUtils.receiveMultiPartFile(avatar, tmpDir); if (StringUtils.isNotEmpty(avatarTmpPath)) { - ImageUtils.saveAvatar(avatarTmpPath, visitor.getUid(), webApp.getTmpDir(), webApp.getImgDir()); + ImageUtils.saveAvatar(avatarTmpPath, visitor.getUid(), tmpDir, imgDir); } if (userService.updateUserInfo(visitor, info)) { result = String.format("<p>Your info is updated.</p><p><a href='/%s/'>Back to blog</a>.</p>", visitor.getName()); |