최초 커밋!

This commit is contained in:
kangsunlee
2025-05-27 16:34:20 +09:00
parent 3b8247ecd9
commit 5a66c0542b
1445 changed files with 65703 additions and 65 deletions

33
front/.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

BIN
front/.mvn/wrapper/maven-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

316
front/mvnw vendored Normal file
View File

@@ -0,0 +1,316 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /usr/local/etc/mavenrc ] ; then
. /usr/local/etc/mavenrc
fi
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
if [ -z "$JAVA_HOME" ]; then
if [ -x "/usr/libexec/java_home" ]; then
export JAVA_HOME="`/usr/libexec/java_home`"
else
export JAVA_HOME="/Library/Java/Home"
fi
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Mingw, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`\\unset -f command; \\command -v java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
if [ -z "$1" ]
then
echo "Path not specified to find_maven_basedir"
return 1
fi
basedir="$1"
wdir="$1"
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
if [ -d "${wdir}" ]; then
wdir=`cd "$wdir/.."; pwd`
fi
# end of workaround
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
BASE_DIR=`find_maven_basedir "$(pwd)"`
if [ -z "$BASE_DIR" ]; then
exit 1;
fi
##########################################################################################
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
# This allows using the maven wrapper in projects that prohibit checking in binary data.
##########################################################################################
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found .mvn/wrapper/maven-wrapper.jar"
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
fi
if [ -n "$MVNW_REPOURL" ]; then
jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
else
jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
fi
while IFS="=" read key value; do
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
esac
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
if [ "$MVNW_VERBOSE" = true ]; then
echo "Downloading from: $jarUrl"
fi
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
if $cygwin; then
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
fi
if command -v wget > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found wget ... using wget"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
else
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath"
fi
elif command -v curl > /dev/null; then
if [ "$MVNW_VERBOSE" = true ]; then
echo "Found curl ... using curl"
fi
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
curl -o "$wrapperJarPath" "$jarUrl" -f
else
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
fi
else
if [ "$MVNW_VERBOSE" = true ]; then
echo "Falling back to using Java to download"
fi
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
# For Cygwin, switch paths to Windows format before running javac
if $cygwin; then
javaClass=`cygpath --path --windows "$javaClass"`
fi
if [ -e "$javaClass" ]; then
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Compiling MavenWrapperDownloader.java ..."
fi
# Compiling the Java class
("$JAVA_HOME/bin/javac" "$javaClass")
fi
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
# Running the downloader
if [ "$MVNW_VERBOSE" = true ]; then
echo " - Running MavenWrapperDownloader.java ..."
fi
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
fi
fi
fi
fi
##########################################################################################
# End of extension
##########################################################################################
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
if [ "$MVNW_VERBOSE" = true ]; then
echo $MAVEN_PROJECTBASEDIR
fi
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

188
front/mvnw.cmd vendored Normal file
View File

@@ -0,0 +1,188 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%

43
front/pom.xml Normal file
View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<artifactId>front</artifactId>
<build>
<plugins>
<plugin>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
<groupId>org.springframework.boot</groupId>
<version>3.4.0</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<artifactId>aws</artifactId>
<groupId>app.module</groupId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>core</artifactId>
<groupId>app.module</groupId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<description>Front project</description>
<modelVersion>4.0.0</modelVersion>
<name>front</name>
<packaging>${packaging.type}</packaging>
<parent>
<artifactId>app.module</artifactId>
<groupId>app.module</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<version>0.0.1-SNAPSHOT</version>
</project>

View File

@@ -0,0 +1,29 @@
package app.module.front;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableCaching
@ComponentScan(basePackages = "app.module")
public class FrontApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(FrontApplication.class, args);
}
/**
* maven jar 배포시 필요없지만, war 배포를 선택한 경우 configure 오버라이드가 필요하기에 선언.
*
* @param builder
* @return
*/
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(FrontApplication.class);
}
}

View File

@@ -0,0 +1,84 @@
package app.module.front.config;
import app.module.core.config.adapters.web.interceptor.URIAuthorizeInterceptor;
import app.module.core.config.application.enums.PublicAccess;
import app.module.front.config.adapters.web.interceptor.FrontURIInterceptor;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
@Configuration
@RequiredArgsConstructor
public class FrontWebMvcConfig implements WebMvcConfigurer {
private final FrontURIInterceptor frontURIInterceptor;
private final URIAuthorizeInterceptor uriAuthorizeInterceptor;
@Value("${path.upload.public}")
private String publicPath;
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry
.addInterceptor(frontURIInterceptor)
.excludePathPatterns(
Arrays.stream(PublicAccess.values())
// 로그인 페이지의 경우, currentURI 정보를 얻기 위해 실행되야 한다.
.filter(publicAccess -> !publicAccess.getPath().equals("/login"))
.map(PublicAccess::getPath)
.collect(Collectors.toList()))
.excludePathPatterns("/api/**"); // api 는 currentURI 정보가 없기에 skip;
// registry
// .addInterceptor(uriAuthorizeInterceptor)
// .addPathPatterns("/**")
// .excludePathPatterns(
// Arrays.stream(PublicAccess.values())
// .map(PublicAccess::getPath)
// .collect(Collectors.toList()))
// // 익명 사용자 접근 허용 URI 는 인증체크 대상에서 제외
// .excludePathPatterns(FrontPublicAccess.getInstance().getURIs());
registry.addInterceptor(localeChangeInterceptor());
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/content-disposition/inline/**")
.addResourceLocations("file:///" + publicPath + "/")
.setCachePeriod(20);
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
converters.add(new MappingJackson2HttpMessageConverter());
}
@Bean
public LocaleResolver localeResolver() {
CookieLocaleResolver slr = new CookieLocaleResolver();
slr.setDefaultLocale(Locale.getDefault());
slr.setCookieName("lang");
return slr;
}
@Bean
public LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
lci.setParamName("lang");
return lci;
}
}

View File

@@ -0,0 +1,90 @@
package app.module.front.config.adapters.web.interceptor;
import app.module.core.config.adapters.web.interceptor.model.URITopTierVO;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.exception.NoMatchingURIException;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.uri.ancestry.ports.URIAncestryPortIn;
import app.module.core.usecase.uri.currentmatch.ports.URICurrentMatchingPortIn;
import app.module.core.usecase.uri.currentmatch.ports.application.domain.URICurrentMatching;
import app.module.core.usecase.uri.toptier.ports.URITopTierPortIn;
import app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
@Component
@RequiredArgsConstructor
@Slf4j
public class FrontURIInterceptor implements HandlerInterceptor {
private final URICurrentMatchingPortIn uriCurrentMatchingPortIn;
private final URIAncestryPortIn uriAncestryPortIn;
private final URITopTierPortIn topTierPortIn;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
Object handler)
throws Exception {
String requestURI = request.getRequestURI();
URICurrentMatching currentURI = uriCurrentMatchingPortIn.connect(AppType.FRONT, requestURI);
if (currentURI == null) {
// spring boot 2.6.x 에서는 인터셉터에서 throw exception 이 동작안했기에 아래 코드가 필요했음.
// request.setAttribute("message", String.format("매핑되는 않은 URI - %s", requestURI));
// request.setAttribute("exception", "NoMatchingURIException");
// request.getRequestDispatcher("/error/interceptor").forward(request, response);
// return false;
// spring boot 3.4.x 에서는 throw exception 이 가능!
throw new NoMatchingURIException(String.format("매핑되는 않은 URI - %s", requestURI));
}
request.setAttribute("currentURI", currentURI);
return true;
}
@Override
public void postHandle(
HttpServletRequest request,
HttpServletResponse response,
Object handler,
ModelAndView modelAndView)
throws Exception {
if (modelAndView == null) {
log.info("POST_HANDLE_END::since modelAndView is null");
return;
}
if (!CommonUtil.isAjaxRequest(request)) {
URITopTier topTierOutput = topTierPortIn.connect(AppType.FRONT);
modelAndView.addObject("topNode", recursiveMapping(topTierOutput));
if (modelAndView.getModelMap().getAttribute("currentURI") == null) {
modelAndView.addObject("currentURI", request.getAttribute("currentURI"));
}
modelAndView.addObject(
"menuHierarchy", uriAncestryPortIn.connect(AppType.FRONT, request.getRequestURI()));
}
}
private URITopTierVO recursiveMapping(URITopTier output) {
return new URITopTierVO(
output.getId(),
output.getText(),
output.getUri(),
output.getShowOnNavi(),
CollectionUtils.emptyIfNull(output.getChildren()).stream()
.map(this::recursiveMapping)
.collect(Collectors.toList()));
}
}

View File

@@ -0,0 +1,48 @@
package app.module.front.config.application.security;
import app.module.core.config.application.enums.SocialType;
import app.module.front.usecase.user.social.processSocialLogin.ports.ProcessSocialLoginPortIn;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.ProcessSocialLoginCmd;
import java.util.Arrays;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.oauth2.client.userinfo.DefaultOAuth2UserService;
import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest;
import org.springframework.security.oauth2.client.userinfo.OAuth2UserService;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@Slf4j
public class CustomOAuth2UserService implements OAuth2UserService<OAuth2UserRequest, OAuth2User> {
private final ProcessSocialLoginPortIn processSocialLoginPortIn;
@Override
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
OAuth2UserService<OAuth2UserRequest, OAuth2User> delegate = new DefaultOAuth2UserService();
OAuth2User oAuth2User = delegate.loadUser(userRequest);
String registrationId = userRequest.getClientRegistration().getRegistrationId();
SocialType socialType =
Arrays.stream(SocialType.values())
.filter(type -> type.getRegistrationId().equals(registrationId))
.findFirst()
.orElseThrow(() -> new RuntimeException("Social type not found"));
String userNameAttributeName =
userRequest
.getClientRegistration()
.getProviderDetails()
.getUserInfoEndpoint()
.getUserNameAttributeName();
Map<String, Object> attributes = oAuth2User.getAttributes();
return processSocialLoginPortIn
.operate(new ProcessSocialLoginCmd(socialType, userNameAttributeName, attributes))
.orElseThrow();
}
}

View File

@@ -0,0 +1,87 @@
package app.module.front.config.application.security;
import app.module.core.config.adapters.web.security.domain.CorePrivilege;
import app.module.core.config.adapters.web.security.domain.CoreRole;
import app.module.core.usecase.user.findUser.ports.FindUserPortIn;
import app.module.core.usecase.user.findUser.ports.application.domain.FindUser;
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class FrontDetailService implements UserDetailsService {
private final FindUserPortIn findUserPortIn;
@Value("${app.front.password.validity.period.days}")
private long passwordValidPeriodDays;
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
FindUser findUser =
findUserPortIn
.operate(new FindUserCmd(username))
.orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
boolean accountLocked = Optional.ofNullable(findUser.getAccountLocked()).orElse(false);
boolean accountDisabled = Optional.ofNullable(findUser.getAccountDisabled()).orElse(false);
return new FrontUser(
findUser.getId(),
findUser.getPassword(),
!accountDisabled,
true,
isCredentialsNonExpired(findUser.getPasswordUpdatedAt()),
!accountLocked,
getAuthorities(findUser.getRoles()),
findUser.getNickname(),
passwordValidPeriodDays - getDaysPassedFrom(findUser.getPasswordUpdatedAt()));
}
/**
* Authorities (Role + Privileges) 합성. Role 과 Privileges 는 1:N 매핑되지만, 이 메서드를 통해 동일한 depth 로 배열에
* 담겨 반환된다. 즉, Privilege 는 또다른 종류의 Role 로 볼 수 있다.
*
* @param roles
* @return authorities
*/
private Collection<? extends GrantedAuthority> getAuthorities(Collection<CoreRole> roles) {
return Stream.concat(getRoles(roles), getPrivileges(roles))
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
}
private Stream<String> getRoles(Collection<CoreRole> roles) {
return roles.stream().map(CoreRole::getId);
}
private Stream<String> getPrivileges(Collection<CoreRole> roles) {
return roles.stream()
.flatMap(roleOutput -> roleOutput.getPrivileges().stream())
.map(CorePrivilege::getId);
}
// 패스워드 만료 여부체크. 이 기능이 필요하지 않다면 항상 true 를 반환하도록 변경하면 된다.
private boolean isCredentialsNonExpired(LocalDateTime passwordUpdatedAt) {
// return passwordValidPeriodDays == -1
// || getDaysPassedFrom(passwordUpdatedAt) <= passwordValidPeriodDays;
return true;
}
// 패스워드 만료일 정보를 반환. 이 기능이 필요하지 않다면 항상 0L 을 반환하도록 변경하면 된다.
private long getDaysPassedFrom(LocalDateTime passwordUpdatedAt) {
// return Duration.between(passwordUpdatedAt, LocalDateTime.now()).toDays();
return 0L;
}
}

View File

@@ -0,0 +1,26 @@
package app.module.front.config.application.security;
import java.util.ArrayList;
import java.util.List;
public class FrontPublicAccess {
private static final FrontPublicAccess INSTANCE = new FrontPublicAccess();
private List<String> publicAccessURIs = new ArrayList<>();
private FrontPublicAccess() {
}
public static FrontPublicAccess getInstance() {
return INSTANCE;
}
public List<String> getURIs() {
return publicAccessURIs;
}
public void setURIs(List<String> uris) {
publicAccessURIs.addAll(uris);
}
}

View File

@@ -0,0 +1,115 @@
package app.module.front.config.application.security;
import app.module.core.config.adapters.web.security.entrypoint.CustomAuthenticationEntryPoint;
import app.module.core.config.application.enums.PublicAccess;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import javax.sql.DataSource;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.rememberme.JdbcTokenRepositoryImpl;
import org.springframework.security.web.authentication.rememberme.PersistentTokenRepository;
import org.springframework.security.web.session.HttpSessionEventPublisher;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class FrontSecurityConfig {
private final FrontDetailService frontDetailService;
private final DataSource dataSource;
private final BCryptPasswordEncoder passwordEncoder;
private final CustomOAuth2UserService customOAuth2UserService;
private final CustomAuthenticationEntryPoint customAuthenticationEntryPoint;
@Value("${app.front.session.maximum.num}")
private Integer maxSessionNum;
@Bean
public PersistentTokenRepository persistentTokenRepository() {
JdbcTokenRepositoryImpl jdbcTokenRepository = new JdbcTokenRepositoryImpl();
jdbcTokenRepository.setDataSource(dataSource);
return jdbcTokenRepository;
}
@Bean
public DaoAuthenticationProvider authenticationProvider() {
DaoAuthenticationProvider auth = new DaoAuthenticationProvider();
auth.setUserDetailsService(frontDetailService);
auth.setPasswordEncoder(passwordEncoder);
return auth;
}
// 중복 로그인 방지를 위해 선언
@Bean
public SessionRegistry sessionRegistry() {
return new SessionRegistryImpl();
}
// 중복 로그인 방지를 위해 선언
@Bean
public ServletListenerRegistrationBean httpSessionEventPublisher() {
return new ServletListenerRegistrationBean(new HttpSessionEventPublisher());
}
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
List<String> publicAccess =
Arrays.stream(PublicAccess.values())
.map(PublicAccess::getPath)
.collect(Collectors.toList());
// front - 익명 사용자 접근 허용 URI 등록 (admin 과 달리 공개/비공개 URL 이 존재한다)
FrontPublicAccess.getInstance().setURIs(List.of("/", "/user/register"));
http.authorizeHttpRequests(
(auth) ->
auth.requestMatchers(publicAccess.toArray(String[]::new))
.permitAll()
.requestMatchers(
FrontPublicAccess.getInstance().getURIs().toArray(String[]::new))
.permitAll()
.anyRequest()
.hasAuthority("FRONT_ACCESS"))
.exceptionHandling(
exception ->
exception.defaultAuthenticationEntryPointFor(
customAuthenticationEntryPoint, new AntPathRequestMatcher("/api/**")))
.formLogin(fLogin -> fLogin.loginPage("/login"))
.rememberMe(
remMe ->
remMe
.tokenValiditySeconds(1209600)
.userDetailsService(frontDetailService)
.tokenRepository(persistentTokenRepository()))
.logout(
logout ->
logout
.invalidateHttpSession(true)
.clearAuthentication(true)
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")))
.sessionManagement(
session -> session.maximumSessions(maxSessionNum).maxSessionsPreventsLogin(false))
.oauth2Login(
config ->
config
.loginPage("/login")
.userInfoEndpoint(
userInfoEndpointConfig ->
userInfoEndpointConfig.userService(customOAuth2UserService)));
return http.build();
}
}

View File

@@ -0,0 +1,35 @@
package app.module.front.config.application.security;
import java.util.Collection;
import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
@Getter
public class FrontUser extends User {
private String nickname;
private long remainPasswordDays;
public FrontUser(
String username,
String password,
boolean enabled,
boolean accountNonExpired,
boolean credentialsNonExpired,
boolean accountNonLocked,
Collection<? extends GrantedAuthority> authorities,
String nickName,
long remainPasswordDays) {
super(
username,
password,
enabled,
accountNonExpired,
credentialsNonExpired,
accountNonLocked,
authorities);
this.nickname = nickName;
this.remainPasswordDays = remainPasswordDays;
}
}

View File

@@ -0,0 +1,35 @@
package app.module.front.usecase.article.comment.createArticleComment.adapter.web;
import app.module.core.usecase.article.comment.createArticleComment.ports.CreateArticleCommentPortIn;
import app.module.core.usecase.article.comment.createArticleComment.ports.application.domain.CreateArticleComment;
import app.module.core.usecase.article.comment.createArticleComment.ports.application.domain.CreateArticleCommentCmd;
import app.module.front.usecase.article.comment.createArticleComment.adapter.web.model.CreateArticleCommentReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class CreateArticleCommentController {
private final CreateArticleCommentPortIn createArticleCommentPortIn;
@PostMapping(path = "/api/front/board/articles/comment/create")
ResponseEntity<?> operate(@Valid CreateArticleCommentReqVO reqVO, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
CreateArticleComment comment =
createArticleCommentPortIn.operate(
new CreateArticleCommentCmd(reqVO.getArticleId(), reqVO.getCommentContent()))
.orElseThrow();
return ResponseEntity.status(HttpStatus.OK).body(comment);
}
}

View File

@@ -0,0 +1,23 @@
package app.module.front.usecase.article.comment.createArticleComment.adapter.web.model;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.text.StringEscapeUtils;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateArticleCommentReqVO {
private Long articleId;
@NotBlank(message = "{valid.article.comment.required}")
private String commentContent;
public String getCommentContent() {
return StringEscapeUtils.escapeHtml4(commentContent);
}
}

View File

@@ -0,0 +1,34 @@
package app.module.front.usecase.article.comment.getArticleComments.adapter.web;
import app.module.core.usecase.article.comment.getArticleComments.ports.GetArticleCommentsPortIn;
import app.module.core.usecase.article.comment.getArticleComments.ports.application.domain.GetArticleComments;
import app.module.core.usecase.article.comment.getArticleComments.ports.application.domain.GetArticleCommentsCmd;
import app.module.front.usecase.article.comment.getArticleComments.adapter.web.model.GetArticleCommentsReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class GetArticleCommentsController {
private final GetArticleCommentsPortIn getArticleCommentsPortIn;
@GetMapping(path = "/api/front/board/articles/comments")
ResponseEntity<?> operate(
@PageableDefault(sort = "id", direction = Sort.Direction.DESC, page = 0, size = 10) Pageable pageable,
GetArticleCommentsReqVO reqVO) {
Page<GetArticleComments> comments =
getArticleCommentsPortIn.operate(pageable,
new GetArticleCommentsCmd(reqVO.getArticleId()));
return ResponseEntity.status(HttpStatus.OK).body(comments);
}
}

View File

@@ -0,0 +1,15 @@
package app.module.front.usecase.article.comment.getArticleComments.adapter.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetArticleCommentsReqVO {
private Long articleId;
}

View File

@@ -0,0 +1,31 @@
package app.module.front.usecase.article.comment.removeArticleComment.adapter.web;
import app.module.core.usecase.article.comment.removeArticleComment.ports.RemoveArticleCommentPortIn;
import app.module.core.usecase.article.comment.removeArticleComment.ports.application.domain.RemoveArticleCommentCmd;
import app.module.front.usecase.article.comment.removeArticleComment.adapter.web.model.RemoveArticleCommentReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class RemoveArticleCommentController {
private final RemoveArticleCommentPortIn removeArticleCommentPortIn;
@DeleteMapping(path = "/api/front/board/articles/comment/remove")
ResponseEntity<?> operate(@Valid RemoveArticleCommentReqVO reqVO, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
removeArticleCommentPortIn.operate(new RemoveArticleCommentCmd(reqVO.getRemoveId()));
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}
}

View File

@@ -0,0 +1,15 @@
package app.module.front.usecase.article.comment.removeArticleComment.adapter.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class RemoveArticleCommentReqVO {
private Long removeId;
}

View File

@@ -0,0 +1,38 @@
package app.module.front.usecase.article.comment.updateArticleComment.adapter.web;
import app.module.core.usecase.article.comment.updateArticleComment.ports.UpdateArticleCommentPortIn;
import app.module.core.usecase.article.comment.updateArticleComment.ports.application.domain.UpdateArticleComment;
import app.module.core.usecase.article.comment.updateArticleComment.ports.application.domain.UpdateArticleCommentCmd;
import app.module.front.usecase.article.comment.updateArticleComment.adapter.web.model.UpdateArticleCommentReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class UpdateArticleCommentController {
private final UpdateArticleCommentPortIn updateArticleCommentPortIn;
@PutMapping(path = "/api/front/board/articles/comment/update")
ResponseEntity<?> operate(@Valid UpdateArticleCommentReqVO reqVO, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
UpdateArticleComment comment =
updateArticleCommentPortIn.operate(
new UpdateArticleCommentCmd(
reqVO.getCommentId(),
reqVO.getCommentContent(),
reqVO.getArticleId()))
.orElseThrow();
return ResponseEntity.status(HttpStatus.OK).body(comment);
}
}

View File

@@ -0,0 +1,24 @@
package app.module.front.usecase.article.comment.updateArticleComment.adapter.web.model;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.text.StringEscapeUtils;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class UpdateArticleCommentReqVO {
private Long commentId;
@NotBlank(message = "{valid.article.comment.required}")
private String commentContent;
private Long articleId;
public String getCommentContent() {
return StringEscapeUtils.escapeHtml4(commentContent);
}
}

View File

@@ -0,0 +1,46 @@
package app.module.front.usecase.article.createArticle.adapters.web;
import app.module.core.usecase.article.createArticle.ports.CreateArticlePortIn;
import app.module.core.usecase.article.createArticle.ports.application.domain.CreateArticle;
import app.module.core.usecase.article.createArticle.ports.application.domain.CreateArticleCmd;
import app.module.front.usecase.article.createArticle.adapters.web.model.CreateArticleReqVO;
import app.module.front.usecase.article.createArticle.adapters.web.validator.CreateArticleValidator;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class CreateArticleController {
private final CreateArticlePortIn createArticlePortIn;
private final CreateArticleValidator createArticleValidator;
@PostMapping(path = "/api/front/board/articles/create")
ResponseEntity<?> operate(@Valid CreateArticleReqVO reqVO, BindingResult bindingResult) {
createArticleValidator.validate(reqVO, bindingResult);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
CreateArticle article =
createArticlePortIn
.operate(
new CreateArticleCmd(
reqVO.getTitle(),
reqVO.getContent(),
reqVO.getVisible(),
reqVO.getStartDate(),
reqVO.getEndDate(),
reqVO.getFileMappingId()))
.orElseThrow();
return ResponseEntity.status(HttpStatus.OK).body(article);
}
}

View File

@@ -0,0 +1,43 @@
package app.module.front.usecase.article.createArticle.adapters.web.model;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.text.StringEscapeUtils;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateArticleReqVO {
@NotBlank(message = "{valid.common.required}")
private String title;
@NotBlank(message = "{valid.common.required}")
private String content;
@NotNull(message = "{valid.common.required}")
private Boolean visible;
@NotNull(message = "{valid.common.required}")
private LocalDateTime startDate;
@NotNull(message = "{valid.common.required}")
private LocalDateTime endDate;
private List<String> fileMappingId;
public String getTitle() {
return StringEscapeUtils.escapeHtml4(title);
}
public String getContent() {
return StringEscapeUtils.escapeHtml4(content);
}
}

View File

@@ -0,0 +1,55 @@
package app.module.front.usecase.article.createArticle.adapters.web.validator;
import app.module.core.config.application.util.MessageUtil;
import app.module.front.usecase.article.createArticle.adapters.web.model.CreateArticleReqVO;
import java.time.LocalDateTime;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
@RequiredArgsConstructor
public class CreateArticleValidator implements Validator {
private final MessageUtil messageUtil;
@Override
public boolean supports(Class<?> clazz) {
return CreateArticleReqVO.class.equals(clazz);
}
@Override
public void validate(Object target, Errors errors) {
CreateArticleReqVO vo = (CreateArticleReqVO) target;
LocalDateTime startDate = vo.getStartDate();
LocalDateTime endDate = vo.getEndDate();
// 게시일 날짜 체크
if (startDate == null) {
errors.rejectValue(
"startDate", "valid.common.required",
messageUtil.getMessage("valid.common.required"));
}
if (endDate == null) {
errors.rejectValue(
"endDate", "valid.common.required",
messageUtil.getMessage("valid.common.required"));
}
if (startDate != null && endDate != null) {
if (!startDate.isBefore(endDate)) {
errors.rejectValue(
"startDate",
"valid.common.date.invalid",
messageUtil.getMessage("valid.common.date.invalid"));
errors.rejectValue(
"endDate",
"valid.common.date.invalid",
messageUtil.getMessage("valid.common.date.invalid"));
}
}
}
}

View File

@@ -0,0 +1,21 @@
package app.module.front.usecase.article.createArticleUI;
import app.module.front.usecase.article.createArticleUI.model.CreateArticleUIReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
@Controller
@RequiredArgsConstructor
class CreateArticleUIController {
@GetMapping(path = "/board/articles/create")
String operate(
Model model,
@ModelAttribute("reqVO") CreateArticleUIReqVO reqVO) {
return "board/articles/create";
}
}

View File

@@ -0,0 +1,14 @@
package app.module.front.usecase.article.createArticleUI.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateArticleUIReqVO {
}

View File

@@ -0,0 +1,23 @@
package app.module.front.usecase.article.getArticle.adapters.web;
import app.module.core.usecase.article.getArticle.ports.GetArticlePortIn;
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticleCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class GetArticleController {
private final GetArticlePortIn getArticlePortIn;
@GetMapping(path = "/api/front/board/articles/{id}")
ResponseEntity<?> operate(@PathVariable Long id) {
return ResponseEntity.status(HttpStatus.OK)
.body(getArticlePortIn.operate(new GetArticleCmd(id)).orElseThrow());
}
}

View File

@@ -0,0 +1,37 @@
package app.module.front.usecase.article.getArticleUI.adapters.web;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.article.getArticle.ports.GetArticlePortIn;
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticle;
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticleCmd;
import app.module.front.usecase.article.getArticleUI.adapters.web.model.GetArticleUIReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
@Controller
@RequiredArgsConstructor
class GetArticleUIController {
private final GetArticlePortIn getArticlePortIn;
@GetMapping(path = "/board/articles/{id}")
String operate(
Model model,
@PathVariable @ModelAttribute("id") Long id,
@ModelAttribute("reqVO") GetArticleUIReqVO reqVO) {
GetArticle getArticle =
getArticlePortIn.operate(new GetArticleCmd(id)).orElseThrow();
// 로그인 사용자와 게시물 작성자가 동일한지 체크
model.addAttribute("isAuthor",
getArticle.getCreatedBy().equals(CommonUtil.getLoginUsername()));
model.addAttribute("article", getArticle);
return "board/articles/{id}";
}
}

View File

@@ -0,0 +1,14 @@
package app.module.front.usecase.article.getArticleUI.adapters.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetArticleUIReqVO {
}

View File

@@ -0,0 +1,32 @@
package app.module.front.usecase.article.getArticles.adapters.web;
import app.module.core.usecase.article.getArticles.ports.GetArticlesPortIn;
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticles;
import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticlesCmd;
import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class GetArticlesController {
private final GetArticlesPortIn getArticlesPortIn;
@GetMapping(path = "/api/board/articles")
ResponseEntity<?> operate(@PageableDefault Pageable pageable, GetArticlesReqVO reqVO) {
Page<GetArticles> articles =
getArticlesPortIn.operate(
pageable,
new GetArticlesCmd(
reqVO.getSearchField(), reqVO.getSearchValue(), reqVO.getSearchOpen()));
return ResponseEntity.status(HttpStatus.OK).body(articles);
}
}

View File

@@ -0,0 +1,17 @@
package app.module.front.usecase.article.getArticles.adapters.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetArticlesReqVO {
private String searchField;
private String searchValue;
private String searchOpen;
}

View File

@@ -0,0 +1,26 @@
package app.module.front.usecase.article.getArticlesUI;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import app.module.front.usecase.article.getArticlesUI.model.GetArticlesUIReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
@Controller
@RequiredArgsConstructor
class GetArticlesUIController {
private final UICodeListPortIn uiCodeListPortIn;
@GetMapping(path = "/board/articles")
String operate(
Model model,
@ModelAttribute("reqVO") GetArticlesUIReqVO reqVO) {
model.addAttribute("pageRows", uiCodeListPortIn.connect("code.pageable.rows"));
return "board/articles";
}
}

View File

@@ -0,0 +1,36 @@
package app.module.front.usecase.article.getArticlesUI.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.thymeleaf.util.StringUtils;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetArticlesUIReqVO {
private Integer page;
private String sort;
private Integer size;
private String searchField;
private String searchValue;
private String searchOpen;
public Integer getPage() {
// 요청 페이지 넘버 - 초기값 `0`
return page != null ? page : 0;
}
public String getSort() {
// 정렬 값 - 초기값 `orderNo 내림차순`
return StringUtils.isEmpty(sort) ? "orderNo,DESC" : sort;
}
public Integer getSize() {
// 페이지 당 아이템 수 - 초기값 `10`
return size != null ? size : 10;
}
}

View File

@@ -0,0 +1,31 @@
package app.module.front.usecase.article.removeArticles.adapters.web;
import app.module.core.usecase.article.removeArticles.ports.RemoveArticlesPortIn;
import app.module.core.usecase.article.removeArticles.ports.application.domain.RemoveArticlesCmd;
import app.module.front.usecase.article.removeArticles.adapters.web.model.RemoveArticlesReqVO;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class RemoveArticlesController {
private final RemoveArticlesPortIn removeArticlesPortIn;
@DeleteMapping(path = "/api/front/board/articles/remove")
ResponseEntity<?> operate(@Valid RemoveArticlesReqVO reqVO, BindingResult bindingResult) {
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
removeArticlesPortIn.operate(new RemoveArticlesCmd(reqVO.getSelectIds()));
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}
}

View File

@@ -0,0 +1,16 @@
package app.module.front.usecase.article.removeArticles.adapters.web.model;
import java.util.Set;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class RemoveArticlesReqVO {
private Set<Long> selectIds;
}

View File

@@ -0,0 +1,46 @@
package app.module.front.usecase.article.updateArticle.adapters.web;
import app.module.core.usecase.article.updateArticle.ports.UpdateArticlePortIn;
import app.module.core.usecase.article.updateArticle.ports.application.domain.UpdateArticleCmd;
import app.module.front.usecase.article.updateArticle.adapters.web.model.UpdateArticleReqVO;
import app.module.front.usecase.article.updateArticle.adapters.web.validator.UpdateArticleValidator;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Slf4j
class UpdateArticleController {
private final UpdateArticlePortIn updateArticlePortIn;
private final UpdateArticleValidator updateArticleValidator;
@PutMapping(path = "/api/front/board/articles/update")
ResponseEntity<?> operate(@Valid UpdateArticleReqVO reqVO, BindingResult bindingResult) {
updateArticleValidator.validate(reqVO, bindingResult);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
updateArticlePortIn.operate(
new UpdateArticleCmd(
reqVO.getId(),
reqVO.getTitle(),
reqVO.getContent(),
reqVO.getVisible(),
reqVO.getOrderNo(),
reqVO.getStartDate(),
reqVO.getEndDate(),
reqVO.getFileMappingId()));
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}
}

View File

@@ -0,0 +1,49 @@
package app.module.front.usecase.article.updateArticle.adapters.web.model;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.text.StringEscapeUtils;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class UpdateArticleReqVO {
@NotNull(message = "{valid.common.required}")
private Long id;
@NotBlank(message = "{valid.common.required}")
private String title;
@NotBlank(message = "{valid.common.required}")
private String content;
@NotNull(message = "{valid.common.required}")
private Boolean visible;
@NotNull(message = "{valid.common.required}")
private Integer orderNo;
@NotNull(message = "{valid.common.required}")
private LocalDateTime startDate;
@NotNull(message = "{valid.common.required}")
private LocalDateTime endDate;
private List<String> fileMappingId;
public String getTitle() {
return StringEscapeUtils.escapeHtml4(title);
}
public String getContent() {
return StringEscapeUtils.escapeHtml4(content);
}
}

View File

@@ -0,0 +1,55 @@
package app.module.front.usecase.article.updateArticle.adapters.web.validator;
import app.module.core.config.application.util.MessageUtil;
import app.module.front.usecase.article.updateArticle.adapters.web.model.UpdateArticleReqVO;
import java.time.LocalDateTime;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
@RequiredArgsConstructor
public class UpdateArticleValidator implements Validator {
private final MessageUtil messageUtil;
@Override
public boolean supports(Class<?> clazz) {
return UpdateArticleReqVO.class.equals(clazz);
}
@Override
public void validate(Object target, Errors errors) {
UpdateArticleReqVO vo = (UpdateArticleReqVO) target;
LocalDateTime startDate = vo.getStartDate();
LocalDateTime endDate = vo.getEndDate();
// 게시일 날짜 체크
if (startDate == null) {
errors.rejectValue(
"startDate", "valid.common.required",
messageUtil.getMessage("valid.common.required"));
}
if (endDate == null) {
errors.rejectValue(
"endDate", "valid.common.required",
messageUtil.getMessage("valid.common.required"));
}
if (startDate != null && endDate != null) {
if (!startDate.isBefore(endDate)) {
errors.rejectValue(
"startDate",
"valid.common.date.invalid",
messageUtil.getMessage("valid.common.date.invalid"));
errors.rejectValue(
"endDate",
"valid.common.date.invalid",
messageUtil.getMessage("valid.common.date.invalid"));
}
}
}
}

View File

@@ -0,0 +1,32 @@
package app.module.front.usecase.article.updateArticleUI.adapters.web;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.article.getArticle.ports.GetArticlePortIn;
import app.module.core.usecase.article.getArticle.ports.application.domain.GetArticleCmd;
import app.module.front.usecase.article.updateArticleUI.adapters.web.model.UpdateArticleUIReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
@Controller
@RequiredArgsConstructor
class UpdateArticleUIController {
private final GetArticlePortIn getArticlePortIn;
@GetMapping(path = "/board/articles/update/{id}")
String operate(
Model model,
@PathVariable @ModelAttribute("id") Long id,
@ModelAttribute("reqVO") UpdateArticleUIReqVO reqVO) {
getArticlePortIn.operate(new GetArticleCmd(id))
.filter(article -> article.getCreatedBy().equals(CommonUtil.getLoginUsername()))
.orElseThrow(() -> new RuntimeException("수정 권한이 없는 사용자입니다."));
return "board/articles/update/{id}";
}
}

View File

@@ -0,0 +1,14 @@
package app.module.front.usecase.article.updateArticleUI.adapters.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class UpdateArticleUIReqVO {
}

View File

@@ -0,0 +1,34 @@
package app.module.front.usecase.editor.adapters.web;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.file.saveToStorage.ports.SaveToStoragePortIn;
import app.module.core.usecase.file.saveToStorage.ports.application.domain.SaveToStorage;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.multipart.MultipartFile;
@Controller
@RequiredArgsConstructor
public class EditorImageUploadController {
private final SaveToStoragePortIn saveToStoragePortIn;
private final FileUrlPortIn fileUrlPortIn;
@PostMapping(path = "/api/front/editorImage/upload")
ResponseEntity<?> editorImageUpload(MultipartFile editorImage) throws IOException {
SaveToStorage saveToStorage =
saveToStoragePortIn.operate(FileUploadType.EDITOR_IMAGE, editorImage).orElseThrow();
return ResponseEntity.status(HttpStatus.OK)
.body(
fileUrlPortIn.getInline(
saveToStorage.getType().getFileStorageType(),
saveToStorage.getPath(),
saveToStorage.getName()));
}
}

View File

@@ -0,0 +1,15 @@
package app.module.front.usecase.home.index.adapter.web;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
@RequiredArgsConstructor
public class HomeController {
@GetMapping(path = "/")
public String home() {
return "home";
}
}

View File

@@ -0,0 +1,13 @@
package app.module.front.usecase.security.login.adapter.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class LoginController {
@GetMapping("/login")
public String login() {
return "security/login";
}
}

View File

@@ -0,0 +1,54 @@
package app.module.front.usecase.user.createUser.adapters.web;
import app.module.core.config.application.enums.SignUpType;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.user.createUser.ports.CreateUserPortIn;
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUser;
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUserCmd;
import app.module.front.usecase.user.createUser.adapters.web.model.CreateUserReqVO;
import app.module.front.usecase.user.createUser.adapters.web.validator.CreateUserValidator;
import jakarta.validation.Valid;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Slf4j
class CreateUserController {
private final CreateUserPortIn createUserPortIn;
private final CreateUserValidator createUserValidator;
private final CoreUtil coreUtil;
@PostMapping(path = "/api/public/user/create")
ResponseEntity<?> operate(@Valid CreateUserReqVO reqVO, BindingResult bindingResult) {
createUserValidator.validate(reqVO, bindingResult);
if (bindingResult.hasErrors()) {
return coreUtil.getErrorInfo(bindingResult);
}
CreateUser user =
createUserPortIn
.operate(
new CreateUserCmd(
reqVO.getId(),
reqVO.getPassword(),
reqVO.getEmail(),
reqVO.getNickname(),
SignUpType.NORMAL,
false,
0,
false,
Set.of("ROLE_GENERAL")))
.orElseThrow();
return ResponseEntity.status(HttpStatus.OK).body(user);
}
}

View File

@@ -0,0 +1,31 @@
package app.module.front.usecase.user.createUser.adapters.web.model;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateUserReqVO {
@NotBlank(message = "{valid.common.required}")
private String id;
@NotBlank(message = "{valid.common.required}")
private String password;
@NotBlank(message = "{valid.common.required}")
private String passwordRe;
@NotBlank(message = "{valid.common.required}")
private String email;
@NotBlank(message = "{valid.common.required}")
@Pattern(regexp = "^[가-힣a-zA-Z0-9_-]{2,10}$", message = "{valid.common.nickname.wrong}")
private String nickname;
}

View File

@@ -0,0 +1,46 @@
package app.module.front.usecase.user.createUser.adapters.web.validator;
import app.module.front.usecase.user.createUser.adapters.web.model.CreateUserReqVO;
import java.util.Optional;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
public class CreateUserValidator implements Validator {
private final String ID_REGEX = "^[a-zA-Z0-9_-]{6,12}$";
private final String PASSWORD_REGEX = "^((?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%_\\-])\\S{6,15})$";
private final String EMAIL_REGEX = "^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$";
@Override
public boolean supports(Class<?> clazz) {
return CreateUserReqVO.class.equals(clazz);
}
@Override
public void validate(Object target, Errors errors) {
CreateUserReqVO vo = (CreateUserReqVO) target;
// 아이디
Optional.ofNullable(vo.getId())
.filter(id -> !id.isEmpty() && !id.matches(ID_REGEX))
.ifPresent(id -> errors.rejectValue("id", "valid.common.id.wrong"));
// 비밀번호
Optional.ofNullable(vo.getPassword())
.filter(password -> !password.isEmpty() && !password.matches(PASSWORD_REGEX))
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong"));
// 비밀번호 재확인
Optional.ofNullable(vo.getPasswordRe())
.filter(passwordRe -> !passwordRe.isEmpty() && !passwordRe.equals(vo.getPassword()))
.ifPresent(
passwordRe -> errors.rejectValue("passwordRe", "valid.common.re.password.wrong"));
// 이메일
Optional.ofNullable(vo.getEmail())
.filter(email -> !email.isEmpty() && !email.matches(EMAIL_REGEX))
.ifPresent(email -> errors.rejectValue("email", "valid.common.email.wrong"));
}
}

View File

@@ -0,0 +1,19 @@
package app.module.front.usecase.user.createUserUI.adapters.web;
import app.module.front.usecase.user.createUserUI.adapters.web.model.CreateUserUIReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
@Controller
@RequiredArgsConstructor
class CreateUserUIController {
@GetMapping(path = "/user/register")
String operate(Model model, @ModelAttribute("reqVO") CreateUserUIReqVO reqVO) {
return "user/register";
}
}

View File

@@ -0,0 +1,14 @@
package app.module.front.usecase.user.createUserUI.adapters.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateUserUIReqVO {
}

View File

@@ -0,0 +1,10 @@
package app.module.front.usecase.user.social.parseSocialUser.ports;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.ParseSocialUserCmd;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.ParsedUserInfo;
import java.util.Optional;
public interface ParseSocialUserPortIn {
Optional<ParsedUserInfo> operate(ParseSocialUserCmd cmd);
}

View File

@@ -0,0 +1,45 @@
package app.module.front.usecase.user.social.parseSocialUser.ports.application;
import app.module.front.usecase.user.social.parseSocialUser.ports.ParseSocialUserPortIn;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.KakaoUserInfo;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.NaverUserInfo;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.ParseSocialUserCmd;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.ParsedUserInfo;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
@Slf4j
class ParseSocialUserService implements ParseSocialUserPortIn {
@Override
public Optional<ParsedUserInfo> operate(ParseSocialUserCmd cmd) {
ParsedUserInfo parsedUserInfo = null;
switch (cmd.getSocialType()) {
case KAKAO -> {
parsedUserInfo = new KakaoUserInfo(cmd.getUserNameAttributeName(),
cmd.getAttributes());
}
case NAVER -> {
parsedUserInfo = new NaverUserInfo(cmd.getUserNameAttributeName(),
cmd.getAttributes());
}
}
if (parsedUserInfo != null) {
log.info("socialId: {}", parsedUserInfo.getSocialId());
log.info("nickname: {}", parsedUserInfo.getNickName());
log.info("name: {}", parsedUserInfo.getName());
log.info("ci: {}", parsedUserInfo.getCi());
log.info("birthday: {}", parsedUserInfo.getBirthday());
log.info("email: {}", parsedUserInfo.getEmail());
log.info("phone: {}", parsedUserInfo.getPhone());
}
return Optional.ofNullable(parsedUserInfo);
}
}

View File

@@ -0,0 +1,116 @@
package app.module.front.usecase.user.social.parseSocialUser.ports.application.domain;
import java.util.Map;
import java.util.Objects;
public class KakaoUserInfo implements ParsedUserInfo {
private final String userNameAttribute;
private final Map<String, Object> attributes;
public KakaoUserInfo(String userNameAttribute, Map<String, Object> attributes) {
this.userNameAttribute = userNameAttribute;
this.attributes = attributes;
}
@Override
public String getSocialId() {
return String.valueOf(attributes.get(userNameAttribute));
}
@Override
@SuppressWarnings("unchecked")
public String getNickName() {
Map<String, Object> account = (Map<String, Object>) attributes.get("kakao_account");
Map<String, Object> profile = (Map<String, Object>) account.get("profile");
return (String) profile.get("nickname");
}
@Override
@SuppressWarnings("unchecked")
public String getName() {
Map<String, Object> account = (Map<String, Object>) attributes.get("kakao_account");
if (account == null) {
return null;
}
// 카카오 로그인 서비스 인증 전에 이름 정보는 전달되지 않는다.
if (account.get("name") == null) {
return null;
}
return (String) account.get("name");
}
@Override
@SuppressWarnings("unchecked")
public String getEmail() {
Map<String, Object> account = (Map<String, Object>) attributes.get("kakao_account");
if (account == null) {
return null;
}
String email = (String) account.get("email");
// 카카오 로그인 서비스 인증 전에 이메일 정보는 전달되지 않는다.
return Objects.requireNonNullElse(email, "NO-KAKAO-EMAIL@noemail.com");
}
@Override
@SuppressWarnings("unchecked")
public String getPhone() {
Map<String, Object> account = (Map<String, Object>) attributes.get("kakao_account");
if (account == null) {
return null;
}
// 카카오 로그인 서비스 인증 전에 phone 정보는 전달되지 않는다.
if (account.get("phone_number") == null) {
return null;
}
// "0" + s.replaceAll("^\\+\\d{1,3}-?|-", "").trim();
return (String) account.get("phone_number");
}
@Override
@SuppressWarnings("unchecked")
public String getBirthday() {
Map<String, Object> account = (Map<String, Object>) attributes.get("kakao_account");
if (account == null) {
return null;
}
String birthyear = (String) account.get("birthyear");
String birthday = (String) account.get("birthday");
// 카카오 로그인 서비스 인증 전에 생년월일 정보는 전달되지 않는다.
if (birthyear == null || birthday == null) {
return null;
}
return birthyear + birthday;
}
@Override
@SuppressWarnings("unchecked")
public String getCi() {
Map<String, Object> account = (Map<String, Object>) attributes.get("kakao_account");
if (account == null) {
return null;
}
// 카카오 로그인 서비스 인증 전에 CI 정보는 전달되지 않는다.
if (account.get("ci") == null || ((String) account.get("ci")).equals("")) {
return null;
}
return (String) account.get("ci");
}
}

View File

@@ -0,0 +1,60 @@
package app.module.front.usecase.user.social.parseSocialUser.ports.application.domain;
import java.util.Map;
import lombok.ToString;
@ToString
public class NaverUserInfo implements ParsedUserInfo {
private final String userNameAttribute;
private final Map<String, Object> attributes;
public NaverUserInfo(String userNameAttribute, Map<String, Object> attributes) {
this.userNameAttribute = userNameAttribute;
this.attributes = attributes;
}
@Override
public String getSocialId() {
return (String) getAttrs().get("id");
}
@Override
public String getNickName() {
return (String) getAttrs().get("nickname");
}
@Override
public String getName() {
return (String) getAttrs().get("name");
}
@Override
public String getEmail() {
return (String) getAttrs().get("email");
}
@Override
public String getPhone() {
String phone = (String) getAttrs().get("mobile");
return phone != null ? phone.replaceAll("-", "") : null;
}
@Override
public String getBirthday() {
String birthYear = (String) getAttrs().get("birthyear");
String birthday = (String) getAttrs().get("birthday");
return (birthYear + birthday).replaceAll("-", "");
}
@Override
public String getCi() {
// 네이버 로그인 서비스 인증 전에 CI 정보는 전달되지 않는다.
return (String) getAttrs().get("ci");
}
@SuppressWarnings("unchecked")
private Map<String, Object> getAttrs() {
return (Map<String, Object>) attributes.get(userNameAttribute);
}
}

View File

@@ -0,0 +1,19 @@
package app.module.front.usecase.user.social.parseSocialUser.ports.application.domain;
import app.module.core.config.application.enums.SocialType;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class ParseSocialUserCmd {
private SocialType socialType;
private String userNameAttributeName;
private Map<String, Object> attributes;
}

View File

@@ -0,0 +1,18 @@
package app.module.front.usecase.user.social.parseSocialUser.ports.application.domain;
public interface ParsedUserInfo {
String getSocialId();
String getNickName();
String getName();
String getEmail();
String getPhone();
String getBirthday();
String getCi();
}

View File

@@ -0,0 +1,12 @@
package app.module.front.usecase.user.social.processSocialLogin.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.FrontUserSocial;
import app.module.core.config.application.enums.SocialType;
import java.util.Optional;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FrontUserSocialRepo {
Optional<FrontUserSocial> findBySocialTypeAndSocialId(SocialType socialType, String socialId);
}

View File

@@ -0,0 +1,66 @@
package app.module.front.usecase.user.social.processSocialLogin.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.FrontUserSocial;
import app.module.front.usecase.user.social.processSocialLogin.ports.ProcessSocialLoginPortOut;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.CreateUserSocialCmd;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.GetUserSocial;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.GetUserSocialCmd;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.ProcessSocialLogin;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.ProcessSocialLoginCmd;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
@Repository
@RequiredArgsConstructor
class ProcessSocialLoginDao implements ProcessSocialLoginPortOut {
private final FrontUserSocialRepo frontUserSocialRepo;
@Override
public Optional<ProcessSocialLogin> operate(ProcessSocialLoginCmd cmd) {
return Optional.empty();
}
@Override
public Optional<GetUserSocial> findUserSocial(GetUserSocialCmd cmd) {
return frontUserSocialRepo
.findBySocialTypeAndSocialId(cmd.getSocialType(), cmd.getSocialId())
.flatMap(
frontSocialUser ->
Optional.of(
new GetUserSocial(
frontSocialUser.getSeq(),
frontSocialUser.getUserId(),
frontSocialUser.getSocialType(),
frontSocialUser.getSocialId(),
frontSocialUser.getEmail(),
frontSocialUser.getName(),
frontSocialUser.getCi())));
}
@Override
public Optional<GetUserSocial> createUserSocial(CreateUserSocialCmd cmd) {
// FrontUserSocial createUserSocial =
// frontUserSocialRepo.save(
// new FrontUserSocial(
// null,
// cmd.getUserId(),
// cmd.getSocialType(),
// cmd.getSocialId(),
// cmd.getEmail(),
// cmd.getName(),
// cmd.getCi()));
//
// return Optional.of(
// new GetUserSocial(
// createUserSocial.getSeq(),
// createUserSocial.getUserId(),
// createUserSocial.getSocialType(),
// createUserSocial.getSocialId(),
// createUserSocial.getEmail(),
// createUserSocial.getName(),
// createUserSocial.getCi()));
return null;
}
}

View File

@@ -0,0 +1,10 @@
package app.module.front.usecase.user.social.processSocialLogin.ports;
import app.module.core.config.adapters.web.security.domain.SocialUser;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.ProcessSocialLoginCmd;
import java.util.Optional;
public interface ProcessSocialLoginPortIn {
Optional<SocialUser> operate(ProcessSocialLoginCmd cmd);
}

View File

@@ -0,0 +1,17 @@
package app.module.front.usecase.user.social.processSocialLogin.ports;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.CreateUserSocialCmd;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.GetUserSocial;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.GetUserSocialCmd;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.ProcessSocialLogin;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.ProcessSocialLoginCmd;
import java.util.Optional;
public interface ProcessSocialLoginPortOut {
Optional<ProcessSocialLogin> operate(ProcessSocialLoginCmd cmd);
Optional<GetUserSocial> findUserSocial(GetUserSocialCmd cmd);
Optional<GetUserSocial> createUserSocial(CreateUserSocialCmd cmd);
}

View File

@@ -0,0 +1,131 @@
package app.module.front.usecase.user.social.processSocialLogin.ports.application;
import app.module.core.config.adapters.web.security.domain.CorePrivilege;
import app.module.core.config.adapters.web.security.domain.CoreRole;
import app.module.core.config.adapters.web.security.domain.SocialUser;
import app.module.core.config.application.enums.SignUpType;
import app.module.core.usecase.user.createUser.ports.CreateUserPortIn;
import app.module.core.usecase.user.createUser.ports.application.domain.CreateUserCmd;
import app.module.core.usecase.user.findUser.ports.FindUserPortIn;
import app.module.core.usecase.user.findUser.ports.application.domain.FindUser;
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
import app.module.front.usecase.user.social.parseSocialUser.ports.ParseSocialUserPortIn;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.ParseSocialUserCmd;
import app.module.front.usecase.user.social.parseSocialUser.ports.application.domain.ParsedUserInfo;
import app.module.front.usecase.user.social.processSocialLogin.ports.ProcessSocialLoginPortIn;
import app.module.front.usecase.user.social.processSocialLogin.ports.ProcessSocialLoginPortOut;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.CreateUserSocialCmd;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.GetUserSocialCmd;
import app.module.front.usecase.user.social.processSocialLogin.ports.application.domain.ProcessSocialLoginCmd;
import java.util.Collection;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
class ProcessSocialLoginService implements ProcessSocialLoginPortIn {
private final ProcessSocialLoginPortOut portOut;
private final ParseSocialUserPortIn parseSocialUserPortIn;
private final FindUserPortIn findUserPortIn;
private final CreateUserPortIn createUserPortIn;
@Override
public Optional<SocialUser> operate(ProcessSocialLoginCmd cmd) {
// SNS Login Provider 가 제공하는 사용자 정보 파싱
Optional<ParsedUserInfo> parsedUserInfo =
parseSocialUserPortIn.operate(
new ParseSocialUserCmd(
cmd.getSocialType(), cmd.getUserNameAttributeName(), cmd.getAttributes()));
if (parsedUserInfo.isPresent()) {
ParsedUserInfo parsedUser = parsedUserInfo.get();
return portOut
.findUserSocial(new GetUserSocialCmd(cmd.getSocialType(), parsedUser.getSocialId()))
.flatMap(
getUserSocial ->
findUserPortIn
.operate(new FindUserCmd(getUserSocial.getUserId()))
.flatMap(findUser -> getSocialUserOpt(findUser, cmd)))
.or(
() -> {
// 신규 회원인 경우,
String uuid = UUID.randomUUID().toString();
return createUserPortIn
.operate(
new CreateUserCmd(
uuid,
"NO_PASSWD",
parsedUser.getEmail(),
parsedUser.getNickName(),
SignUpType.SOCIAL,
false,
0,
false,
Set.of("ROLE_GENERAL")))
.flatMap(
createUser ->
portOut.createUserSocial(
new CreateUserSocialCmd(
createUser.getId(),
cmd.getSocialType(),
parsedUser.getSocialId(),
createUser.getEmail(),
parsedUser.getName(),
parsedUser.getCi())))
.flatMap(
getUserSocial ->
findUserPortIn
.operate(new FindUserCmd(getUserSocial.getUserId()))
.flatMap(findUser -> getSocialUserOpt(findUser, cmd)));
});
}
return Optional.empty();
}
private Optional<SocialUser> getSocialUserOpt(FindUser findUser, ProcessSocialLoginCmd cmd) {
boolean accountLocked = Optional.ofNullable(findUser.getAccountLocked()).orElse(false);
boolean accountDisabled = Optional.ofNullable(findUser.getAccountDisabled()).orElse(false);
return Optional.of(
new SocialUser(
getAuthorities(findUser.getRoles()),
cmd.getAttributes(),
cmd.getUserNameAttributeName(),
findUser.getId(),
findUser.getPassword(),
!accountDisabled,
true,
true,
!accountLocked,
findUser.getNickname(),
0L));
}
private Collection<? extends GrantedAuthority> getAuthorities(Collection<CoreRole> roles) {
return Stream.concat(getRoles(roles), getPrivileges(roles))
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toList());
}
private Stream<String> getRoles(Collection<CoreRole> roles) {
return roles.stream().map(CoreRole::getId);
}
private Stream<String> getPrivileges(Collection<CoreRole> roles) {
return roles.stream()
.flatMap(roleOutput -> roleOutput.getPrivileges().stream())
.map(CorePrivilege::getId);
}
}

View File

@@ -0,0 +1,26 @@
package app.module.front.usecase.user.social.processSocialLogin.ports.application.domain;
import app.module.core.config.application.enums.SocialType;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateUserSocialCmd {
private String userId;
private SocialType socialType;
private String socialId;
private String email;
private String name;
private String ci;
}

View File

@@ -0,0 +1,28 @@
package app.module.front.usecase.user.social.processSocialLogin.ports.application.domain;
import app.module.core.config.application.enums.SocialType;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetUserSocial {
private Integer seq;
private String userId;
private SocialType socialType;
private String socialId;
private String email;
private String name;
private String ci;
}

View File

@@ -0,0 +1,17 @@
package app.module.front.usecase.user.social.processSocialLogin.ports.application.domain;
import app.module.core.config.application.enums.SocialType;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetUserSocialCmd {
private SocialType socialType;
private String socialId;
}

View File

@@ -0,0 +1,14 @@
package app.module.front.usecase.user.social.processSocialLogin.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class ProcessSocialLogin {
}

View File

@@ -0,0 +1,19 @@
package app.module.front.usecase.user.social.processSocialLogin.ports.application.domain;
import app.module.core.config.application.enums.SocialType;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class ProcessSocialLoginCmd {
private SocialType socialType;
private String userNameAttributeName;
private Map<String, Object> attributes;
}

View File

@@ -0,0 +1,39 @@
package app.module.front.usecase.user.updateUser.adapters.web;
import app.module.core.config.application.util.CoreUtil;
import app.module.core.usecase.user.updateFrontUser.ports.UpdateFrontUserPortIn;
import app.module.core.usecase.user.updateFrontUser.ports.application.domain.UpdateFrontUserInCmd;
import app.module.front.usecase.user.updateUser.adapters.web.model.UpdateUserReqVO;
import app.module.front.usecase.user.updateUser.adapters.web.validator.UpdateUserValidator;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
class UpdateUserController {
private final UpdateFrontUserPortIn updateFrontUserPortIn;
private final UpdateUserValidator updateUserValidator;
private final CoreUtil coreUtil;
@PatchMapping(path = "/api/front/user/update")
ResponseEntity<?> operate(@Valid UpdateUserReqVO reqVO, BindingResult bindingResult) {
updateUserValidator.validate(reqVO, bindingResult);
if (bindingResult.hasErrors()) {
return coreUtil.getErrorInfo(bindingResult);
}
updateFrontUserPortIn.operate(
new UpdateFrontUserInCmd(
reqVO.getPassword(), reqVO.getEmail(), reqVO.getNickname(),
reqVO.getFileMappingId()));
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}
}

View File

@@ -0,0 +1,31 @@
package app.module.front.usecase.user.updateUser.adapters.web.model;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class UpdateUserReqVO {
@NotBlank(message = "{valid.common.required}")
private String id;
private String password;
private String passwordRe;
@NotBlank(message = "{valid.common.required}")
private String email;
@NotBlank(message = "{valid.common.required}")
@Pattern(regexp = "^[가-힣a-zA-Z0-9_-]{1,15}$", message = "{valid.common.nickname.wrong}")
private String nickname;
private List<String> fileMappingId;
}

View File

@@ -0,0 +1,40 @@
package app.module.front.usecase.user.updateUser.adapters.web.validator;
import app.module.front.usecase.user.updateUser.adapters.web.model.UpdateUserReqVO;
import java.util.Optional;
import org.springframework.stereotype.Component;
import org.springframework.validation.Errors;
import org.springframework.validation.Validator;
@Component
public class UpdateUserValidator implements Validator {
private final String PASSWORD_REGEX = "^((?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%_\\-])\\S{6,15})$";
private final String EMAIL_REGEX = "^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$";
@Override
public boolean supports(Class<?> clazz) {
return UpdateUserReqVO.class.equals(clazz);
}
@Override
public void validate(Object target, Errors errors) {
UpdateUserReqVO vo = (UpdateUserReqVO) target;
// 비밀번호
Optional.ofNullable(vo.getPassword())
.filter(password -> !password.isEmpty() && !password.matches(PASSWORD_REGEX))
.ifPresent(password -> errors.rejectValue("password", "valid.common.password.wrong"));
// 비밀번호 재확인
Optional.ofNullable(vo.getPasswordRe())
.filter(passwordRe -> !passwordRe.isEmpty() && !passwordRe.equals(vo.getPassword()))
.ifPresent(
passwordRe -> errors.rejectValue("passwordRe", "valid.common.re.password.wrong"));
// 이메일
Optional.ofNullable(vo.getEmail())
.filter(email -> !email.isEmpty() && !email.matches(EMAIL_REGEX))
.ifPresent(email -> errors.rejectValue("email", "valid.common.email.wrong"));
}
}

View File

@@ -0,0 +1,27 @@
package app.module.front.usecase.user.updateUserUI.adapters.web;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.user.findUser.ports.FindUserPortIn;
import app.module.core.usecase.user.findUser.ports.application.domain.FindUserCmd;
import app.module.front.usecase.user.updateUserUI.adapters.web.model.UpdateUserUIReqVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
@Controller
@RequiredArgsConstructor
class UpdateUserUIController {
private final FindUserPortIn findUserPortIn;
@GetMapping(path = "/user/info")
String operate(Model model, @ModelAttribute("reqVO") UpdateUserUIReqVO reqVO) {
model.addAttribute("userInfo",
findUserPortIn.operate(new FindUserCmd(CommonUtil.getLoginUsername())).orElseThrow());
return "user/info";
}
}

View File

@@ -0,0 +1,14 @@
package app.module.front.usecase.user.updateUserUI.adapters.web.model;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class UpdateUserUIReqVO {
}

View File

@@ -0,0 +1,9 @@
# ==============================================
# 로깅 설정
# ==============================================
logging:
file:
path: ${user.home}/logs # 로그 파일 저장 경로 (사용자 홈 디렉토리 하위 logs 폴더)
level:
app:
module: DEBUG # 애플리케이션 기본 패키지 로깅 레벨 (패키지 경로 변경 필요시 수정)

View File

@@ -0,0 +1,9 @@
# ==============================================
# 로깅 설정
# ==============================================
logging:
file:
path: ${user.home}/logs # 로그 파일 저장 경로 (사용자 홈 디렉토리 하위 logs 폴더)
level:
app:
module: DEBUG # 애플리케이션 기본 패키지 로깅 레벨 (패키지 경로 변경 필요시 수정)

View File

@@ -0,0 +1,9 @@
# ==============================================
# 로깅 설정
# ==============================================
logging:
file:
path: ${user.home}/logs # 로그 파일 저장 경로 (사용자 홈 디렉토리 하위 logs 폴더)
level:
app:
module: INFO # 애플리케이션 기본 패키지 로깅 레벨 (패키지 경로 변경 필요시 수정)

View File

@@ -0,0 +1,94 @@
# ==============================================
# 메세지 및 다국어 처리를 위한 설정
# ==============================================
spring:
messages:
basename: messages/exception,messages/validation,messages/uri,messages/operation
encoding: UTF-8
# gzip compression 설정
compression:
enabled: true
mime-types: text/html,text/xml,text/plain,text/css,text/javascript,application/javascript
min-response-size: 2048
# 정적 자원 캐싱 설정
web:
resources:
cache:
period: 31536000 # 캐싱 기간 1년(초)
chain:
strategy:
content:
enabled: true # 리소스 버저닝 활성화
paths: /** # 버저닝 적용 경로
# 타임리프 설정
thymeleaf:
cache: false # 타임리프 캐시 비활성화
# OAuth2 설정
security:
oauth2:
client:
registration:
naver:
client-id: vxAbBgwMTU0gXiMSCSGT # 네이버 개발자센터에서 발급받은 클라이언트 ID
client-secret: fBVwFSOcGd # 네이버 개발자센터에서 발급받은 클라이언트 시크릿 (보안 주의!)
redirect-uri: http://localhost:9001/login/oauth2/code/naver # 인증 후 리다이렉트될 URI
authorization-grant-type: authorization_code # OAuth2 인증 유형 (authorization_code 고정)
client-name: Naver # 로그인 화면에 표시될 프로바이더 이름
scope: name,email,birthday,phone # 요청할 사용자 정보 범위 (프로필, 이메일, 생일, 전화번호)
kakao:
client-id: 75ab31248046bef7b5077a07b9bee808 # 카카오 개발자센터에서 발급받은 클라이언트 ID
client-secret: 2YEhGfQ8fFTf3A5IexrrII8qvMzFw998 # 카카오 개발자센터에서 발급받은 클라이언트 시크릿
redirect-uri: http://localhost:9001/login/oauth2/code/kakao # 인증 후 리다이렉트 URI
authorization-grant-type: authorization_code
client-name: Kakao # 로그인 버튼에 표시될 이름
client-authentication-method: client_secret_post
scope: profile_nickname, profile_image # 카카오에서 지원하는 스코프 (필요한 정보 선택)
provider:
naver:
authorization-uri: https://nid.naver.com/oauth2.0/authorize # 인증 요청 URI
token-uri: https://nid.naver.com/oauth2.0/token # 토큰 발급 URI
user-info-uri: https://openapi.naver.com/v1/nid/me # 사용자 정보 조회 URI
user-name-attribute: response # 사용자 정보 응답에서 이름을 추출할 JSON 필드 경로
kakao:
authorization-uri: https://kauth.kakao.com/oauth/authorize # 카카오 인증 URI
token-uri: https://kauth.kakao.com/oauth/token # 토큰 발급 URI
user-info-uri: https://kapi.kakao.com/v2/user/me # 사용자 정보 조회 URI
user-name-attribute: id # 사용자 정보 응답에서 이름 추출할 필드 (기본값은 'id')
# ==============================================
# 프론트엔드 설정
# ==============================================
app:
front:
password:
validity:
period:
days: 90 # 패스워드 유효기간(일)
change:
notice:
period:
days: 7 # 패스워드 변경 공지 기간(만료일 기준 일수)
auth:
fail:
permit: 5 # 인증 실패 허용 횟수
session:
validity:
period:
seconds: 3600 # 세션 유효기간(초)
maximum:
num: 1 # 세션 최대 갯수 (1인 경우 중복 로그인 불가)
# ==============================================
# 로깅 설정
# ==============================================
logging:
level:
org:
hibernate:
orm:
jdbc:
bind: trace # Hibernate SQL 파라미터 바인딩 로깅

View File

@@ -0,0 +1,22 @@
┬─┐┌─┐┌─┐┬ ┬┌─┐┬ ┌─┐ ┌─┐┬─┐┌─┐┌┐┌┌┬┐
├┬┘├┤ │ └┬┘│ │ ├┤───├┤ ├┬┘│ ││││ │
┴└─└─┘└─┘ ┴ └─┘┴─┘└─┘ └ ┴└─└─┘┘└┘ ┴ - front module of recycle framework
.-"-.
/ .-. \
.'\/ \ \
,' \ \ \
/ /-' \ \ .
/ / ,\ '|
/ / '-._|
/ (_.'|_________) \
\__< ____________/
'.|
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
참고문서
https://docs.spring.io/spring-boot/docs/1.5.x/reference/html/howto-logging.html
스프링부트 Git Repository
https://github.com/spring-projects/spring-boot/tree/main/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback
에러 로그파일 생성
https://goddaehee.tistory.com/206
-->
<configuration>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="ERROR">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<charset>${FILE_LOG_CHARSET}</charset>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>
<file>${LOG_FILE_ERROR}</file>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>error</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_ERROR}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxFileSize>10MB</maxFileSize>
<maxHistory>30</maxHistory> <!-- 로그를 30일간 보관 -->
</rollingPolicy>
</appender>
<!-- <springProperty scope="context" name="ACTIVE_PROFILE" source="spring.profiles.active"/>-->
<!-- <property resource="application-${ACTIVE_PROFILE}.properties"/>-->
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
<include resource="org/springframework/boot/logging/logback/file-appender.xml"/>
<logger level="ERROR" name="com.amazonaws.util.EC2MetadataUtils"/>
<property name="APP_LOG_FILE" value="front-app"/>
<property name="LOG_FILE" value="${LOG_PATH}/${APP_LOG_FILE}.log"/>
<!-- ERROR 출력의 경우 (운영 관리의 편리함을 위해) 별도 파일을 추가로 생성해준다. -->
<property name="LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN"
value="${LOG_FILE}.%d{yyyy-MM-dd}.%i.log"/>
<property name="LOG_FILE_ERROR" value="${LOG_PATH}/${APP_LOG_FILE}-ERROR.log"/>
<!-- 시작시 불필요한 오류 제거 (EC2 Metadata Service) -->
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
<appender-ref ref="ERROR"/>
</root>
</configuration>

View File

@@ -0,0 +1,2 @@
exception.noSuchElement="{0}" - \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 {1} \uC785\uB2C8\uB2E4.
exception.file.no.extension=\uD655\uC7A5\uC790\uAC00 \uC5C6\uB294 \uD30C\uC77C - "{0}" \uC740(\uB294) \uC5C5\uB85C\uB4DC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.

View File

@@ -0,0 +1 @@
greeting=\uC548\uB155\uD558\uC138\uC694

View File

@@ -0,0 +1 @@
greeting=Hello

View File

@@ -0,0 +1,21 @@
operation.common.remove.choose=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC744 \uC120\uD0DD\uD558\uC138\uC694.
operation.common.remove.ask=\uC120\uD0DD\uD55C \uC544\uC774\uD15C\uC744 \uC815\uB9D0 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?
operation.common.remove.done=\uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
operation.common.save.done=\uC800\uC7A5\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
operation.common.move.done=\uC774\uB3D9\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
operation.board.article.remove.ask=\uAC8C\uC2DC\uBB3C\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?
operation.board.article.comment.remove.ask=\uB313\uAE00\uC744 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?
operation.board.exBoardEntity.updated=<span class="fw-bold">"{0}"</span> <span>\uAC8C\uC2DC\uBB3C\uC774 \uC218\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4!</span>
operation.board.exBoardEntity.created=<span class="fw-bold">"{0}"</span> <span>\uAC8C\uC2DC\uBB3C\uC774 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4!</span>
operation.board.exBoardEntity.removed=<span class="fw-bold">\uC120\uD0DD\uD55C \uAC8C\uC2DC\uBB3C</span>\uC774 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4!
operation.settings.admin.created=<span class="fw-bold">"{0}"</span> <span>\uAD00\uB9AC\uC790\uAC00 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4!</span>
operation.settings.admin.updated=<span class="fw-bold">"{0}"</span> <span>\uAD00\uB9AC\uC790\uAC00 \uC218\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4!</span>
operation.settings.admin.removed=<span class="fw-bold">\uC120\uD0DD\uD55C \uAD00\uB9AC\uC790</span>\uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4!
operation.uri.save.choose.first=\uC67C\uCABD Tree View \uC5D0\uC11C \uC800\uC7A5\uD560 URI \uB97C \uBA3C\uC800 \uC120\uD0DD\uD558\uC138\uC694.
operation.uri.remove.choose.first=\uC67C\uCABD Tree View \uC5D0\uC11C \uC0AD\uC81C\uD560 URI \uB97C \uBA3C\uC800 \uC120\uD0DD\uD558\uC138\uC694.
operation.uri.remove.ask=URI \uB97C \uC815\uB9D0 \uC0AD\uC81C\uD558\uC2DC\uACA0\uC2B5\uB2C8\uAE4C?
operation.uri.move.choose=\uC774\uB3D9\uD560 \uC544\uC774\uD15C\uC744 \uC120\uD0DD\uD574\uC8FC\uC138\uC694.
operation.uri.move.save.first=\uBA3C\uC800 \uC544\uC774\uD15C\uC744 \uC800\uC7A5\uD55C \uD6C4 \uC774\uB3D9\uD574\uC8FC\uC138\uC694.
operation.uri.move.cannot.before=\uB354\uC774\uC0C1 \uC774\uC804\uC73C\uB85C \uC774\uB3D9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
operation.uri.move.cannot.after=\uB354\uC774\uC0C1 \uB2E4\uC74C\uC73C\uB85C \uC774\uB3D9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
operation.role.save.choose.first=\uC800\uC7A5\uD560 '\uAD00\uB9AC\uC790 \uAD8C\uD55C' \uC744 \uBA3C\uC800 \uC120\uD0DD\uD558\uC138\uC694.

View File

@@ -0,0 +1,11 @@
uri=\uD648 \uD654\uBA74
uri.front=\uBA54\uC778 \uD398\uC774\uC9C0
#uri.front.board.exampleBoard=\uC608\uC81C \uAC8C\uC2DC\uD310
uri.front.board.articles=\uC608\uC81C \uAC8C\uC2DC\uD310
uri.front.board.exampleBoard.{{pathVar}}=\uC608\uC81C \uAC8C\uC2DC\uD310 \uC0C1\uC138\uBCF4\uAE30
uri.front.login=\uB85C\uADF8\uC778
uri.front.user.register=\uD68C\uC6D0\uAC00\uC785
uri.front.user.info=\uC815\uBCF4\uC218\uC815
uri.front.board.article.create=\uC608\uC81C \uAC8C\uC2DC\uD310 \uB4F1\uB85D
uri.front.board.article.{{pathVar}}=\uC608\uC81C \uAC8C\uC2DC\uD310 \uC0C1\uC138\uBCF4\uAE30
uri.front.board.article.update.{{pathVar}}=\uC608\uC81C \uAC8C\uC2DC\uD310 \uC218\uC815

View File

@@ -0,0 +1,11 @@
uri=Home
uri.front=Main
uri.front.board.exampleBoard=Example Board
uri.front.board.exampleBoard.{{pathVar}}=Example Board Detail View
uri.front.login=Login
uri.front.user.register=Register
uri.front.user.info=Edit Information
uri.front.board.article.create=Post Article
uri.front.board.article.{{pathVar}}=Article Detail View
uri.front.board.article.update.{{pathVar}}=Edit Article

View File

@@ -0,0 +1,18 @@
valid.common.required=\uD544\uC218\uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.
valid.common.required.size={0} \uAC1C \uD56D\uBAA9\uC774 \uB2F4\uACA8\uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
valid.common.required.size.min={0} \uAC1C \uC774\uC0C1 \uD56D\uBAA9\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.
valid.common.required.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
valid.common.id.wrong=\uC601\uBB38 \uB300\uC18C\uBB38\uC790(a-zA-Z), \uC22B\uC790(0-9), \uD558\uC774\uD508(-), \uC5B8\uB354\uBC14(_)\uC744 \uC774\uC6A9\uD574 6\uC790 \uC774\uC0C1 12\uC790 \uC774\uD558\uC778 \uC544\uC774\uB514\uB97C \uAE30\uC785\uD574\uC8FC\uC138\uC694.
valid.common.email.wrong=\uC774\uBA54\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
valid.common.nickname.wrong=\uB2C9\uB124\uC784(2-10\uAE00\uC790)\uC740 \uD55C\uAE00,\uC601\uC5B4 \uB300\uC18C\uBB38\uC790, -, _ \uB9CC \uC785\uB825\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
valid.common.password.wrong=6\uC790 \uC774\uC0C1 15\uC790 \uC774\uD558 \uB300,\uC18C,\uD2B9\uC218\uBB38\uC790\uAC00 \uD3EC\uD568 \uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
valid.common.re.password.wrong=\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.
valid.common.date.invalid=\uAC8C\uC2DC\uC77C\uC744 \uD655\uC778\uD574 \uC8FC\uC138\uC694.
valid.common.already.exists=\uC774\uBBF8 \uB4F1\uB85D\uB41C {0} \uC785\uB2C8\uB2E4.
valid.common.endWith.not=\uB9C8\uC9C0\uB9C9\uC774 "{0}"\uC73C\uB85C \uB05D\uB098\uC11C\uB294 \uC548\uB429\uB2C8\uB2E4.
valid.article.comment.required=\uB313\uAE00\uC744 \uC785\uB825\uD574\uC8FC\uC138\uC694.
valid.uri.firstchar=URI \uB294 '/'\uB85C \uC2DC\uC791\uB418\uC5B4\uC57C \uD569\uB2C8\uB2E4.
valid.uri.text=URI \uC124\uBA85(text)\uC744 \uC785\uB825\uD558\uC138\uC694.
valid.uri.uri=URI \uB97C \uC785\uB825\uD558\uC138\uC694.
valid.role.id.startWith=\uAD8C\uD55C\uC740 \uBC18\uB4DC\uC2DC 'ROLE_' \uB85C \uC2DC\uC791\uD574\uC57C\uD569\uB2C8\uB2E4.
uri.remove.prevent.root=\uCD5C\uC0C1\uC704 URI \uC568\uB9AC\uBA3C\uD2B8\uB294 \uC0AD\uC81C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.

View File

@@ -0,0 +1,907 @@
.flatpickr-calendar {
background: transparent;
opacity: 0;
display: none;
text-align: center;
visibility: hidden;
padding: 0;
-webkit-animation: none;
animation: none;
direction: ltr;
border: 0;
font-size: 14px;
line-height: 24px;
border-radius: 5px;
position: absolute;
width: 307.875px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-ms-touch-action: manipulation;
touch-action: manipulation;
background: #3f4458;
-webkit-box-shadow: 1px 0 0 #20222c, -1px 0 0 #20222c, 0 1px 0 #20222c, 0 -1px 0 #20222c, 0 3px 13px rgba(0, 0, 0, 0.08);
box-shadow: 1px 0 0 #20222c, -1px 0 0 #20222c, 0 1px 0 #20222c, 0 -1px 0 #20222c, 0 3px 13px rgba(0, 0, 0, 0.08);
}
.flatpickr-calendar.open,
.flatpickr-calendar.inline {
opacity: 1;
max-height: 640px;
visibility: visible;
}
.flatpickr-calendar.open {
display: inline-block;
z-index: 99999;
}
.flatpickr-calendar.animate.open {
-webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);
animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);
}
.flatpickr-calendar.inline {
display: block;
position: relative;
top: 2px;
}
.flatpickr-calendar.static {
position: absolute;
top: calc(100% + 2px);
}
.flatpickr-calendar.static.open {
z-index: 999;
display: block;
}
.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7) {
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1) {
-webkit-box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
box-shadow: -2px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
}
.flatpickr-calendar .hasWeeks .dayContainer,
.flatpickr-calendar .hasTime .dayContainer {
border-bottom: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.flatpickr-calendar .hasWeeks .dayContainer {
border-left: 0;
}
.flatpickr-calendar.hasTime .flatpickr-time {
height: 40px;
border-top: 1px solid #20222c;
}
.flatpickr-calendar.noCalendar.hasTime .flatpickr-time {
height: auto;
}
.flatpickr-calendar:before,
.flatpickr-calendar:after {
position: absolute;
display: block;
pointer-events: none;
border: solid transparent;
content: '';
height: 0;
width: 0;
left: 22px;
}
.flatpickr-calendar.rightMost:before,
.flatpickr-calendar.arrowRight:before,
.flatpickr-calendar.rightMost:after,
.flatpickr-calendar.arrowRight:after {
left: auto;
right: 22px;
}
.flatpickr-calendar.arrowCenter:before,
.flatpickr-calendar.arrowCenter:after {
left: 50%;
right: 50%;
}
.flatpickr-calendar:before {
border-width: 5px;
margin: 0 -5px;
}
.flatpickr-calendar:after {
border-width: 4px;
margin: 0 -4px;
}
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after {
bottom: 100%;
}
.flatpickr-calendar.arrowTop:before {
border-bottom-color: #20222c;
}
.flatpickr-calendar.arrowTop:after {
border-bottom-color: #3f4458;
}
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
top: 100%;
}
.flatpickr-calendar.arrowBottom:before {
border-top-color: #20222c;
}
.flatpickr-calendar.arrowBottom:after {
border-top-color: #3f4458;
}
.flatpickr-calendar:focus {
outline: 0;
}
.flatpickr-wrapper {
position: relative;
display: inline-block;
}
.flatpickr-months {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flatpickr-months .flatpickr-month {
background: #3f4458;
color: #fff;
fill: #fff;
height: 34px;
line-height: 1;
text-align: center;
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
overflow: hidden;
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
text-decoration: none;
cursor: pointer;
position: absolute;
top: 0;
height: 34px;
padding: 10px;
z-index: 3;
color: #fff;
fill: #fff;
}
.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,
.flatpickr-months .flatpickr-next-month.flatpickr-disabled {
display: none;
}
.flatpickr-months .flatpickr-prev-month i,
.flatpickr-months .flatpickr-next-month i {
position: relative;
}
.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month.flatpickr-prev-month {
/*
/*rtl:begin:ignore*/
/*
*/
left: 0;
/*
/*rtl:end:ignore*/
/*
*/
}
/*
/*rtl:begin:ignore*/
/*
/*rtl:end:ignore*/
.flatpickr-months .flatpickr-prev-month.flatpickr-next-month,
.flatpickr-months .flatpickr-next-month.flatpickr-next-month {
/*
/*rtl:begin:ignore*/
/*
*/
right: 0;
/*
/*rtl:end:ignore*/
/*
*/
}
/*
/*rtl:begin:ignore*/
/*
/*rtl:end:ignore*/
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
color: #eee;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
fill: #f64747;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
width: 14px;
height: 14px;
}
.flatpickr-months .flatpickr-prev-month svg path,
.flatpickr-months .flatpickr-next-month svg path {
-webkit-transition: fill 0.1s;
transition: fill 0.1s;
fill: inherit;
}
.numInputWrapper {
position: relative;
height: auto;
}
.numInputWrapper input,
.numInputWrapper span {
display: inline-block;
}
.numInputWrapper input {
width: 100%;
}
.numInputWrapper input::-ms-clear {
display: none;
}
.numInputWrapper input::-webkit-outer-spin-button,
.numInputWrapper input::-webkit-inner-spin-button {
margin: 0;
-webkit-appearance: none;
}
.numInputWrapper span {
position: absolute;
right: 0;
width: 14px;
padding: 0 4px 0 2px;
height: 50%;
line-height: 50%;
opacity: 0;
cursor: pointer;
border: 1px solid rgba(255, 255, 255, 0.15);
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.numInputWrapper span:hover {
background: rgba(192, 187, 167, 0.1);
}
.numInputWrapper span:active {
background: rgba(192, 187, 167, 0.2);
}
.numInputWrapper span:after {
display: block;
content: "";
position: absolute;
}
.numInputWrapper span.arrowUp {
top: 0;
border-bottom: 0;
}
.numInputWrapper span.arrowUp:after {
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-bottom: 4px solid rgba(255, 255, 255, 0.6);
top: 26%;
}
.numInputWrapper span.arrowDown {
top: 50%;
}
.numInputWrapper span.arrowDown:after {
border-left: 4px solid transparent;
border-right: 4px solid transparent;
border-top: 4px solid rgba(255, 255, 255, 0.6);
top: 40%;
}
.numInputWrapper span svg {
width: inherit;
height: auto;
}
.numInputWrapper span svg path {
fill: rgba(255, 255, 255, 0.5);
}
.numInputWrapper:hover {
background: rgba(192, 187, 167, 0.05);
}
.numInputWrapper:hover span {
opacity: 1;
}
.flatpickr-current-month {
font-size: 135%;
line-height: inherit;
font-weight: 300;
color: inherit;
position: absolute;
width: 75%;
left: 12.5%;
padding: 7.48px 0 0 0;
line-height: 1;
height: 34px;
display: inline-block;
text-align: center;
-webkit-transform: translate3d(0px, 0px, 0px);
transform: translate3d(0px, 0px, 0px);
}
.flatpickr-current-month span.cur-month {
font-family: inherit;
font-weight: 700;
color: inherit;
display: inline-block;
margin-left: 0.5ch;
padding: 0;
}
.flatpickr-current-month span.cur-month:hover {
background: rgba(192, 187, 167, 0.05);
}
.flatpickr-current-month .numInputWrapper {
width: 6ch;
width: 7ch \0;
display: inline-block;
}
.flatpickr-current-month .numInputWrapper span.arrowUp:after {
border-bottom-color: #fff;
}
.flatpickr-current-month .numInputWrapper span.arrowDown:after {
border-top-color: #fff;
}
.flatpickr-current-month input.cur-year {
background: transparent;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: inherit;
cursor: text;
padding: 0 0 0 0.5ch;
margin: 0;
display: inline-block;
font-size: inherit;
font-family: inherit;
font-weight: 300;
line-height: inherit;
height: auto;
border: 0;
border-radius: 0;
vertical-align: initial;
-webkit-appearance: textfield;
-moz-appearance: textfield;
appearance: textfield;
}
.flatpickr-current-month input.cur-year:focus {
outline: 0;
}
.flatpickr-current-month input.cur-year[disabled],
.flatpickr-current-month input.cur-year[disabled]:hover {
font-size: 100%;
color: rgba(255, 255, 255, 0.5);
background: transparent;
pointer-events: none;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
appearance: menulist;
background: #3f4458;
border: none;
border-radius: 0;
box-sizing: border-box;
color: inherit;
cursor: pointer;
font-size: inherit;
font-family: inherit;
font-weight: 300;
height: auto;
line-height: inherit;
margin: -1px 0 0 0;
outline: none;
padding: 0 0 0 0.5ch;
position: relative;
vertical-align: initial;
-webkit-box-sizing: border-box;
-webkit-appearance: menulist;
-moz-appearance: menulist;
width: auto;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:focus,
.flatpickr-current-month .flatpickr-monthDropdown-months:active {
outline: none;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover {
background: rgba(192, 187, 167, 0.05);
}
.flatpickr-current-month .flatpickr-monthDropdown-months .flatpickr-monthDropdown-month {
background-color: #3f4458;
outline: none;
padding: 0;
}
.flatpickr-weekdays {
background: transparent;
text-align: center;
overflow: hidden;
width: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
height: 28px;
}
.flatpickr-weekdays .flatpickr-weekdaycontainer {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
}
span.flatpickr-weekday {
cursor: default;
font-size: 90%;
background: #3f4458;
color: #fff;
line-height: 1;
margin: 0;
text-align: center;
display: block;
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
font-weight: bolder;
}
.dayContainer,
.flatpickr-weeks {
padding: 1px 0 0 0;
}
.flatpickr-days {
position: relative;
overflow: hidden;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-webkit-align-items: flex-start;
-ms-flex-align: start;
align-items: flex-start;
width: 307.875px;
}
.flatpickr-days:focus {
outline: 0;
}
.dayContainer {
padding: 0;
outline: 0;
text-align: left;
width: 307.875px;
min-width: 307.875px;
max-width: 307.875px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: inline-block;
display: -ms-flexbox;
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
-ms-flex-wrap: wrap;
-ms-flex-pack: justify;
-webkit-justify-content: space-around;
justify-content: space-around;
-webkit-transform: translate3d(0px, 0px, 0px);
transform: translate3d(0px, 0px, 0px);
opacity: 1;
}
.dayContainer + .dayContainer {
-webkit-box-shadow: -1px 0 0 #20222c;
box-shadow: -1px 0 0 #20222c;
}
.flatpickr-day {
background: none;
border: 1px solid transparent;
border-radius: 150px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: rgba(255, 255, 255, 0.95);
cursor: pointer;
font-weight: 400;
width: 14.2857143%;
-webkit-flex-basis: 14.2857143%;
-ms-flex-preferred-size: 14.2857143%;
flex-basis: 14.2857143%;
max-width: 39px;
height: 39px;
line-height: 39px;
margin: 0;
display: inline-block;
position: relative;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
text-align: center;
}
.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay.inRange,
.flatpickr-day.nextMonthDay.inRange,
.flatpickr-day.today.inRange,
.flatpickr-day.prevMonthDay.today.inRange,
.flatpickr-day.nextMonthDay.today.inRange,
.flatpickr-day:hover,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover,
.flatpickr-day:focus,
.flatpickr-day.prevMonthDay:focus,
.flatpickr-day.nextMonthDay:focus {
cursor: pointer;
outline: 0;
background: #646c8c;
border-color: #646c8c;
}
.flatpickr-day.today {
border-color: #eee;
}
.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
border-color: #eee;
background: #eee;
color: #3f4458;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected.inRange,
.flatpickr-day.startRange.inRange,
.flatpickr-day.endRange.inRange,
.flatpickr-day.selected:focus,
.flatpickr-day.startRange:focus,
.flatpickr-day.endRange:focus,
.flatpickr-day.selected:hover,
.flatpickr-day.startRange:hover,
.flatpickr-day.endRange:hover,
.flatpickr-day.selected.prevMonthDay,
.flatpickr-day.startRange.prevMonthDay,
.flatpickr-day.endRange.prevMonthDay,
.flatpickr-day.selected.nextMonthDay,
.flatpickr-day.startRange.nextMonthDay,
.flatpickr-day.endRange.nextMonthDay {
background: #80cbc4;
-webkit-box-shadow: none;
box-shadow: none;
color: #fff;
border-color: #80cbc4;
}
.flatpickr-day.selected.startRange,
.flatpickr-day.startRange.startRange,
.flatpickr-day.endRange.startRange {
border-radius: 50px 0 0 50px;
}
.flatpickr-day.selected.endRange,
.flatpickr-day.startRange.endRange,
.flatpickr-day.endRange.endRange {
border-radius: 0 50px 50px 0;
}
.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),
.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),
.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {
-webkit-box-shadow: -10px 0 0 #80cbc4;
box-shadow: -10px 0 0 #80cbc4;
}
.flatpickr-day.selected.startRange.endRange,
.flatpickr-day.startRange.startRange.endRange,
.flatpickr-day.endRange.startRange.endRange {
border-radius: 50px;
}
.flatpickr-day.inRange {
border-radius: 0;
-webkit-box-shadow: -5px 0 0 #646c8c, 5px 0 0 #646c8c;
box-shadow: -5px 0 0 #646c8c, 5px 0 0 #646c8c;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay,
.flatpickr-day.notAllowed,
.flatpickr-day.notAllowed.prevMonthDay,
.flatpickr-day.notAllowed.nextMonthDay {
color: rgba(255, 255, 255, 0.3);
background: transparent;
border-color: transparent;
cursor: default;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
cursor: not-allowed;
color: rgba(255, 255, 255, 0.1);
}
.flatpickr-day.week.selected {
border-radius: 0;
-webkit-box-shadow: -5px 0 0 #80cbc4, 5px 0 0 #80cbc4;
box-shadow: -5px 0 0 #80cbc4, 5px 0 0 #80cbc4;
}
.flatpickr-day.hidden {
visibility: hidden;
}
.rangeMode .flatpickr-day {
margin-top: 1px;
}
.flatpickr-weekwrapper {
float: left;
}
.flatpickr-weekwrapper .flatpickr-weeks {
padding: 0 12px;
-webkit-box-shadow: 1px 0 0 #20222c;
box-shadow: 1px 0 0 #20222c;
}
.flatpickr-weekwrapper .flatpickr-weekday {
float: none;
width: 100%;
line-height: 28px;
}
.flatpickr-weekwrapper span.flatpickr-day,
.flatpickr-weekwrapper span.flatpickr-day:hover {
display: block;
width: 100%;
max-width: none;
color: rgba(255, 255, 255, 0.3);
background: transparent;
cursor: default;
border: none;
}
.flatpickr-innerContainer {
display: block;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
}
.flatpickr-rContainer {
display: inline-block;
padding: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.flatpickr-time {
text-align: center;
outline: 0;
display: block;
height: 0;
line-height: 40px;
max-height: 40px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.flatpickr-time:after {
content: "";
display: table;
clear: both;
}
.flatpickr-time .numInputWrapper {
-webkit-box-flex: 1;
-webkit-flex: 1;
-ms-flex: 1;
flex: 1;
width: 40%;
height: 40px;
float: left;
}
.flatpickr-time .numInputWrapper span.arrowUp:after {
border-bottom-color: rgba(255, 255, 255, 0.95);
}
.flatpickr-time .numInputWrapper span.arrowDown:after {
border-top-color: rgba(255, 255, 255, 0.95);
}
.flatpickr-time.hasSeconds .numInputWrapper {
width: 26%;
}
.flatpickr-time.time24hr .numInputWrapper {
width: 49%;
}
.flatpickr-time input {
background: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border: 0;
border-radius: 0;
text-align: center;
margin: 0;
padding: 0;
height: inherit;
line-height: inherit;
color: rgba(255, 255, 255, 0.95);
font-size: 14px;
position: relative;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-appearance: textfield;
-moz-appearance: textfield;
appearance: textfield;
}
.flatpickr-time input.flatpickr-hour {
font-weight: bold;
}
.flatpickr-time input.flatpickr-minute,
.flatpickr-time input.flatpickr-second {
font-weight: 400;
}
.flatpickr-time input:focus {
outline: 0;
border: 0;
}
.flatpickr-time .flatpickr-time-separator,
.flatpickr-time .flatpickr-am-pm {
height: inherit;
float: left;
line-height: inherit;
color: rgba(255, 255, 255, 0.95);
font-weight: bold;
width: 2%;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-align-self: center;
-ms-flex-item-align: center;
align-self: center;
}
.flatpickr-time .flatpickr-am-pm {
outline: 0;
width: 18%;
cursor: pointer;
text-align: center;
font-weight: 400;
}
.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
background: #6a7395;
}
.flatpickr-input[readonly] {
cursor: pointer;
}
@-webkit-keyframes fpFadeInDown {
from {
opacity: 0;
-webkit-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0);
}
to {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}
@keyframes fpFadeInDown {
from {
opacity: 0;
-webkit-transform: translate3d(0, -20px, 0);
transform: translate3d(0, -20px, 0);
}
to {
opacity: 1;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
$.fn.serializeObject=function(){"use strict";var a={},b=function(b,c){var d=a[c.name];"undefined"!=typeof d&&d!==null?$.isArray(d)?d.push(c.value):a[c.name]=[d,c.value]:a[c.name]=c.value};return $.each(this.serializeArray(),b),a};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,469 @@
/*!
* jsUri
* https://github.com/derek-watson/jsUri
*
* Copyright 2013, Derek Watson
* Released under the MIT license.
*
* Includes parseUri regular expressions
* http://blog.stevenlevithan.com/archives/parseuri
* Copyright 2007, Steven Levithan
* Released under the MIT license.
*/
/*globals define, module */
(function (global) {
var re = {
starts_with_slashes: /^\/+/,
ends_with_slashes: /\/+$/,
pluses: /\+/g,
query_separator: /[&;]/,
uri_parser: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*)(?::([^:@\/]*))?)?@)?(\[[0-9a-fA-F:.]+\]|[^:\/?#]*)(?::(\d+|(?=:)))?(:)?)((((?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
};
/**
* Define forEach for older js environments
* @see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach#Compatibility
*/
if (!Array.prototype.forEach) {
Array.prototype.forEach = function (callback, thisArg) {
var T, k;
if (this == null) {
throw new TypeError(' this is null or not defined');
}
var O = Object(this);
var len = O.length >>> 0;
if (typeof callback !== "function") {
throw new TypeError(callback + ' is not a function');
}
if (arguments.length > 1) {
T = thisArg;
}
k = 0;
while (k < len) {
var kValue;
if (k in O) {
kValue = O[k];
callback.call(T, kValue, k, O);
}
k++;
}
};
}
/**
* unescape a query param value
* @param {string} s encoded value
* @return {string} decoded value
*/
function decode(s) {
if (s) {
s = s.toString().replace(re.pluses, '%20');
s = decodeURIComponent(s);
}
return s;
}
/**
* Breaks a uri string down into its individual parts
* @param {string} str uri
* @return {object} parts
*/
function parseUri(str) {
var parser = re.uri_parser;
var parserKeys = ["source", "protocol", "authority", "userInfo", "user",
"password", "host", "port", "isColonUri", "relative", "path", "directory",
"file", "query", "anchor"];
var m = parser.exec(str || '');
var parts = {};
parserKeys.forEach(function (key, i) {
parts[key] = m[i] || '';
});
return parts;
}
/**
* Breaks a query string down into an array of key/value pairs
* @param {string} str query
* @return {array} array of arrays (key/value pairs)
*/
function parseQuery(str) {
var i, ps, p, n, k, v, l;
var pairs = [];
if (typeof (str) === 'undefined' || str === null || str === '') {
return pairs;
}
if (str.indexOf('?') === 0) {
str = str.substring(1);
}
ps = str.toString().split(re.query_separator);
for (i = 0, l = ps.length; i < l; i++) {
p = ps[i];
n = p.indexOf('=');
if (n !== 0) {
k = decode(p.substring(0, n));
v = decode(p.substring(n + 1));
pairs.push(n === -1 ? [p, null] : [k, v]);
}
}
return pairs;
}
/**
* Creates a new Uri object
* @constructor
* @param {string} str
*/
function Uri(str) {
this.uriParts = parseUri(str);
this.queryPairs = parseQuery(this.uriParts.query);
this.hasAuthorityPrefixUserPref = null;
}
/**
* Define getter/setter methods
*/
['protocol', 'userInfo', 'host', 'port', 'path', 'anchor'].forEach(
function (key) {
Uri.prototype[key] = function (val) {
if (typeof val !== 'undefined') {
this.uriParts[key] = val;
}
return this.uriParts[key];
};
});
/**
* if there is no protocol, the leading // can be enabled or disabled
* @param {Boolean} val
* @return {Boolean}
*/
Uri.prototype.hasAuthorityPrefix = function (val) {
if (typeof val !== 'undefined') {
this.hasAuthorityPrefixUserPref = val;
}
if (this.hasAuthorityPrefixUserPref === null) {
return (this.uriParts.source.indexOf('//') !== -1);
} else {
return this.hasAuthorityPrefixUserPref;
}
};
Uri.prototype.isColonUri = function (val) {
if (typeof val !== 'undefined') {
this.uriParts.isColonUri = !!val;
} else {
return !!this.uriParts.isColonUri;
}
};
/**
* Serializes the internal state of the query pairs
* @param {string} [val] set a new query string
* @return {string} query string
*/
Uri.prototype.query = function (val) {
var s = '', i, param, l;
if (typeof val !== 'undefined') {
this.queryPairs = parseQuery(val);
}
for (i = 0, l = this.queryPairs.length; i < l; i++) {
param = this.queryPairs[i];
if (s.length > 0) {
s += '&';
}
if (param[1] === null) {
s += param[0];
} else {
s += param[0];
s += '=';
if (typeof param[1] !== 'undefined') {
s += encodeURIComponent(param[1]);
}
}
}
return s.length > 0 ? '?' + s : s;
};
/**
* returns the first query param value found for the key
* @param {string} key query key
* @return {string} first value found for key
*/
Uri.prototype.getQueryParamValue = function (key) {
var param, i, l;
for (i = 0, l = this.queryPairs.length; i < l; i++) {
param = this.queryPairs[i];
if (key === param[0]) {
return param[1];
}
}
};
/**
* returns an array of query param values for the key
* @param {string} key query key
* @return {array} array of values
*/
Uri.prototype.getQueryParamValues = function (key) {
var arr = [], i, param, l;
for (i = 0, l = this.queryPairs.length; i < l; i++) {
param = this.queryPairs[i];
if (key === param[0]) {
arr.push(param[1]);
}
}
return arr;
};
/**
* removes query parameters
* @param {string} key remove values for key
* @param {val} [val] remove a specific value, otherwise removes all
* @return {Uri} returns self for fluent chaining
*/
Uri.prototype.deleteQueryParam = function (key, val) {
var arr = [], i, param, keyMatchesFilter, valMatchesFilter, l;
for (i = 0, l = this.queryPairs.length; i < l; i++) {
param = this.queryPairs[i];
keyMatchesFilter = decode(param[0]) === decode(key);
valMatchesFilter = param[1] === val;
if ((arguments.length === 1 && !keyMatchesFilter) || (arguments.length
=== 2 && (!keyMatchesFilter || !valMatchesFilter))) {
arr.push(param);
}
}
this.queryPairs = arr;
return this;
};
/**
* adds a query parameter
* @param {string} key add values for key
* @param {string} val value to add
* @param {integer} [index] specific index to add the value at
* @return {Uri} returns self for fluent chaining
*/
Uri.prototype.addQueryParam = function (key, val, index) {
if (arguments.length === 3 && index !== -1) {
index = Math.min(index, this.queryPairs.length);
this.queryPairs.splice(index, 0, [key, val]);
} else if (arguments.length > 0) {
this.queryPairs.push([key, val]);
}
return this;
};
/**
* test for the existence of a query parameter
* @param {string} key check values for key
* @return {Boolean} true if key exists, otherwise false
*/
Uri.prototype.hasQueryParam = function (key) {
var i, len = this.queryPairs.length;
for (i = 0; i < len; i++) {
if (this.queryPairs[i][0] == key) {
return true;
}
}
return false;
};
/**
* replaces query param values
* @param {string} key key to replace value for
* @param {string} newVal new value
* @param {string} [oldVal] replace only one specific value (otherwise replaces all)
* @return {Uri} returns self for fluent chaining
*/
Uri.prototype.replaceQueryParam = function (key, newVal, oldVal) {
var index = -1, len = this.queryPairs.length, i, param;
if (arguments.length === 3) {
for (i = 0; i < len; i++) {
param = this.queryPairs[i];
if (decode(param[0]) === decode(key) && decodeURIComponent(param[1])
=== decode(oldVal)) {
index = i;
break;
}
}
if (index >= 0) {
this.deleteQueryParam(key, decode(oldVal)).addQueryParam(key, newVal,
index);
}
} else {
for (i = 0; i < len; i++) {
param = this.queryPairs[i];
if (decode(param[0]) === decode(key)) {
index = i;
break;
}
}
this.deleteQueryParam(key);
this.addQueryParam(key, newVal, index);
}
return this;
};
/**
* Define fluent setter methods (setProtocol, setHasAuthorityPrefix, etc)
*/
['protocol', 'hasAuthorityPrefix', 'isColonUri', 'userInfo', 'host', 'port',
'path', 'query', 'anchor'].forEach(function (key) {
var method = 'set' + key.charAt(0).toUpperCase() + key.slice(1);
Uri.prototype[method] = function (val) {
this[key](val);
return this;
};
});
/**
* Scheme name, colon and doubleslash, as required
* @return {string} http:// or possibly just //
*/
Uri.prototype.scheme = function () {
var s = '';
if (this.protocol()) {
s += this.protocol();
if (this.protocol().indexOf(':') !== this.protocol().length - 1) {
s += ':';
}
s += '//';
} else {
if (this.hasAuthorityPrefix() && this.host()) {
s += '//';
}
}
return s;
};
/**
* Same as Mozilla nsIURI.prePath
* @return {string} scheme://user:password@host:port
* @see https://developer.mozilla.org/en/nsIURI
*/
Uri.prototype.origin = function () {
var s = this.scheme();
if (this.userInfo() && this.host()) {
s += this.userInfo();
if (this.userInfo().indexOf('@') !== this.userInfo().length - 1) {
s += '@';
}
}
if (this.host()) {
s += this.host();
if (this.port() || (this.path() && this.path().substr(0, 1).match(
/[0-9]/))) {
s += ':' + this.port();
}
}
return s;
};
/**
* Adds a trailing slash to the path
*/
Uri.prototype.addTrailingSlash = function () {
var path = this.path() || '';
if (path.substr(-1) !== '/') {
this.path(path + '/');
}
return this;
};
/**
* Serializes the internal state of the Uri object
* @return {string}
*/
Uri.prototype.toString = function () {
var path, s = this.origin();
if (this.isColonUri()) {
if (this.path()) {
s += ':' + this.path();
}
} else if (this.path()) {
path = this.path();
if (!(re.ends_with_slashes.test(s) || re.starts_with_slashes.test(
path))) {
s += '/';
} else {
if (s) {
s.replace(re.ends_with_slashes, '/');
}
path = path.replace(re.starts_with_slashes, '/');
}
s += path;
} else {
if (this.host() && (this.query().toString() || this.anchor())) {
s += '/';
}
}
if (this.query().toString()) {
s += this.query().toString();
}
if (this.anchor()) {
if (this.anchor().indexOf('#') !== 0) {
s += '#';
}
s += this.anchor();
}
return s;
};
/**
* Clone a Uri object
* @return {Uri} duplicate copy of the Uri
*/
Uri.prototype.clone = function () {
return new Uri(this.toString());
};
/**
* export via AMD or CommonJS, otherwise leak a global
*/
if (typeof define === 'function' && define.amd) {
define(function () {
return Uri;
});
} else if (typeof module !== 'undefined' && typeof module.exports
!== 'undefined') {
module.exports = Uri;
} else {
global.Uri = Uri;
}
}(this));

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
This is where language files should be placed.
Please DO NOT translate these directly use this
service: https://www.transifex.com/projects/p/tinymce/

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
/**
* TinyMCE version 6.0.3 (2022-05-25)
*/
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=(t,e,r)=>{const s="UL"===e?"InsertUnorderedList":"InsertOrderedList";t.execCommand(s,!1,!1===r?null:{"list-style-type":r})},r=t=>e=>e.options.get(t),s=r("advlist_number_styles"),n=r("advlist_bullet_styles");var i=tinymce.util.Tools.resolve("tinymce.util.Tools");class l{constructor(t,e){this.tag=t,this.value=e}static some(t){return new l(!0,t)}static none(){return l.singletonNone}fold(t,e){return this.tag?e(this.value):t()}isSome(){return this.tag}isNone(){return!this.tag}map(t){return this.tag?l.some(t(this.value)):l.none()}bind(t){return this.tag?t(this.value):l.none()}exists(t){return this.tag&&t(this.value)}forall(t){return!this.tag||t(this.value)}filter(t){return!this.tag||t(this.value)?this:l.none()}getOr(t){return this.tag?this.value:t}or(t){return this.tag?this:t}getOrThunk(t){return this.tag?this.value:t()}orThunk(t){return this.tag?this:t()}getOrDie(t){if(this.tag)return this.value;throw new Error(null!=t?t:"Called getOrDie on None")}static from(t){return null==t?l.none():l.some(t)}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(t){this.tag&&t(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}l.singletonNone=new l(!1);const o=t=>t&&/^(TH|TD)$/.test(t.nodeName),a=(t,e)=>r=>{const s=s=>{r.setActive(((t,e,r)=>{const s=((t,e)=>{for(let r=0;r<t.length;r++)if(e(t[r]))return r;return-1})(e.parents,o),n=-1!==s?e.parents.slice(0,s):e.parents,l=i.grep(n,(t=>e=>e&&/^(OL|UL|DL)$/.test(e.nodeName)&&((t,e)=>t.dom.isChildOf(e,t.getBody()))(t,e))(t));return l.length>0&&l[0].nodeName===r})(t,s,e))};return t.on("NodeChange",s),()=>t.off("NodeChange",s)},u=(t,r,s,n,o,u)=>{u.length>1?((t,r,s,n,o,u)=>{t.ui.registry.addSplitButton(r,{tooltip:s,icon:"OL"===o?"ordered-list":"unordered-list",presets:"listpreview",columns:3,fetch:t=>{t(i.map(u,(t=>{const e="OL"===o?"num":"bull",r="disc"===t||"decimal"===t?"default":t,s="default"===t?"":t,n=(t=>t.replace(/\-/g," ").replace(/\b\w/g,(t=>t.toUpperCase())))(t);return{type:"choiceitem",value:s,icon:"list-"+e+"-"+r,text:n}})))},onAction:()=>t.execCommand(n),onItemAction:(r,s)=>{e(t,o,s)},select:e=>{const r=(t=>{const e=t.dom.getParent(t.selection.getNode(),"ol,ul"),r=t.dom.getStyle(e,"listStyleType");return l.from(r)})(t);return r.map((t=>e===t)).getOr(!1)},onSetup:a(t,o)})})(t,r,s,n,o,u):((t,e,r,s,n,i)=>{t.ui.registry.addToggleButton(e,{active:!1,tooltip:r,icon:"OL"===n?"ordered-list":"unordered-list",onSetup:a(t,n),onAction:()=>t.execCommand(s)})})(t,r,s,n,o)};t.add("advlist",(t=>{t.hasPlugin("lists")?((t=>{const e=t.options.register;e("advlist_number_styles",{processor:"string[]",default:"default,lower-alpha,lower-greek,lower-roman,upper-alpha,upper-roman".split(",")}),e("advlist_bullet_styles",{processor:"string[]",default:"default,circle,square".split(",")})})(t),(t=>{u(t,"numlist","Numbered list","InsertOrderedList","OL",s(t)),u(t,"bullist","Bullet list","InsertUnorderedList","UL",n(t))})(t),(t=>{t.addCommand("ApplyUnorderedListStyle",((r,s)=>{e(t,"UL",s["list-style-type"])})),t.addCommand("ApplyOrderedListStyle",((r,s)=>{e(t,"OL",s["list-style-type"])}))})(t)):console.error("Please use the Lists plugin together with the Advanced List plugin.")}))}();

View File

@@ -0,0 +1,4 @@
/**
* TinyMCE version 6.0.3 (2022-05-25)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.dom.RangeUtils"),n=tinymce.util.Tools.resolve("tinymce.util.Tools");const o=("allow_html_in_named_anchor",e=>e.options.get("allow_html_in_named_anchor"));const a="a:not([href])",r=e=>!e,i=e=>e.getAttribute("id")||e.getAttribute("name")||"",l=e=>(e=>e&&"a"===e.nodeName.toLowerCase())(e)&&!e.getAttribute("href")&&""!==i(e),s=e=>e.dom.getParent(e.selection.getStart(),a),c=(e,a)=>{const r=s(e);r?((e,t,n)=>{n.removeAttribute("name"),n.id=t,e.addVisual(),e.undoManager.add()})(e,a,r):((e,a)=>{e.undoManager.transact((()=>{o(e)||e.selection.collapse(!0),e.selection.isCollapsed()?e.insertContent(e.dom.createHTML("a",{id:a})):((e=>{const o=e.dom;t(o).walk(e.selection.getRng(),(e=>{n.each(e,(e=>{var t;l(t=e)&&!t.firstChild&&o.remove(e,!1)}))}))})(e),e.formatter.remove("namedAnchor",null,null,!0),e.formatter.apply("namedAnchor",{value:a}),e.addVisual())}))})(e,a),e.focus()},d=e=>(e=>e&&r(e.attr("href"))&&!r(e.attr("id")||e.attr("name")))(e)&&!e.firstChild,m=e=>t=>{for(let n=0;n<t.length;n++){const o=t[n];d(o)&&o.attr("contenteditable",e)}};e.add("anchor",(e=>{(e=>{(0,e.options.register)("allow_html_in_named_anchor",{processor:"boolean",default:!1})})(e),(e=>{e.on("PreInit",(()=>{e.parser.addNodeFilter("a",m("false")),e.serializer.addNodeFilter("a",m(null))}))})(e),(e=>{e.addCommand("mceAnchor",(()=>{(e=>{const t=(e=>{const t=s(e);return t?i(t):""})(e);e.windowManager.open({title:"Anchor",size:"normal",body:{type:"panel",items:[{name:"id",type:"input",label:"ID",placeholder:"example"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{id:t},onSubmit:t=>{((e,t)=>/^[A-Za-z][A-Za-z0-9\-:._]*$/.test(t)?(c(e,t),!0):(e.windowManager.alert("ID should start with a letter, followed only by letters, numbers, dashes, dots, colons or underscores."),!1))(e,t.getData().id)&&t.close()}})})(e)}))})(e),(e=>{e.ui.registry.addToggleButton("anchor",{icon:"bookmark",tooltip:"Anchor",onAction:()=>e.execCommand("mceAnchor"),onSetup:t=>e.selection.selectorChangedWithUnbind("a:not([href])",t.setActive).unbind}),e.ui.registry.addMenuItem("anchor",{icon:"bookmark",text:"Anchor...",onAction:()=>e.execCommand("mceAnchor")})})(e),e.on("PreInit",(()=>{(e=>{e.formatter.register("namedAnchor",{inline:"a",selector:a,remove:"all",split:!0,deep:!0,attributes:{id:"%value"},onmatch:(e,t,n)=>l(e)})})(e)}))}))}();

View File

@@ -0,0 +1,4 @@
/**
* TinyMCE version 6.0.3 (2022-05-25)
*/
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=t=>e=>e.options.get(t),n=e("autolink_pattern"),o=e("link_default_target"),r=e("link_default_protocol"),i=("string",t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(n=o=t,(r=String).prototype.isPrototypeOf(n)||(null===(i=o.constructor)||void 0===i?void 0:i.name)===r.name)?"string":e;var n,o,r,i})(t));const s=t=>/^[(\[{ \u00a0]$/.test(t),a=t=>3===t.nodeType,l=t=>1===t.nodeType,d=(t,e)=>{if(e<0&&(e=0),a(t)){const n=t.data.length;e>n&&(e=n)}return e},f=(t,e,n)=>{!l(e)||e.hasChildNodes()?t.setStart(e,d(e,n)):t.setStartBefore(e)},g=(t,e,n)=>{!l(e)||e.hasChildNodes()?t.setEnd(e,d(e,n)):t.setEndAfter(e)},c=(t,e)=>{let l,d,c,u,h,p,k;const C=n(t),y=o(t);if(null!==t.dom.getParent(t.selection.getNode(),"a[href]"))return;const m=t.selection.getRng().cloneRange();if(m.startOffset<5){if(h=m.endContainer.previousSibling,!h){if(!m.endContainer.firstChild||!m.endContainer.firstChild.nextSibling)return;h=m.endContainer.firstChild.nextSibling}if(p=h.length,f(m,h,p),g(m,h,p),m.endOffset<5)return;l=m.endOffset,d=h}else{if(d=m.endContainer,!a(d)&&d.firstChild){for(;!a(d)&&d.firstChild;)d=d.firstChild;a(d)&&(f(m,d,0),g(m,d,d.nodeValue.length))}l=1===m.endOffset?2:m.endOffset-1-e}const w=l;do{f(m,d,l>=2?l-2:0),g(m,d,l>=1?l-1:0),l-=1,k=m.toString()}while(!s(k)&&l-2>=0);var A;s(m.toString())?(f(m,d,l),g(m,d,w),l+=1):0===m.startOffset?(f(m,d,0),g(m,d,w)):(f(m,d,l),g(m,d,w)),u=m.toString(),A=u.charAt(u.length-1),/[?!,.;:]/.test(A)&&g(m,d,w-1),u=m.toString().trim();const S=u.match(C),_=r(t);if(S){let e=S[0];O="www.",(v=e).length>=O.length&&v.substr(0,0+O.length)===O?e=_+"://"+e:((t,e)=>-1!==t.indexOf("@"))(e)&&!(t=>/^([A-Za-z][A-Za-z\d.+-]*:\/\/)|mailto:/.test(t))(e)&&(e="mailto:"+e),c=t.selection.getBookmark(),t.selection.setRng(m),t.getDoc().execCommand("createlink",!1,e),i(y)&&t.dom.setAttrib(t.selection.getNode(),"target",y),t.selection.moveToBookmark(c),t.nodeChanged()}var v,O};t.add("autolink",(t=>{(t=>{const e=t.options.register;e("autolink_pattern",{processor:"regexp",default:new RegExp("^"+/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-+~=.,%()\/\w]*[-+~=%()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source+"$","i")}),e("link_default_target",{processor:"string"}),e("link_default_protocol",{processor:"string",default:"https"})})(t),(t=>{t.on("keydown",(e=>{if(13===e.keyCode)return(t=>c(t,-1))(t)})),t.on("keypress",(e=>{if(41===e.keyCode||93===e.keyCode||125===e.keyCode)return(t=>c(t,-1))(t)})),t.on("keyup",(e=>{if(32===e.keyCode)return(t=>c(t,0))(t)}))})(t)}))}();

View File

@@ -0,0 +1,4 @@
/**
* TinyMCE version 6.0.3 (2022-05-25)
*/
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),t=tinymce.util.Tools.resolve("tinymce.Env");const o=e=>t=>t.options.get(e),n=o("min_height"),s=o("max_height"),i=o("autoresize_overflow_padding"),r=o("autoresize_bottom_margin"),l=(e,t)=>{const o=e.getBody();o&&(o.style.overflowY=t?"":"hidden",t||(o.scrollTop=0))},a=(e,t,o,n)=>{const s=parseInt(e.getStyle(t,o,n),10);return isNaN(s)?0:s},g=(e,o,i)=>{var c;const u=e.dom,d=e.getDoc();if(!d)return;if((e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen())(e))return void l(e,!0);const f=d.documentElement,m=r(e),p=null!==(c=n(e))&&void 0!==c?c:e.getElement().offsetHeight;let h=p;const y=a(u,f,"margin-top",!0),v=a(u,f,"margin-bottom",!0);let C=f.offsetHeight+y+v+m;C<0&&(C=0);const S=e.getContainer().offsetHeight-e.getContentAreaContainer().offsetHeight;C+S>p&&(h=C+S);const z=s(e);if(z&&h>z?(h=z,l(e,!0)):l(e,!1),h!==o.get()){const n=h-o.get();if(u.setStyle(e.getContainer(),"height",h+"px"),o.set(h),(e=>{e.dispatch("ResizeEditor")})(e),t.browser.isSafari()&&(t.os.isMacOS()||t.os.isiOS())){const t=e.getWin();t.scrollTo(t.pageXOffset,t.pageYOffset)}e.hasFocus()&&(e=>{if("setcontent"===(null==e?void 0:e.type.toLowerCase())){const t=e;return!0===t.selection||!0===t.paste}return!1})(i)&&e.selection.scrollIntoView(),(t.browser.isSafari()||t.browser.isChromium())&&n<0&&g(e,o,i)}};e.add("autoresize",(e=>{if((e=>{const t=e.options.register;t("autoresize_overflow_padding",{processor:"number",default:1}),t("autoresize_bottom_margin",{processor:"number",default:50})})(e),e.options.isSet("resize")||e.options.set("resize",!1),!e.inline){const t=(e=>{let t=0;return{get:()=>t,set:e=>{t=e}}})();((e,t)=>{e.addCommand("mceAutoResize",(()=>{g(e,t)}))})(e,t),((e,t)=>{e.on("init",(()=>{const t=i(e),o=e.dom;o.setStyles(e.getDoc().documentElement,{height:"auto"}),o.setStyles(e.getBody(),{paddingLeft:t,paddingRight:t,"min-height":0})})),e.on("NodeChange SetContent keyup FullscreenStateChanged ResizeContent",(o=>{g(e,t,o)}))})(e,t)}}))}();

View File

@@ -0,0 +1,4 @@
/**
* TinyMCE version 6.0.3 (2022-05-25)
*/
!function(){"use strict";var t=tinymce.util.Tools.resolve("tinymce.PluginManager");const e=("string",t=>"string"===(t=>{const e=typeof t;return null===t?"null":"object"===e&&Array.isArray(t)?"array":"object"===e&&(r=o=t,(a=String).prototype.isPrototypeOf(r)||(null===(s=o.constructor)||void 0===s?void 0:s.name)===a.name)?"string":e;var r,o,a,s})(t));const r=(void 0,t=>undefined===t);var o=tinymce.util.Tools.resolve("tinymce.util.Delay"),a=tinymce.util.Tools.resolve("tinymce.util.LocalStorage"),s=tinymce.util.Tools.resolve("tinymce.util.Tools");const n=t=>{const e=/^(\d+)([ms]?)$/.exec(t);return(e[2]?{s:1e3,m:6e4}[e[2]]:1)*parseInt(t,10)},i=t=>e=>e.options.get(t),u=i("autosave_ask_before_unload"),l=i("autosave_restore_when_empty"),c=i("autosave_interval"),m=i("autosave_retention"),d=t=>{const e=document.location;return t.options.get("autosave_prefix").replace(/{path}/g,e.pathname).replace(/{query}/g,e.search).replace(/{hash}/g,e.hash).replace(/{id}/g,t.id)},f=(t,e)=>{if(r(e))return t.dom.isEmpty(t.getBody());{const r=s.trim(e);if(""===r)return!0;{const e=(new DOMParser).parseFromString(r,"text/html");return t.dom.isEmpty(e)}}},v=t=>{const e=parseInt(a.getItem(d(t)+"time"),10)||0;return!((new Date).getTime()-e>m(t)&&(p(t,!1),1))},p=(t,e)=>{const r=d(t);a.removeItem(r+"draft"),a.removeItem(r+"time"),!1!==e&&(t=>{t.dispatch("RemoveDraft")})(t)},g=t=>{const e=d(t);!f(t)&&t.isDirty()&&(a.setItem(e+"draft",t.getContent({format:"raw",no_events:!0})),a.setItem(e+"time",(new Date).getTime().toString()),(t=>{t.dispatch("StoreDraft")})(t))},y=t=>{const e=d(t);v(t)&&(t.setContent(a.getItem(e+"draft"),{format:"raw"}),(t=>{t.dispatch("RestoreDraft")})(t))},D=t=>{t.undoManager.transact((()=>{y(t),p(t)})),t.focus()};var h=tinymce.util.Tools.resolve("tinymce.EditorManager");const _=t=>e=>{e.setEnabled(v(t));const r=()=>e.setEnabled(v(t));return t.on("StoreDraft RestoreDraft RemoveDraft",r),()=>t.off("StoreDraft RestoreDraft RemoveDraft",r)};t.add("autosave",(t=>((t=>{const r=t.options.register,o=t=>{const r=e(t);return r?{value:n(t),valid:r}:{valid:!1,message:"Must be a string."}};r("autosave_ask_before_unload",{processor:"boolean",default:!0}),r("autosave_prefix",{processor:"string",default:"tinymce-autosave-{path}{query}{hash}-{id}-"}),r("autosave_restore_when_empty",{processor:"boolean",default:!1}),r("autosave_interval",{processor:o,default:"30s"}),r("autosave_retention",{processor:o,default:"20m"})})(t),(t=>{t.editorManager.on("BeforeUnload",(t=>{let e;s.each(h.get(),(t=>{t.plugins.autosave&&t.plugins.autosave.storeDraft(),!e&&t.isDirty()&&u(t)&&(e=t.translate("You have unsaved changes are you sure you want to navigate away?"))})),e&&(t.preventDefault(),t.returnValue=e)}))})(t),(t=>{(t=>{const e=c(t);o.setEditorInterval(t,(()=>{g(t)}),e)})(t),t.ui.registry.addButton("restoredraft",{tooltip:"Restore last draft",icon:"restore-draft",onAction:()=>{D(t)},onSetup:_(t)}),t.ui.registry.addMenuItem("restoredraft",{text:"Restore last draft",icon:"restore-draft",onAction:()=>{D(t)},onSetup:_(t)})})(t),t.on("init",(()=>{l(t)&&t.dom.isEmpty(t.getBody())&&y(t)})),(t=>({hasDraft:()=>v(t),storeDraft:()=>g(t),restoreDraft:()=>y(t),removeDraft:e=>p(t,e),isEmpty:e=>f(t,e)}))(t))))}();

Some files were not shown because too many files have changed in this diff Show More