use of org.libresonic.player.domain.UserSettings in project libresonic by Libresonic.
the class PlayQueueController method handleRequestInternal.
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
Player player = playerService.getPlayer(request, response);
Map<String, Object> map = new HashMap<>();
map.put("user", user);
map.put("player", player);
map.put("players", playerService.getPlayersForUserAndClientId(user.getUsername(), null));
map.put("visibility", userSettings.getPlaylistVisibility());
map.put("partyMode", userSettings.isPartyModeEnabled());
map.put("notify", userSettings.isSongNotificationEnabled());
map.put("autoHide", userSettings.isAutoHidePlayQueue());
return new ModelAndView("playQueue", "model", map);
}
use of org.libresonic.player.domain.UserSettings in project libresonic by Libresonic.
the class AvatarController method getLastModified.
public long getLastModified(HttpServletRequest request) {
Avatar avatar = getAvatar(request);
long result = avatar == null ? -1L : avatar.getCreatedDate().getTime();
String username = request.getParameter("username");
if (username != null) {
UserSettings userSettings = settingsService.getUserSettings(username);
result = Math.max(result, userSettings.getChanged().getTime());
}
return result;
}
use of org.libresonic.player.domain.UserSettings in project libresonic by Libresonic.
the class TopController method handleRequestInternal.
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
Map<String, Object> map = new HashMap<>();
User user = securityService.getCurrentUser(request);
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
map.put("user", user);
map.put("showSideBar", userSettings.isShowSideBar());
map.put("showAvatar", userSettings.getAvatarScheme() != AvatarScheme.NONE);
return new ModelAndView("top", "model", map);
}
use of org.libresonic.player.domain.UserSettings in project libresonic by Libresonic.
the class UserSettingsController method displayForm.
@RequestMapping(method = RequestMethod.GET)
protected String displayForm(HttpServletRequest request, Model model) throws Exception {
UserSettingsCommand command;
if (!model.containsAttribute("command")) {
command = new UserSettingsCommand();
User user = getUser(request);
if (user != null) {
command.setUser(user);
command.setEmail(user.getEmail());
UserSettings userSettings = settingsService.getUserSettings(user.getUsername());
command.setTranscodeSchemeName(userSettings.getTranscodeScheme().name());
command.setAllowedMusicFolderIds(Util.toIntArray(getAllowedMusicFolderIds(user)));
} else {
command.setNewUser(true);
command.setStreamRole(true);
command.setSettingsRole(true);
}
} else {
command = (UserSettingsCommand) model.asMap().get("command");
}
command.setAdmin(User.USERNAME_ADMIN.equals(command.getUsername()));
command.setUsers(securityService.getAllUsers());
command.setTranscodingSupported(transcodingService.isDownsamplingSupported(null));
command.setTranscodeDirectory(transcodingService.getTranscodeDirectory().getPath());
command.setTranscodeSchemes(TranscodeScheme.values());
command.setLdapEnabled(settingsService.isLdapEnabled());
command.setAllMusicFolders(settingsService.getAllMusicFolders());
model.addAttribute("command", command);
return "userSettings";
}
use of org.libresonic.player.domain.UserSettings in project libresonic by Libresonic.
the class RightController method handleRequestInternal.
@RequestMapping(method = RequestMethod.GET)
protected ModelAndView handleRequestInternal(HttpServletRequest request) throws Exception {
Map<String, Object> map = new HashMap<>();
ModelAndView result = new ModelAndView("right");
UserSettings userSettings = settingsService.getUserSettings(securityService.getCurrentUsername(request));
if (userSettings.isFinalVersionNotificationEnabled() && versionService.isNewFinalVersionAvailable()) {
map.put("newVersionAvailable", true);
map.put("latestVersion", versionService.getLatestFinalVersion());
} else if (userSettings.isBetaVersionNotificationEnabled() && versionService.isNewBetaVersionAvailable()) {
map.put("newVersionAvailable", true);
map.put("latestVersion", versionService.getLatestBetaVersion());
}
map.put("brand", settingsService.getBrand());
map.put("showNowPlaying", userSettings.isShowNowPlayingEnabled());
map.put("user", securityService.getCurrentUser(request));
result.addObject("model", map);
return result;
}
Aggregations