├── .dockerignore ├── .git-blame-ignore-revs ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── ScalaCI.yml │ ├── auto-approve.yml │ └── autoupdate.yml ├── .gitignore ├── .mergify.yml ├── .scalafmt.conf ├── LICENSE ├── README.md ├── assembly-deploy.sh ├── build.sbt ├── docker-compose.yml ├── docker-deploy.sh ├── docker-image-upload.sh ├── init.sql ├── logo.png ├── modules ├── zim-api │ └── src │ │ └── main │ │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── api │ │ ├── ActuatorEndpoint.scala │ │ ├── ApiEndpoint.scala │ │ ├── ApiErrorMapping.scala │ │ ├── ApiJsonCodec.scala │ │ ├── MultipartInput.scala │ │ ├── UserEndpoint.scala │ │ ├── WsEndpoint.scala │ │ ├── repository │ │ ├── AddMessageRepository.scala │ │ ├── BaseRepository.scala │ │ ├── FriendGroupFriendRepository.scala │ │ ├── FriendGroupRepository.scala │ │ ├── GroupMemberRepository.scala │ │ ├── GroupRepository.scala │ │ ├── ReceiveRepository.scala │ │ ├── UserRepository.scala │ │ └── package.scala │ │ └── service │ │ ├── ApiService.scala │ │ ├── PaginationApiService.scala │ │ └── UserService.scala ├── zim-auth │ └── src │ │ └── main │ │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── auth │ │ └── CookieAuthority.scala ├── zim-cache-api │ └── src │ │ └── main │ │ ├── resources │ │ └── reference.conf │ │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── cache │ │ ├── RedisService.scala │ │ └── package.scala ├── zim-cache-redis4cats │ └── src │ │ └── main │ │ ├── resources │ │ └── reference.conf │ │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── cache │ │ └── redis4cats │ │ ├── CatsRedisConfiguration.scala │ │ ├── CatsRedisServiceLive.scala │ │ └── package.scala ├── zim-cache-redis4zio │ └── src │ │ └── main │ │ ├── resources │ │ └── reference.conf │ │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── cache │ │ └── redis4zio │ │ ├── ZioRedisConfiguration.scala │ │ ├── ZioRedisServiceLive.scala │ │ └── package.scala ├── zim-domain │ └── src │ │ └── main │ │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── domain │ │ ├── Add.scala │ │ ├── AddInfo.scala │ │ ├── ChatHistory.scala │ │ ├── FriendAndGroupInfo.scala │ │ ├── FriendList.scala │ │ ├── Group.scala │ │ ├── Message.scala │ │ ├── Mine.scala │ │ ├── ResultPageSet.scala │ │ ├── ResultSet.scala │ │ ├── SystemConstant.scala │ │ ├── To.scala │ │ ├── UploadResult.scala │ │ ├── ZimError.scala │ │ ├── input │ │ ├── AgreeFriendInput.scala │ │ ├── ChangeGroupInput.scala │ │ ├── ExistEmailInput.scala │ │ ├── FriendGroupInput.scala │ │ ├── GroupInput.scala │ │ ├── LeaveOutGroupInput.scala │ │ ├── RefuseFriendInput.scala │ │ ├── RegisterUserInput.scala │ │ ├── RemoveFriendInput.scala │ │ ├── UpdateSignInput.scala │ │ ├── UpdateUserInput.scala │ │ └── UserToken.scala │ │ ├── model │ │ ├── AddFriend.scala │ │ ├── AddMessage.scala │ │ ├── BaseModel.scala │ │ ├── FriendGroup.scala │ │ ├── GroupList.scala │ │ ├── GroupMember.scala │ │ ├── Receive.scala │ │ └── User.scala │ │ ├── package.scala │ │ └── ws │ │ ├── Constants.scala │ │ ├── Group.scala │ │ ├── RefuseOrAgreeMessage.scala │ │ └── protocol │ │ ├── Command.scala │ │ └── Protocol.scala ├── zim-infra │ └── src │ │ └── main │ │ ├── resources │ │ └── reference.conf │ │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── infrastructure │ │ ├── InfrastructureConfiguration.scala │ │ ├── properties │ │ ├── MailConfigurationProperties.scala │ │ ├── MysqlConfigurationProperties.scala │ │ └── ZimConfigurationProperties.scala │ │ ├── repository │ │ ├── TangibleAddMessageRepository.scala │ │ ├── TangibleBaseRepository.scala │ │ ├── TangibleFriendGroupFriendRepository.scala │ │ ├── TangibleFriendGroupRepository.scala │ │ ├── TangibleGroupMemberRepository.scala │ │ ├── TangibleGroupRepository.scala │ │ ├── TangibleReceiveRepository.scala │ │ ├── TangibleUserRepository.scala │ │ └── package.scala │ │ └── util │ │ ├── DateUtil.scala │ │ ├── LogUtil.scala │ │ ├── SecurityUtil.scala │ │ └── UuidUtil.scala └── zim-server │ └── src │ ├── main │ ├── resources │ │ ├── application-docker.conf │ │ ├── application.conf.example │ │ ├── index.html │ │ ├── logback.xml │ │ ├── sql │ │ │ ├── data.sql │ │ │ └── schema.sql │ │ └── static │ │ │ ├── css │ │ │ ├── 403.css │ │ │ ├── login │ │ │ │ ├── animate-custom.css │ │ │ │ └── style3.css │ │ │ └── style.css │ │ │ ├── html │ │ │ ├── 403.html │ │ │ ├── 404.html │ │ │ ├── 500.html │ │ │ ├── chatlog.html │ │ │ ├── creategroup.html │ │ │ ├── createusergroup.html │ │ │ ├── find.html │ │ │ ├── friend.html │ │ │ ├── index.html │ │ │ ├── msgbox.html │ │ │ ├── setting.html │ │ │ └── userinfo.html │ │ │ ├── image │ │ │ ├── 4.jpg │ │ │ ├── avatar │ │ │ │ ├── avatar(1).jpg │ │ │ │ ├── avatar(10).jpg │ │ │ │ ├── avatar(2).jpg │ │ │ │ ├── avatar(3).jpg │ │ │ │ ├── avatar(4).jpg │ │ │ │ ├── avatar(5).jpg │ │ │ │ ├── avatar(6).jpg │ │ │ │ ├── avatar(7).jpg │ │ │ │ ├── avatar(8).jpg │ │ │ │ └── avatar(9).jpg │ │ │ ├── favicon.ico │ │ │ └── group │ │ │ │ ├── group_1.gif │ │ │ │ ├── group_2.gif │ │ │ │ ├── group_3.jpg │ │ │ │ └── group_4.jpg │ │ │ ├── js │ │ │ ├── 403.js │ │ │ ├── 404-script.js │ │ │ ├── 500-script.js │ │ │ ├── base64.js │ │ │ ├── cookie.js │ │ │ ├── find.js │ │ │ ├── friend.js │ │ │ ├── group.js │ │ │ ├── jquery-3.4.1.min.js │ │ │ ├── msgbox.js │ │ │ ├── particles.min.js │ │ │ ├── reconnecting │ │ │ │ └── reconnecting-websocket.js │ │ │ ├── setting.js │ │ │ ├── user.js │ │ │ └── websocket.js │ │ │ ├── json │ │ │ ├── particles0.json │ │ │ ├── particles1.json │ │ │ └── particles2.json │ │ │ ├── layui │ │ │ ├── css │ │ │ │ ├── layui.css │ │ │ │ ├── layui.mobile.css │ │ │ │ └── modules │ │ │ │ │ ├── code.css │ │ │ │ │ ├── laydate │ │ │ │ │ ├── icon.png │ │ │ │ │ └── laydate.css │ │ │ │ │ ├── layer │ │ │ │ │ └── default │ │ │ │ │ │ ├── icon-ext.png │ │ │ │ │ │ ├── icon.png │ │ │ │ │ │ ├── layer.css │ │ │ │ │ │ ├── loading-0.gif │ │ │ │ │ │ ├── loading-1.gif │ │ │ │ │ │ └── loading-2.gif │ │ │ │ │ └── layim │ │ │ │ │ ├── html │ │ │ │ │ ├── find.html │ │ │ │ │ ├── getmsg.json │ │ │ │ │ └── msgbox.html │ │ │ │ │ ├── layim.css │ │ │ │ │ ├── mobile │ │ │ │ │ └── layim.css │ │ │ │ │ ├── skin │ │ │ │ │ ├── 1.jpg │ │ │ │ │ ├── 2.jpg │ │ │ │ │ ├── 3.jpg │ │ │ │ │ ├── 4.jpg │ │ │ │ │ ├── 5.jpg │ │ │ │ │ ├── 6.jpg │ │ │ │ │ └── logo.jpg │ │ │ │ │ └── voice │ │ │ │ │ └── default.wav │ │ │ ├── font │ │ │ │ ├── iconfont.eot │ │ │ │ ├── iconfont.svg │ │ │ │ ├── iconfont.ttf │ │ │ │ └── iconfont.woff │ │ │ ├── images │ │ │ │ └── face │ │ │ │ │ ├── 0.gif │ │ │ │ │ ├── 1.gif │ │ │ │ │ ├── 10.gif │ │ │ │ │ ├── 11.gif │ │ │ │ │ ├── 12.gif │ │ │ │ │ ├── 13.gif │ │ │ │ │ ├── 14.gif │ │ │ │ │ ├── 15.gif │ │ │ │ │ ├── 16.gif │ │ │ │ │ ├── 17.gif │ │ │ │ │ ├── 18.gif │ │ │ │ │ ├── 19.gif │ │ │ │ │ ├── 2.gif │ │ │ │ │ ├── 20.gif │ │ │ │ │ ├── 21.gif │ │ │ │ │ ├── 22.gif │ │ │ │ │ ├── 23.gif │ │ │ │ │ ├── 24.gif │ │ │ │ │ ├── 25.gif │ │ │ │ │ ├── 26.gif │ │ │ │ │ ├── 27.gif │ │ │ │ │ ├── 28.gif │ │ │ │ │ ├── 29.gif │ │ │ │ │ ├── 3.gif │ │ │ │ │ ├── 30.gif │ │ │ │ │ ├── 31.gif │ │ │ │ │ ├── 32.gif │ │ │ │ │ ├── 33.gif │ │ │ │ │ ├── 34.gif │ │ │ │ │ ├── 35.gif │ │ │ │ │ ├── 36.gif │ │ │ │ │ ├── 37.gif │ │ │ │ │ ├── 38.gif │ │ │ │ │ ├── 39.gif │ │ │ │ │ ├── 4.gif │ │ │ │ │ ├── 40.gif │ │ │ │ │ ├── 41.gif │ │ │ │ │ ├── 42.gif │ │ │ │ │ ├── 43.gif │ │ │ │ │ ├── 44.gif │ │ │ │ │ ├── 45.gif │ │ │ │ │ ├── 46.gif │ │ │ │ │ ├── 47.gif │ │ │ │ │ ├── 48.gif │ │ │ │ │ ├── 49.gif │ │ │ │ │ ├── 5.gif │ │ │ │ │ ├── 50.gif │ │ │ │ │ ├── 51.gif │ │ │ │ │ ├── 52.gif │ │ │ │ │ ├── 53.gif │ │ │ │ │ ├── 54.gif │ │ │ │ │ ├── 55.gif │ │ │ │ │ ├── 56.gif │ │ │ │ │ ├── 57.gif │ │ │ │ │ ├── 58.gif │ │ │ │ │ ├── 59.gif │ │ │ │ │ ├── 6.gif │ │ │ │ │ ├── 60.gif │ │ │ │ │ ├── 61.gif │ │ │ │ │ ├── 62.gif │ │ │ │ │ ├── 63.gif │ │ │ │ │ ├── 64.gif │ │ │ │ │ ├── 65.gif │ │ │ │ │ ├── 66.gif │ │ │ │ │ ├── 67.gif │ │ │ │ │ ├── 68.gif │ │ │ │ │ ├── 69.gif │ │ │ │ │ ├── 7.gif │ │ │ │ │ ├── 70.gif │ │ │ │ │ ├── 71.gif │ │ │ │ │ ├── 8.gif │ │ │ │ │ └── 9.gif │ │ │ ├── lay │ │ │ │ ├── all-mobile.js │ │ │ │ ├── all.js │ │ │ │ └── modules │ │ │ │ │ ├── code.js │ │ │ │ │ ├── element.js │ │ │ │ │ ├── flow.js │ │ │ │ │ ├── form.js │ │ │ │ │ ├── jquery.js │ │ │ │ │ ├── laydate.js │ │ │ │ │ ├── layedit.js │ │ │ │ │ ├── layer.js │ │ │ │ │ ├── layim.js │ │ │ │ │ ├── laypage.js │ │ │ │ │ ├── laytpl.js │ │ │ │ │ ├── mobile.js │ │ │ │ │ ├── mobile │ │ │ │ │ ├── layer-mobile.js │ │ │ │ │ ├── layim-mobile-open.js │ │ │ │ │ ├── layim-mobile.js │ │ │ │ │ ├── upload-mobile.js │ │ │ │ │ └── zepto.js │ │ │ │ │ ├── tree.js │ │ │ │ │ ├── upload.js │ │ │ │ │ └── util.js │ │ │ └── layui.js │ │ │ └── themes │ │ │ ├── bg1.jpg │ │ │ ├── bg1_small.jpg │ │ │ ├── bg2.jpg │ │ │ ├── bg2_small.jpg │ │ │ ├── bg3.jpg │ │ │ ├── bg3_small.jpg │ │ │ ├── bg4.jpg │ │ │ ├── bg4_small.jpg │ │ │ ├── bg5.jpg │ │ │ └── bg5_small.jpg │ └── scala │ │ └── org │ │ └── bitlap │ │ └── zim │ │ └── server │ │ ├── CacheType.scala │ │ ├── FileUtil.scala │ │ ├── ZimServer.scala │ │ ├── actor │ │ ├── ScheduleStateful.scala │ │ ├── UserStatusStateful.scala │ │ └── akka │ │ │ └── WsMessageForwardBehavior.scala │ │ ├── module │ │ ├── AkkaHttpModule.scala │ │ ├── AkkaModule.scala │ │ └── ZioActorModule.scala │ │ ├── package.scala │ │ ├── route │ │ ├── ZimActuatorApi.scala │ │ ├── ZimOpenApi.scala │ │ ├── ZimUserApi.scala │ │ ├── ZimUserEndpoint.scala │ │ └── ZimWsApi.scala │ │ └── service │ │ ├── ApiServiceImpl.scala │ │ ├── MailServiceImpl.scala │ │ ├── RedisCache.scala │ │ ├── UserServiceImpl.scala │ │ └── ws │ │ ├── WsService.scala │ │ ├── WsServiceLive.scala │ │ └── package.scala │ └── test │ ├── resources │ ├── application.conf │ └── logback-test.xml │ └── scala │ └── org │ └── bitlap │ └── zim │ └── server │ ├── BaseData.scala │ ├── CommonTestSupport.scala │ ├── RandomData.scala │ ├── ZIOBaseSuit.scala │ ├── api │ └── ZimUserApiSpec.scala │ ├── module │ └── MysqlConfigSpec.scala │ ├── repository │ ├── TangibleAddMessageRepositorySpec.scala │ ├── TangibleFriendGroupFriendRepositoryMainSpec.scala │ ├── TangibleFriendGroupRepositorySpec.scala │ ├── TangibleGroupMemberRepositorySpec.scala │ ├── TangibleGroupRepositorySpec.scala │ ├── TangibleReceiveRepositorySpec.scala │ └── TangibleUserRepositorySpec.scala │ ├── service │ ├── MailServiceSpec.scala │ ├── TestService.scala │ ├── TestServiceEnv.scala │ └── UserServiceSpec.scala │ └── util │ ├── CirceJsonSpec.scala │ ├── DateHelper.scala │ ├── DateUtilSpec.scala │ ├── SchemaSpec.scala │ ├── SecuritySpec.scala │ └── UuidSpec.scala ├── my.cnf ├── native-packager-deploy.sh ├── openapi.jpg ├── prepare.sh ├── project ├── BuildInfoSettings.scala ├── Commands.scala ├── Dependencies.scala ├── Information.scala ├── ProjectSetting.scala ├── build.properties └── plugins.sbt ├── version.sbt └── zim-1.drawio.png /.dockerignore: -------------------------------------------------------------------------------- 1 | .git/ 2 | target/ 3 | project/project 4 | project/target 5 | application.conf.example 6 | logs 7 | .idea 8 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Scala Steward: Reformat with scalafmt 3.5.9 2 | 0816c7f40fb103a987855105bc1620a18e0fbaae 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.css linguist-language=Scala 2 | *.js linguist-language=Scala 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/ScalaCI.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | strategy: 15 | matrix: 16 | java-version: [ 11, 17] 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Set up JDK 20 | uses: actions/setup-java@v1 21 | with: 22 | java-version: ${{ matrix.java-version }} 23 | 24 | - name: Build 25 | run: sbt compile 26 | 27 | - name: Checking Code Style 28 | run: sbt scalafmtCheckAll 29 | 30 | - name: Checking headers 31 | run: sbt headerCheckAll 32 | 33 | docker: 34 | runs-on: ubuntu-latest 35 | strategy: 36 | matrix: 37 | java-version: [ 11 ] 38 | steps: 39 | - uses: actions/checkout@v2 40 | - name: Set up JDK 41 | uses: actions/setup-java@v1 42 | with: 43 | java-version: ${{ matrix.java-version }} 44 | 45 | - name: Build Image 46 | run: sbt docker:publishLocal 47 | 48 | test: 49 | runs-on: ubuntu-latest 50 | strategy: 51 | matrix: 52 | redis-version: [ 4, 5, 6 ] 53 | java-version: [ 11, 17] 54 | steps: 55 | - uses: actions/checkout@v2 56 | - name: Set up JDK 57 | uses: actions/setup-java@v1 58 | with: 59 | java-version: ${{ matrix.java-version }} 60 | 61 | - name: Start Redis 62 | uses: supercharge/redis-github-action@1.4.0 63 | with: 64 | redis-version: ${{ matrix.redis-version }} 65 | 66 | - name: Run Test 67 | run: sbt coverage test coverageReport # test in scala2.13.x java 8 68 | 69 | - name: Aggregate coverage report 70 | run: sbt coverageAggregate 71 | 72 | - name: Upload test coverage report 73 | run: bash <(curl -s https://codecov.io/bash) 74 | 75 | ci: 76 | runs-on: ubuntu-latest 77 | needs: [ build, docker, test ] 78 | steps: 79 | - name: Aggregate outcomes 80 | run: echo "build succeeded" -------------------------------------------------------------------------------- /.github/workflows/auto-approve.yml: -------------------------------------------------------------------------------- 1 | name: Auto approve 2 | 3 | on: 4 | pull_request_target 5 | 6 | jobs: 7 | auto-approve: 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: hmarr/auto-approve-action@v2.1.0 11 | if: github.actor == 'scala-steward' || github.actor == 'renovate[bot]' 12 | with: 13 | github-token: "${{ secrets.GITHUB_TOKEN }}" 14 | -------------------------------------------------------------------------------- /.github/workflows/autoupdate.yml: -------------------------------------------------------------------------------- 1 | name: autoupdate 2 | on: 3 | push: {} 4 | jobs: 5 | autoupdate: 6 | name: autoupdate 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: docker://chinthakagodawita/autoupdate-action:v1 10 | env: 11 | GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" 12 | PR_FILTER: "labelled" 13 | PR_LABELS: "type: dependencies,autoupdate" 14 | EXCLUDED_LABELS: "do-not-autoupdate" 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bloop 2 | .metals 3 | .idea 4 | target 5 | project/target 6 | project/project 7 | project/metals.sbt 8 | Makefile 9 | .bsp 10 | .idea 11 | null/ 12 | # config 13 | modules/zim-server/src/main/resources/application.conf 14 | modules/zim-server/src/test/resources/application-dev.conf 15 | modules/zim-server/src/test/resources/application-test.conf 16 | modules/zim-infra/src/main/resources/reference.conf 17 | # upload file into this folder 18 | static/ 19 | logs/ 20 | assembly-deploy-dev.sh 21 | native-packager-deploy-dev.sh 22 | 23 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | pull_request_rules: 2 | - name: assign and label scala-steward's PRs 3 | conditions: 4 | - author=scala-steward 5 | actions: 6 | assign: 7 | users: ["@bitlap/zim"] 8 | label: 9 | add: ["type: dependencies"] 10 | - name: label scala-steward's breaking PRs 11 | conditions: 12 | - author=scala-steward 13 | - "body~=(labels: library-update, early-semver-major)|(labels: sbt-plugin-update, early-semver-major)" 14 | actions: 15 | label: 16 | add: ["type: breaking"] 17 | - name: merge Scala Steward's PRs 18 | conditions: 19 | - author=scala-steward 20 | - "body~=(labels: library-update, early-semver-minor)|(labels: library-update, early-semver-patch)|(labels: sbt-plugin-update, early-semver-minor)|(labels: sbt-plugin-update, early-semver-patch)|(labels: test-library-update)" 21 | - "check-success=ci" 22 | actions: 23 | merge: 24 | method: squash 25 | -------------------------------------------------------------------------------- /.scalafmt.conf: -------------------------------------------------------------------------------- 1 | version = "3.8.3" 2 | runner.dialect = scala213 3 | maxColumn = 120 4 | align.preset = more 5 | lineEndings = preserve 6 | align.stripMargin = false 7 | docstrings.style = AsteriskSpace 8 | docstrings.oneline = keep 9 | continuationIndent.defnSite = 2 10 | danglingParentheses.preset = true 11 | //spaces { 12 | // inImportCurlyBraces = true 13 | //} 14 | indentOperator.exemptScope = aloneArgOrBody 15 | includeCurlyBraceInSelectChains = false 16 | align.openParenDefnSite = false 17 | optIn.annotationNewlines = true 18 | rewriteTokens = { 19 | "⇒": "=>" 20 | "→": "->" 21 | "←": "<-" 22 | } 23 | rewrite.rules = [Imports] 24 | rewrite.imports.sort = scalastyle 25 | rewrite.imports.groups = [ 26 | ["java\\..*", "javax\\..*"], 27 | ["scala\\..*"] 28 | ["bitlap\\..*"], 29 | ["org\\..*"], 30 | ["akka\\..*"], 31 | ["sttp\\..*"], 32 | ["io\\..*"], 33 | ["com\\..*"], 34 | ] 35 | rewrite.imports.contiguousGroups = no 36 | newlines.topLevelStatementBlankLines = [ 37 | { 38 | blanks {before = 1} 39 | } 40 | ] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | # zim 4 | 5 | [![Project stage](https://img.shields.io/badge/Project%20Stage-Concept-orange.svg)](https://github.com/bitlap/bitlap/wiki/Project-Stages) 6 | [![Build](https://github.com/bitlap/zim/actions/workflows/ScalaCI.yml/badge.svg?branch=master)](https://github.com/bitlap/zim/actions/workflows/ScalaCI.yml) 7 | [![codecov](https://codecov.io/gh/bitlap/zim/branch/master/graph/badge.svg?token=V95ZMWUUCE)](https://codecov.io/gh/bitlap/zim) 8 | [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/liguobin/zim?label=docker-image)](https://hub.docker.com/r/liguobin/zim/tags) 9 | 10 | [在线预览地址](http://im.dreamylost.cn:8989) 11 | > 账号dreamylost@outlook.com 密码123456(注册有时不可用) 12 | 13 | > 服务器到期时间(为爱发电):2024-11-28 19:55:29 14 | 15 | > Docker镜像可直接运行,内含redis和mysql,但无法使用注册功能,账号在`./init.sql`,密码都是`123456` 16 | 17 | **如果感兴趣可以watch一下,如果对你有帮助可以点个star,欢迎贡献。** 18 | 19 | ## 模块 20 | 21 | - `zim-auth` 登录鉴权,目前由 cookie 实现并对外提供“鉴权缓存”函数,具体实现由`zim-server`完成。 22 | - `zim-cache-api` 缓存接口定义(tagless final)。 23 | - `zim-cache-redis4cats` 基于redis4cats实现缓存。 24 | - `zim-cache-redis4zio` 基于zio-redis实现缓存。 25 | - `zim-domain` 所有领域模型定义。 26 | - `zim-server` Server端的主要实现,包括 zio 依赖管理、基于 akka-http 的 route 实现、基于 tapir 的 API 具体实现。 27 | - `zim-infra` 配置和基础设施,包括系统基础配置、工具类、部分领域对象及核心CRUD实现。 28 | - `zim-api` tapir API 描述定义和 service、repository 接口定义(tagless final),repository 具体实现在`zim-infra`,service 具体实现在`zim-server`。 29 | 30 | ## 项目结构 31 | 32 | ![](./zim-1.drawio.png) 33 | 34 | ## API 35 | 36 | ![](./openapi.jpg) 37 | 38 | ## 环境 39 | 40 | - scala 2.13 41 | - java 11/17 42 | - redis 4/5/6 43 | - mysql 8 44 | - docker-compose 45 | 46 | ## 技术栈 47 | 48 | - 开发语言:scala2 49 | - 平台:jvm 50 | - 前端:layim 3.0 51 | - 主体框架:zio 2 52 | - API server:akka-http 53 | - API 文档化工具:tapir 1 54 | - 数据库:redis、mysql 55 | - 缓存:zio-redis、redis4cats 56 | - 数据操作:scalikejdbc-streams 57 | - 定时任务:zio-actors 58 | - 序列化:circe 59 | - 加密工具 zio-crypto 60 | - 日志:zio-logging 61 | - 细化类型:refined 62 | - WebSocket:akka-http、akka-actor-typed 63 | - 邮件:simple-java-mail 64 | - 配置:config 65 | - 构建工具:sbt 66 | 67 | ## 详细介绍和博客 68 | 69 | [bitlap官网](https://bitlap.org/lab/zim) 70 | 71 | [csdn 博客](https://blog.csdn.net/qq_34446485/category_11720549.html?spm=1001.2014.3001.5482) 72 | 73 | ## 特别感谢 74 | 75 | IntelliJ IDEA logo. 76 | 77 | This project is developed using JetBrains IDEA. Thanks to JetBrains for providing me with a free license, which is a strong support for me. 78 | -------------------------------------------------------------------------------- /assembly-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sbt clean 4 | 5 | sbt assembly 6 | 7 | version=$1 8 | 9 | scp ~/Projects/zim/modules/zim-server/target/scala-2.13/zim-server-assembly-$version.jar root@your_ip:/home/zim/zim-server-assembly-$version.jar 10 | 11 | # FIXME stop start 12 | ssh root@your_ip "lsof -i:8989 | awk 'NR==2{print $2}' | xargs kill -9;" 13 | ssh root@your_ip "cd /home/zim; nohup java -jar -Xms1024M zim-server-assembly-$version.jar > zim.log 2>&1 &" 14 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | zim_server: 4 | image: liguobin/zim:0.6.3 5 | container_name: zim_server 6 | depends_on: 7 | - zim_mysql_server 8 | - zim_redis_server 9 | ports: 10 | - "9000:9000" 11 | 12 | zim_mysql_server: 13 | image: mysql:oracle 14 | restart: always 15 | container_name: zim_mysql_server 16 | command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci 17 | ports: 18 | - "3306:3306" 19 | # FIXME The MySQL host directory must already exist, change it to your own MySQL location 20 | volumes: 21 | - /usr/local/mysql/data:/var/lib/mysql 22 | - ./my.cnf:/etc/mysql/conf.d/my.cnf 23 | - ./init.sql:/docker-entrypoint-initdb.d/init.sql 24 | environment: 25 | - MYSQL_DATABASE=trace 26 | - MYSQL_ALLOW_EMPTY_PASSWORD=yes 27 | - TZ=Asia/Shanghai 28 | 29 | zim_redis_server: 30 | image: redis 31 | container_name: zim_redis_server 32 | command: redis-server 33 | restart: always 34 | ports: 35 | - "6379:6379" -------------------------------------------------------------------------------- /docker-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | #sbt clean compile 4 | 5 | cp modules/zim-server/src/main/resources/application-docker.conf modules/zim-server/src/main/resources/application-docker-copy.conf 6 | cp modules/zim-server/src/main/resources/application.conf modules/zim-server/src/main/resources/application-copy.conf 7 | mv modules/zim-server/src/main/resources/application-docker.conf modules/zim-server/src/main/resources/application.conf 8 | 9 | # it can only executed for local pc, and used local image 10 | IFS=$'\n' 11 | maybeOld=`docker ps | grep liguobin/zim | awk '{print $1}'` 12 | if [[ -n "$maybeOld" ]];then 13 | for line in `cat version.sbt` 14 | do 15 | docker image rm liguobin/zim:$line -f 16 | done 17 | fi 18 | 19 | 20 | sbt docker:publishLocal 21 | 22 | mv modules/zim-server/src/main/resources/application-copy.conf modules/zim-server/src/main/resources/application.conf 23 | mv modules/zim-server/src/main/resources/application-docker-copy.conf modules/zim-server/src/main/resources/application-docker.conf 24 | mv modules/zim-server/target/scala-2.13/classes/application-copy.conf modules/zim-server/target/scala-2.13/classes/application.conf 25 | 26 | 27 | if [[ -d "/tmp/mysql/datadir/" ]];then 28 | rm -rf /tmp/mysql/datadir/* 29 | else 30 | mkdir -p /tmp/mysql/datadir/ 31 | fi 32 | 33 | if [[ -d "/tmp/mysql/datadir/" ]];then 34 | docker-compose -f docker-compose.yml up -d 35 | zim_container_ip=`docker ps | grep liguobin/zim | awk '{print $1}' | xargs docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'` 36 | echo "zim server container ip: $zim_container_ip" 37 | else 38 | echo "Not found a folder named /tmp/mysql/datadir/ for docker mysql" 39 | exit -1 40 | fi 41 | 42 | # mac osx visit docker container network? see https://www.haoyizebo.com/posts/fd0b9bd8/ and close your VPN -------------------------------------------------------------------------------- /docker-image-upload.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | tag=$1 4 | 5 | sbt docker:publishLocal 6 | 7 | docker login -u liguobin 8 | docker push liguobin/zim:$tag -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/logo.png -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/ActuatorEndpoint.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api 18 | 19 | import org.bitlap.zim.ZimBuildInfo 20 | 21 | import sttp.model.StatusCode 22 | import sttp.tapir._ 23 | import sttp.tapir.Codec.JsonCodec 24 | import sttp.tapir.json.circe._ 25 | 26 | import io.circe.Json 27 | import io.circe.parser._ 28 | 29 | /** Actuator的端点 30 | * 31 | * @author 32 | * 梦境迷离 33 | * @since 2021/12/25 34 | * @version 1.0 35 | */ 36 | trait ActuatorEndpoint { 37 | 38 | private[api] type HealthInfo = Map[String, Any] 39 | private[api] lazy val healthResource: String = "health" 40 | private[api] lazy val healthNameResource: String = "health-resource" 41 | private[api] lazy val healthDescriptionResource: String = "Zim Service Health Check Endpoint" 42 | 43 | lazy val healthEndpoint: PublicEndpoint[Unit, StatusCode, HealthInfo, Any] = 44 | ApiEndpoint.baseEndpoint.get 45 | .in(healthResource) 46 | .name(healthNameResource) 47 | .description(healthDescriptionResource) 48 | .out(customCodecJsonBody[HealthInfo].example(ZimBuildInfo.toMap)) 49 | .errorOut(statusCode) 50 | 51 | private[api] implicit lazy val buildInfoCodec: JsonCodec[HealthInfo] = 52 | implicitly[JsonCodec[Json]].map(_ => ZimBuildInfo.toMap)(_ => 53 | parse(ZimBuildInfo.toJson) match { 54 | case Left(_) => throw new RuntimeException("health doesn't work") 55 | case Right(value) => value 56 | } 57 | ) 58 | 59 | } 60 | 61 | object ActuatorEndpoint extends ActuatorEndpoint 62 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/ApiEndpoint.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api 18 | 19 | import sttp.tapir._ 20 | 21 | /** Open API的端点 22 | * 23 | * @author 24 | * 梦境迷离 25 | * @since 2021/12/25 26 | * @version 1.0 27 | */ 28 | trait ApiEndpoint { 29 | 30 | lazy val apiResource: String = "api" 31 | lazy val apiVersion: String = "v1.0" 32 | private[api] lazy val apiNameResource: String = "api-resource" 33 | private[api] lazy val apiDescriptionResource: String = "Api Resources" 34 | private[api] lazy val baseApiEndpoint: EndpointInput[Unit] = apiResource / apiVersion 35 | 36 | private[api] lazy val baseEndpoint: PublicEndpoint[Unit, Unit, Unit, Any] = 37 | endpoint.in(baseApiEndpoint).name(apiNameResource).description(apiDescriptionResource) 38 | 39 | } 40 | 41 | object ApiEndpoint extends ApiEndpoint 42 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/MultipartInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api 18 | 19 | import sttp.model.Part 20 | import sttp.tapir.TapirFile 21 | 22 | /** 文件上传 23 | * 24 | * @author 25 | * 梦境迷离 26 | * @since 2022/2/3 27 | * @version 1.0 28 | */ 29 | final case class MultipartInput(file: Part[TapirFile]) extends Serializable { 30 | 31 | def getFileName: String = file.fileName.getOrElse(file.name) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/WsEndpoint.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api 18 | 19 | import scala.concurrent.duration.DurationInt 20 | 21 | import akka.http.scaladsl.model.ws.TextMessage 22 | 23 | import sttp.capabilities.WebSockets 24 | import sttp.capabilities.akka.AkkaStreams 25 | import sttp.capabilities.akka.AkkaStreams.Pipe 26 | import sttp.tapir._ 27 | import sttp.tapir.Codec.parsedString 28 | import sttp.tapir.generic.auto.schemaForCaseClass 29 | import sttp.ws.WebSocketFrame 30 | 31 | /** @author 32 | * 梦境迷离 33 | * @since 2022/1/16 34 | * @version 2.0 35 | */ 36 | trait WsEndpoint { 37 | 38 | // TODO typed ws 39 | lazy val wsEndpoint 40 | : PublicEndpoint[Int, Unit, Pipe[TextMessage.Strict, String], Any with AkkaStreams with WebSockets] = 41 | endpoint 42 | .in("websocket" / query[Int]("uid")) 43 | .description("Websocket Endpoint") 44 | .name("Websocket") 45 | .out(out) 46 | 47 | lazy val out: WebSocketBodyOutput[Pipe[TextMessage.Strict, String], TextMessage.Strict, String, Pipe[ 48 | TextMessage.Strict, 49 | String 50 | ], AkkaStreams] = 51 | new WebSocketBodyBuilder[TextMessage.Strict, CodecFormat.TextPlain, String, CodecFormat.TextPlain] 52 | .apply(AkkaStreams)( 53 | requests = Codec.textWebSocketFrame( 54 | parsedString[TextMessage.Strict](TextMessage.Strict) 55 | .schema(implicitly[Schema[TextMessage.Strict]]) 56 | ), 57 | responses = Codec.textWebSocketFrame( 58 | Codec.string 59 | ) 60 | ) 61 | .concatenateFragmentedFrames(false) 62 | .ignorePong(false) 63 | .autoPongOnPing(true) 64 | .decodeCloseRequests(true) 65 | .decodeCloseResponses(true) 66 | .autoPing(Some((3.seconds, WebSocketFrame.ping))) 67 | } 68 | 69 | object WsEndpoint extends WsEndpoint 70 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/AddMessageRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | /** @author 22 | * 梦境迷离 23 | * @since 2022/1/15 24 | * @version 1.0 25 | */ 26 | trait AddMessageRepository[F[_]] extends BaseRepository[F, AddMessage] { 27 | 28 | def countUnHandMessage(uid: Int, agree: Option[Int]): F[Int] 29 | 30 | def findAddInfo(uid: Int): F[AddMessage] 31 | 32 | def updateAgree(id: Int, agree: Int): F[Int] 33 | 34 | def saveAddMessage(addMessage: AddMessage): F[Int] 35 | } 36 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/BaseRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | /** 基础操作类 20 | * 21 | * @author 22 | * 梦境迷离 23 | * @since 2021/12/25 24 | * @version 1.0 25 | */ 26 | trait BaseRepository[F[_], T] { 27 | 28 | /** find by id 29 | */ 30 | def findById(id: Long): F[T] 31 | } 32 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/FriendGroupFriendRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | /** 好友分组操作定义 22 | * 23 | * @author 24 | * 梦境迷离 25 | * @since 2022/1/2 26 | * @version 1.0 27 | */ 28 | trait FriendGroupFriendRepository[F[_]] extends BaseRepository[F, AddFriend] { 29 | 30 | def removeFriend(friendId: Int, uId: Int): F[Int] 31 | 32 | def changeGroup(groupId: Int, originRecordId: Int): F[Int] 33 | 34 | def findUserGroup(uId: Int, mId: Int): F[Int] 35 | 36 | def addFriend(from: AddFriend, to: AddFriend): F[Int] 37 | } 38 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/FriendGroupRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | /** 好友分组操作定义 22 | * 23 | * @author 24 | * LittleTear 25 | * @since 2021/12/31 26 | * @version 1.0 27 | */ 28 | trait FriendGroupRepository[F[_]] extends BaseRepository[F, FriendGroup] { 29 | 30 | def createFriendGroup(friend: FriendGroup): F[Int] 31 | 32 | def findFriendGroupsById(uid: Int): F[FriendGroup] 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/GroupMemberRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | /** @author 22 | * 梦境迷离 23 | * @since 2022/1/15 24 | * @version 1.0 25 | */ 26 | trait GroupMemberRepository[F[_]] extends BaseRepository[F, GroupMember] { 27 | 28 | def leaveOutGroup(groupMember: GroupMember): F[Int] 29 | 30 | def findGroupMembers(gid: Int): F[Int] 31 | 32 | def addGroupMember(groupMember: GroupMember): F[Int] 33 | 34 | } 35 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/GroupRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | /** 群组的操作定义 22 | * 23 | * @author 24 | * 梦境迷离 25 | * @since 2021/12/29 26 | * @version 1.0 27 | */ 28 | trait GroupRepository[F[_]] extends BaseRepository[F, GroupList] { 29 | 30 | def deleteGroup(id: Int): F[Int] 31 | 32 | def countGroup(groupName: Option[String]): F[Int] 33 | 34 | def createGroupList(group: GroupList): F[Long] 35 | 36 | def findGroups(groupName: Option[String]): F[GroupList] 37 | 38 | def findGroupById(gid: Int): F[GroupList] 39 | 40 | def findGroupsById(uid: Int): F[GroupList] 41 | 42 | } 43 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/ReceiveRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | /** 消息的操作定义 22 | * 23 | * @author 24 | * LittleTear 25 | * @since 2021/12/30 26 | * @version 1.0 27 | */ 28 | trait ReceiveRepository[F[_]] extends BaseRepository[F, Receive] { 29 | 30 | def saveMessage(receive: Receive): F[Int] 31 | 32 | def findOffLineMessage(uid: Int, status: Int): F[Receive] 33 | 34 | def findHistoryMessage(uid: Option[Int], mid: Option[Int], typ: Option[String]): F[Receive] 35 | 36 | def countHistoryMessage(uid: Option[Int], mid: Option[Int], typ: Option[String]): F[Int] 37 | 38 | def readMessage(mine: Int, to: Int, typ: String): F[Int] 39 | 40 | } 41 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/UserRepository.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.repository 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | /** 用户的操作定义 22 | * 23 | * @author 24 | * 梦境迷离 25 | * @since 2021/12/25 26 | * @version 1.0 27 | */ 28 | trait UserRepository[F[_]] extends BaseRepository[F, User] { 29 | 30 | def countUser(username: Option[String], sex: Option[Int]): F[Int] 31 | 32 | def findUsers(username: Option[String], sex: Option[Int]): F[User] 33 | 34 | def updateAvatar(avatar: String, uid: Int): F[Int] 35 | 36 | def updateSign(sign: String, uid: Int): F[Int] 37 | 38 | def updateUserInfo(id: Int, user: User): F[Int] 39 | 40 | def updateUserStatus(status: String, uid: Int): F[Int] 41 | 42 | def activeUser(activeCode: String): F[Int] 43 | 44 | def findUserByGroupId(gid: Int): F[User] 45 | 46 | def findUsersByFriendGroupIds(fgid: Int): F[User] 47 | 48 | def saveUser(user: User): F[Long] 49 | 50 | def matchUser(email: String): F[User] 51 | } 52 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/repository/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api 18 | 19 | import eu.timepit.refined.api._ 20 | import scalikejdbc.SQLSyntax 21 | 22 | package object repository { 23 | 24 | final case class Condition(key: String, value: Any) 25 | 26 | object Condition { 27 | 28 | /** define params value type 29 | */ 30 | final case class ConditionValidator() 31 | 32 | object ConditionValidator { 33 | 34 | implicit val conditionValueValidate: Validate.Plain[Condition, ConditionValidator] = Validate.fromPredicate( 35 | p => 36 | p != null || 37 | p.value.isInstanceOf[Serializable] || 38 | p.value.isInstanceOf[SQLSyntax] || 39 | (p.value match { 40 | case Some(o) => o.isInstanceOf[Serializable] || o.isInstanceOf[SQLSyntax] 41 | case None => true 42 | case _ => false 43 | }), 44 | p => s"($p should be a instance of the `org.bitlap.zim.domain.Condition`)", 45 | ConditionValidator() 46 | ) 47 | } 48 | 49 | // 有点丑, 目前仅支持常量的编译器校验 50 | type ZCondition = Condition Refined ConditionValidator 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /modules/zim-api/src/main/scala/org/bitlap/zim/api/service/PaginationApiService.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.api.service 18 | 19 | import org.bitlap.zim.domain._ 20 | import org.bitlap.zim.domain.model._ 21 | 22 | /** 直接提供给endpoint使用 对userService做一定的包装 23 | * 24 | * @author 25 | * 梦境迷离 26 | * @since 2022/8/18 27 | * @version 2.0 28 | */ 29 | trait PaginationApiService[F[_]] { 30 | 31 | /** 分页接口 内存分页 32 | * 33 | * TODO 没有使用数据的offset 34 | * @param id 35 | * @param `type` 36 | * @param page 37 | * @param mid 38 | * @return 39 | */ 40 | def chatLog(id: Int, `type`: String, page: Int, mid: Int): F[ResultPageSet[ChatHistory]] 41 | 42 | def findAddInfo(uid: Int, page: Int): F[ResultPageSet[AddInfo]] 43 | 44 | def findUsers(name: Option[String], sex: Option[Int], page: Int): F[ResultPageSet[User]] 45 | 46 | def findGroups(name: Option[String], page: Int): F[ResultPageSet[GroupList]] 47 | 48 | def findMyGroups(createId: Int, page: Int): F[ResultPageSet[GroupList]] 49 | 50 | } 51 | -------------------------------------------------------------------------------- /modules/zim-cache-api/src/main/resources/reference.conf: -------------------------------------------------------------------------------- 1 | cache { 2 | redis = { 3 | host = "localhost" 4 | port = 6379 5 | } 6 | } -------------------------------------------------------------------------------- /modules/zim-cache-api/src/main/scala/org/bitlap/zim/cache/RedisService.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.cache 18 | 19 | import io.circe._ 20 | 21 | /** Redis缓存服务 22 | * 23 | * @author 24 | * 梦境迷离 25 | * @version 3.0,2022/1/10 26 | */ 27 | 28 | trait RedisService[F[_]] { 29 | 30 | /** 获取Set集合数据 31 | * 32 | * @param k 33 | * @return 34 | * List[String] 35 | */ 36 | def getSets(k: String): F[List[String]] 37 | 38 | /** 移除Set集合中的value 39 | * 40 | * @param k 41 | * @param m 42 | * @return 43 | * Long 44 | */ 45 | def removeSetValue(k: String, m: String): F[Long] 46 | 47 | /** 保存到Set集合中 48 | * 49 | * @param k 50 | * @param m 51 | * @return 52 | * Long 53 | */ 54 | def setSet(k: String, m: String): F[Long] 55 | 56 | /** 存储key-value 57 | * 58 | * @param k 59 | * @param v 60 | * @param expireTime 61 | * @return 62 | * Boolean 63 | */ 64 | def set[T](k: String, v: T, expireTime: JavaDuration = java.time.Duration.ofMinutes(30))(implicit 65 | encoder: Encoder[T] 66 | ): F[Boolean] 67 | 68 | /** 根据key获取value 69 | * 70 | * @param key 71 | * @return 72 | * Object 73 | */ 74 | def get[T](key: String)(implicit decoder: Decoder[T]): F[Option[T]] 75 | 76 | /** 判断key是否存在 77 | * 78 | * @param key 79 | * @return 80 | * Boolean 81 | */ 82 | def exists(key: String): F[Boolean] 83 | 84 | /** 删除key 85 | * 86 | * @param key 87 | * @return 88 | */ 89 | def del(key: String): F[Boolean] 90 | 91 | } 92 | -------------------------------------------------------------------------------- /modules/zim-cache-api/src/main/scala/org/bitlap/zim/cache/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim 18 | 19 | /** @author 20 | * 梦境迷离 21 | * @version 1.0,2022/8/18 22 | */ 23 | package object cache { 24 | type JavaDuration = java.time.Duration 25 | } 26 | -------------------------------------------------------------------------------- /modules/zim-cache-redis4cats/src/main/resources/reference.conf: -------------------------------------------------------------------------------- 1 | cache { 2 | redis = { 3 | host = "localhost" 4 | port = 6379 5 | } 6 | } -------------------------------------------------------------------------------- /modules/zim-cache-redis4cats/src/main/scala/org/bitlap/zim/cache/redis4cats/CatsRedisConfiguration.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.cache.redis4cats 18 | 19 | import com.typesafe.config._ 20 | 21 | /** redis configuration 22 | * 23 | * @author 24 | * 梦境迷离 25 | * @since 2022/8/18 26 | * @version 1.0 27 | */ 28 | object CatsRedisConfiguration { 29 | 30 | private val conf: Config = ConfigFactory.load().getConfig("cache.redis") 31 | lazy val redisHost: String = conf.getString("host") 32 | lazy val redisPort: Int = conf.getInt("port") 33 | 34 | } 35 | -------------------------------------------------------------------------------- /modules/zim-cache-redis4cats/src/main/scala/org/bitlap/zim/cache/redis4cats/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.cache 18 | 19 | import cats.effect.IO 20 | 21 | /** @author 22 | * 梦境迷离 23 | * @version 1.0,2023/3/26 24 | */ 25 | package object redis4cats { 26 | type Redis = RedisService[IO] 27 | } 28 | -------------------------------------------------------------------------------- /modules/zim-cache-redis4zio/src/main/resources/reference.conf: -------------------------------------------------------------------------------- 1 | cache { 2 | redis = { 3 | host = "localhost" 4 | port = 6379 5 | } 6 | } -------------------------------------------------------------------------------- /modules/zim-cache-redis4zio/src/main/scala/org/bitlap/zim/cache/redis4zio/ZioRedisConfiguration.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.cache.redis4zio 18 | 19 | import com.typesafe.config.{Config, _} 20 | 21 | import zio._ 22 | import zio.redis._ 23 | 24 | /** redis configuration 25 | * 26 | * @author 27 | * 梦境迷离 28 | * @since 2022/1/10 29 | * @version 2.1 30 | */ 31 | object ZioRedisConfiguration { 32 | 33 | private val conf: Config = ConfigFactory.load().getConfig("cache.redis") 34 | 35 | lazy val redisConf: ULayer[RedisConfig] = ZLayer.succeed { 36 | if (conf.isEmpty) { 37 | RedisConfig.Default 38 | } else { 39 | RedisConfig(conf.getString("host"), conf.getInt("port")) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /modules/zim-cache-redis4zio/src/main/scala/org/bitlap/zim/cache/redis4zio/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.cache 18 | 19 | import zio._ 20 | 21 | /** @author 22 | * 梦境迷离 23 | * @since 2022/2/27 24 | * @version 1.0 25 | */ 26 | package object redis4zio { 27 | 28 | type ZRedis = RedisService[Task] 29 | } 30 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/Add.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 添加好友、群组 23 | * 24 | * @param groupId 25 | * 好友列表id或群组id 26 | * @param remark 27 | * 附言 28 | * @param `type` 29 | * 类型,好友或群组 30 | */ 31 | final case class Add(groupId: Int, remark: String, `type`: Int) 32 | 33 | object Add { 34 | 35 | implicit val decoder: Decoder[Add] = deriveDecoder[Add] 36 | implicit val encoder: Encoder[Add] = deriveEncoder[Add] 37 | 38 | } 39 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/AddInfo.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import java.time.ZonedDateTime 20 | 21 | import org.bitlap.zim.domain.model.User 22 | 23 | import io.circe._ 24 | import io.circe.generic.semiauto._ 25 | 26 | /** 返回添加好友、群组消息 27 | * 28 | * @param id 29 | * @param uid 30 | * 用户id 31 | * @param content 32 | * 消息内容 33 | * @param from 34 | * 消息发送者id 35 | * @param from_group 36 | * 消息发送者申请加入的群id 37 | * @param `type` 38 | * 消息类型 39 | * @param remark 40 | * 附言 41 | * @param href 42 | * 来源,没使用,未知 43 | * @param read 44 | * 是否已读 45 | * @param time 46 | * 时间 47 | * @param user 48 | * 消息发送者 49 | */ 50 | final case class AddInfo( 51 | id: Int, 52 | uid: Int, 53 | content: String, 54 | from: Int, 55 | from_group: Int, 56 | `type`: Int, 57 | remark: String, 58 | href: String, 59 | read: Int, 60 | time: ZonedDateTime, 61 | user: User 62 | ) 63 | 64 | object AddInfo { 65 | 66 | implicit val decoder: Decoder[AddInfo] = deriveDecoder[AddInfo] 67 | implicit val encoder: Encoder[AddInfo] = deriveEncoder[AddInfo] 68 | } 69 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ChatHistory.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 聊天记录 23 | * 24 | * @param id 25 | * 用户id 26 | * @param username 27 | * 用户名 28 | * @param avatar 29 | * 用户头像 30 | * @param content 31 | * 消息内容 32 | * @param timestamp 33 | * 时间 34 | */ 35 | final case class ChatHistory( 36 | id: Int, 37 | username: String, 38 | avatar: String, 39 | content: String, 40 | timestamp: Long 41 | ) 42 | 43 | object ChatHistory { 44 | 45 | implicit val decoder: Decoder[ChatHistory] = deriveDecoder[ChatHistory] 46 | implicit val encoder: Encoder[ChatHistory] = deriveEncoder[ChatHistory] 47 | } 48 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/FriendAndGroupInfo.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import org.bitlap.zim.domain.model._ 20 | 21 | import io.circe._ 22 | import io.circe.generic.semiauto._ 23 | 24 | import zio.schema._ 25 | 26 | /** 好友和群组整个信息集 27 | * 28 | * @param mine 29 | * 我的信息 30 | * @param friend 31 | * 好友列表 32 | * @param group 33 | * 群组信息列表 34 | */ 35 | final case class FriendAndGroupInfo( 36 | mine: User, 37 | friend: List[FriendList], 38 | group: List[GroupList] 39 | ) 40 | 41 | object FriendAndGroupInfo { 42 | 43 | implicit val decoder: Decoder[FriendAndGroupInfo] = deriveDecoder[FriendAndGroupInfo] 44 | implicit val encoder: Encoder[FriendAndGroupInfo] = deriveEncoder[FriendAndGroupInfo] 45 | implicit val schema: Schema[FriendAndGroupInfo] = DeriveSchema.gen[FriendAndGroupInfo] 46 | 47 | } 48 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/FriendList.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import org.bitlap.zim.domain.model.User 20 | 21 | import io.circe._ 22 | import io.circe.generic.semiauto._ 23 | import io.circe.syntax.EncoderOps 24 | 25 | import zio.schema._ 26 | 27 | /** 好友列表 28 | * 29 | * 好友列表也是一种group 30 | * 31 | * 一个好友列表有多个用户 32 | * 33 | * @param id 34 | * 好友列表id 35 | * @param groupName 36 | * 列表名称 37 | * @param list 38 | * 用户列表 39 | */ 40 | final case class FriendList(override val id: Int, override val groupName: String, list: List[User]) 41 | extends Group(id, groupName) 42 | 43 | object FriendList { 44 | 45 | implicit val decoder: Decoder[FriendList] = deriveDecoder[FriendList] 46 | 47 | implicit val encoder: Encoder[FriendList] = (a: FriendList) => 48 | if (a == null) Json.Null 49 | else 50 | Json.obj( 51 | ("id", Json.fromInt(a.id)), 52 | ("groupname", Json.fromString(a.groupName)), 53 | ("list", a.list.asJson) 54 | ) 55 | implicit val schema: Schema[FriendList] = DeriveSchema.gen[FriendList] 56 | 57 | } 58 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/Group.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 群组 23 | * 24 | * @param id 25 | * 群组id 26 | * @param groupName 27 | * 群组名 28 | */ 29 | @SerialVersionUID(1L) class Group(val id: Int, val groupName: String) 30 | 31 | object Group { 32 | 33 | implicit val decoder: Decoder[Group] = deriveDecoder[Group] 34 | 35 | implicit val encoder: Encoder[Group] = (a: Group) => 36 | if (a == null) Json.Null 37 | else 38 | Json.obj( 39 | ("id", Json.fromInt(a.id)), 40 | ("groupname", Json.fromString(a.groupName)) // 表名是下划线,如果字段名不是标准驼峰不能自动转化。字段名改成驼峰后序列化时处理一下 41 | ) 42 | 43 | } 44 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/Message.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import io.circe._ 20 | import io.circe.syntax.EncoderOps 21 | 22 | /** 消息 23 | * 24 | * @see 25 | * table:t_message 26 | * @param `type` 27 | * 随便定义,用于在服务端区分消息类型 28 | * @param mine 29 | * 我的信息 30 | * @param to 31 | * 对方信息 32 | * @param msg 33 | * 额外的信息 34 | */ 35 | final case class Message(`type`: String, mine: Mine, to: To, msg: String) 36 | 37 | object Message { 38 | 39 | implicit val decoder: Decoder[Message] = (c: HCursor) => 40 | if (!c.succeeded) null 41 | else 42 | for { 43 | typ <- c.downField("type").as[String] 44 | mine <- { 45 | if (checkJsonValue(c, "mine")) { 46 | c.downField("mine").as[Mine] 47 | } else { 48 | Right(null) 49 | } 50 | } 51 | to <- 52 | if (checkJsonValue(c, "to")) { 53 | c.downField("to").as[To] 54 | } else { 55 | Right(null) 56 | } 57 | msg <- c.getOrElse("msg")("{}") 58 | } yield Message(`type` = typ, mine = mine, to = to, msg = msg) 59 | 60 | implicit val encoder: Encoder[Message] = (a: Message) => 61 | if (a == null) Json.Null 62 | else 63 | Json.obj( 64 | ("type", Json.fromString(a.`type`)), 65 | ("mine", Json.fromString(if (a.mine != null) a.mine.asJson.noSpaces else Json.Null.noSpaces)), 66 | ("to", Json.fromString(if (a.to != null) a.to.asJson.noSpaces else Json.Null.noSpaces)), 67 | ("msg", Json.fromString(a.msg)) 68 | ) 69 | 70 | @inline private def checkJsonValue(c: HCursor, field: String): Boolean = 71 | c.downField(field).succeeded && c.downField(field).as[Json].isRight && 72 | c.downField(field).as[Json].getOrElse(Json.fromString("null")) != Json.fromString("null") 73 | 74 | } 75 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/Mine.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import io.circe._ 20 | 21 | /** 我发送的消息和我的信息 22 | * 23 | * @param id 24 | * 我的id 25 | * @param username 26 | * 我的昵称 27 | * @param mine 28 | * 是否我发的消息 29 | * @param avatar 30 | * 我的头像 31 | * @param content 32 | * 消息内容 33 | */ 34 | final case class Mine(id: Int, username: String, mine: Boolean, avatar: String, content: String) 35 | 36 | object Mine { 37 | 38 | implicit val decoder: Decoder[Mine] = (c: HCursor) => 39 | if (!c.succeeded) null 40 | else 41 | for { 42 | id <- c.getOrElse[Int]("id")(0) 43 | username <- c.getOrElse[String]("username")("") 44 | mine <- c.getOrElse[Boolean]("mine")(false) 45 | avatar <- c.getOrElse[String]("avatar")("") 46 | content <- c.getOrElse[String]("content")("") 47 | } yield Mine(id, username, mine, avatar, content) 48 | 49 | implicit val encoder: Encoder[Mine] = (a: Mine) => 50 | if (a == null) Json.Null 51 | else 52 | Json.obj( 53 | ("id", Json.fromInt(a.id)), 54 | ("username", Json.fromString(a.username)), 55 | ("mine", Json.fromBoolean(a.mine)), 56 | ("avatar", Json.fromString(a.avatar)), 57 | ("content", Json.fromString(a.content)) 58 | ) 59 | 60 | } 61 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ResultPageSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | /** 具有分页功能的结果集 20 | * 21 | * @param data 22 | * 每页数据 23 | * @param pages 24 | * 页数 25 | * @tparam T 26 | * 分页内容 27 | * @since 2022年1月1日 28 | * @author 29 | * 梦境迷离 30 | */ 31 | final case class ResultPageSet[T](override val data: List[T] = Nil, pages: Int) extends ResultSet(data) 32 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ResultSet.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | /** 结果集 20 | * 21 | * @param code 22 | * 状态,0表示成功,其他表示失败 23 | * @param msg 24 | * 额外信息 25 | * @since 2021年12月25日 26 | * @author 27 | * 梦境迷离 28 | */ 29 | class ResultSet[T]( 30 | val data: T, 31 | val code: Int = SystemConstant.SUCCESS, 32 | val msg: String = SystemConstant.SUCCESS_MESSAGE 33 | ) 34 | 35 | object ResultSet { 36 | 37 | def apply[T]( 38 | data: T = null, 39 | code: Int = SystemConstant.SUCCESS, 40 | msg: String = SystemConstant.SUCCESS_MESSAGE 41 | ): ResultSet[T] = new ResultSet(data, code, msg) 42 | } 43 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/SystemConstant.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | /** 系统常量 20 | * 21 | * @since 2021年12月25日 22 | * @author 23 | * 梦境迷离 24 | */ 25 | object SystemConstant { 26 | 27 | final val SUCCESS: Int = 0 28 | final val ERROR: Int = 1 29 | 30 | final val NOT_LOGIN: String = "未登陆" 31 | 32 | final val NON_ACTIVE: String = "用户未激活" 33 | 34 | final val REGISTER_FAIL: String = "注册失败" 35 | 36 | final val LOGIN_ERROR: String = "用户名或密码错误" 37 | 38 | final val SUCCESS_MESSAGE: String = "操作成功" 39 | 40 | final val ERROR_MESSAGE: String = "操作失败" 41 | 42 | final val PARAM_ERROR: String = "参数错误" 43 | 44 | final val IMAGE_PATH: String = "/static/upload/image/" 45 | 46 | final val FILE_PATH: String = "/static/upload/file/" 47 | 48 | final val AVATAR_PATH: String = "/static/image/avatar/" 49 | 50 | final val GROUP_AVATAR_PATH: String = "/static/image/group/" 51 | 52 | final val DEFAULT_GROUP_NAME: String = "我的好友" 53 | 54 | // 电子邮件相关 55 | final val SUBJECT: String = "zim 即时通讯系统邮箱激活邮件" 56 | 57 | // Redis Key相关 58 | final val ONLINE_USER: String = "ONLINE_USER" 59 | 60 | final val SYSTEM_PAGE: Int = 6 61 | 62 | final val USER_PAGE: Int = 21 63 | 64 | final val ADD_MESSAGE_PAGE: Int = 4 65 | 66 | final val GROUP_TYPE: String = "group" 67 | 68 | final val FRIEND_TYPE: String = "friend" 69 | 70 | object status { 71 | val ONLINE: String = "online" 72 | val HIDE: String = "hide" 73 | val ONLINE_DESC: String = "在线" 74 | val HIDE_DESC: String = "离线" 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/To.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import io.circe._ 20 | 21 | /** 发送给...的信息 22 | * 23 | * @param id 24 | * 对方的id 25 | * @param username 26 | * 名字 27 | * @param sign 28 | * 签名 29 | * @param avatar 30 | * 头像 31 | * @param status 32 | * 状态 33 | * @param `type` 34 | * 聊天类型,一般分friend和group两种,group即群聊 35 | */ 36 | final case class To( 37 | id: Int, 38 | username: String, 39 | sign: String, 40 | avatar: String, 41 | status: String, 42 | `type`: String 43 | ) 44 | 45 | object To { 46 | 47 | implicit val decoder: Decoder[To] = (c: HCursor) => 48 | if (!c.succeeded) null 49 | else 50 | for { 51 | id <- c.getOrElse[Int]("id")(0) 52 | username <- c.getOrElse[String]("username")("") 53 | sign <- c.getOrElse[String]("sign")("") 54 | avatar <- c.getOrElse[String]("avatar")("") 55 | status <- c.getOrElse[String]("status")("") 56 | typ <- c.getOrElse[String]("type")("") 57 | } yield To(id, username, sign, avatar, status, typ) 58 | 59 | implicit val encoder: Encoder[To] = (a: To) => 60 | if (a == null) Json.Null 61 | else 62 | Json.obj( 63 | ("id", Json.fromInt(a.id)), 64 | ("username", Json.fromString(a.username)), 65 | ("sign", Json.fromString(a.sign)), 66 | ("avatar", Json.fromString(a.avatar)), 67 | ("status", Json.fromString(a.status)), 68 | ("type", Json.fromString(a.`type`)) 69 | ) 70 | 71 | } 72 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/UploadResult.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/1/1 25 | * @version 1.0 26 | */ 27 | final case class UploadResult(src: String, name: String) 28 | 29 | object UploadResult { 30 | 31 | implicit val decoder: Decoder[UploadResult] = deriveDecoder[UploadResult] 32 | implicit val encoder: Encoder[UploadResult] = deriveEncoder[UploadResult] 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ZimError.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain 18 | 19 | /** 系统异常 20 | * 21 | * @author 22 | * 梦境迷离 23 | * @since 2021/12/25 24 | * @version 1.0 25 | */ 26 | sealed trait ZimError extends Throwable with Product { 27 | val msg: String 28 | val code: Int 29 | } 30 | 31 | object ZimError { 32 | 33 | case class BusinessException( 34 | override val code: Int = SystemConstant.ERROR, 35 | override val msg: String = SystemConstant.ERROR_MESSAGE 36 | ) extends ZimError 37 | 38 | case class Unauthorized( 39 | override val code: Int = SystemConstant.ERROR, 40 | override val msg: String = SystemConstant.NOT_LOGIN 41 | ) extends ZimError 42 | } 43 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/AgreeFriendInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/2/5 25 | * @version 1.0 26 | */ 27 | final case class AgreeFriendInput(uid: Int, from_group: Int, group: Int, messageBoxId: Int) 28 | 29 | object AgreeFriendInput { 30 | 31 | implicit val decoder: Decoder[AgreeFriendInput] = deriveDecoder[AgreeFriendInput] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/ChangeGroupInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/2/5 25 | * @version 1.0 26 | */ 27 | final case class ChangeGroupInput(groupId: Int, userId: Int) 28 | 29 | object ChangeGroupInput { 30 | 31 | implicit val decoder: Decoder[ChangeGroupInput] = deriveDecoder[ChangeGroupInput] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/ExistEmailInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 校验注册邮件 输入 23 | * @param email 24 | */ 25 | final case class ExistEmailInput(email: String) 26 | 27 | object ExistEmailInput { 28 | 29 | implicit val decoder: Decoder[ExistEmailInput] = deriveDecoder[ExistEmailInput] 30 | 31 | implicit val encoder: Encoder[ExistEmailInput] = deriveEncoder[ExistEmailInput] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/FriendGroupInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 好友分组 输入 23 | * 24 | * @param uid 25 | * 创建人 26 | * @param groupname 27 | * 分组名称 28 | */ 29 | final case class FriendGroupInput(uid: Int, groupname: String) 30 | 31 | object FriendGroupInput { 32 | 33 | implicit val decoder: Decoder[FriendGroupInput] = deriveDecoder[FriendGroupInput] 34 | 35 | } 36 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/GroupInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 群组 输入 23 | * 24 | * @param groupname 25 | * 分组名称 26 | * @param avatar 27 | * 头像 28 | * @param createId 29 | * 创建人 creator Id 30 | */ 31 | final case class GroupInput(groupname: String, avatar: String, createId: Int) 32 | 33 | object GroupInput { 34 | 35 | implicit val decoder: Decoder[GroupInput] = deriveDecoder[GroupInput] 36 | 37 | implicit val encoder: Encoder[GroupInput] = deriveEncoder[GroupInput] 38 | 39 | } 40 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/LeaveOutGroupInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/2/5 25 | * @version 1.0 26 | */ 27 | final case class LeaveOutGroupInput(groupId: Int, uid: Int) 28 | 29 | object LeaveOutGroupInput { 30 | 31 | implicit val decoder: Decoder[LeaveOutGroupInput] = deriveDecoder[LeaveOutGroupInput] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/RefuseFriendInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/2/5 25 | * @version 1.0 26 | */ 27 | final case class RefuseFriendInput(messageBoxId: Int, to: Int) 28 | 29 | object RefuseFriendInput { 30 | 31 | implicit val decoder: Decoder[RefuseFriendInput] = deriveDecoder[RefuseFriendInput] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/RegisterUserInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 注册用户信息提交 输入 23 | * 24 | * @param username 25 | * 用户名 26 | * @param email 27 | * 邮箱 28 | * @param password 29 | * 密码 30 | */ 31 | final case class RegisterUserInput( 32 | username: String, 33 | password: String, 34 | email: String 35 | ) 36 | 37 | object RegisterUserInput { 38 | 39 | implicit val decoder: Decoder[RegisterUserInput] = deriveDecoder[RegisterUserInput] 40 | 41 | // 测试用 42 | implicit val encoder: Encoder[RegisterUserInput] = deriveEncoder[RegisterUserInput] 43 | 44 | } 45 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/RemoveFriendInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/2/5 25 | * @version 1.0 26 | */ 27 | final case class RemoveFriendInput(friendId: Int) 28 | 29 | object RemoveFriendInput { 30 | 31 | implicit val decoder: Decoder[RemoveFriendInput] = deriveDecoder[RemoveFriendInput] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/UpdateSignInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/2/5 25 | * @version 1.0 26 | */ 27 | final case class UpdateSignInput(sign: String) 28 | 29 | object UpdateSignInput { 30 | 31 | implicit val decoder: Decoder[UpdateSignInput] = deriveDecoder[UpdateSignInput] 32 | 33 | implicit val encoder: Encoder[UpdateSignInput] = deriveEncoder[UpdateSignInput] 34 | 35 | } 36 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/UpdateUserInput.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 用户信息提交 输入 23 | * 24 | * @param id 25 | * @param username 26 | * 用户名 27 | * @param password 28 | * 密码 29 | * @param oldpwd 30 | * 旧密码 31 | * @param sign 32 | * 签名 33 | * @param sex 34 | * 性别 35 | */ 36 | final case class UpdateUserInput( 37 | id: Int, 38 | username: String, 39 | password: Option[String], 40 | oldpwd: Option[String], 41 | sign: String, 42 | sex: String 43 | ) 44 | 45 | object UpdateUserInput { 46 | 47 | implicit val decoder: Decoder[UpdateUserInput] = deriveDecoder[UpdateUserInput] 48 | 49 | implicit val encoder: Encoder[UpdateUserInput] = deriveEncoder[UpdateUserInput] 50 | 51 | } 52 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/input/UserToken.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.input 18 | 19 | import java.nio.charset.Charset 20 | import java.util.Base64 21 | 22 | import io.circe._ 23 | import io.circe.generic.semiauto._ 24 | 25 | import zio.schema._ 26 | 27 | /** 用户登录 输入 cookie 28 | * @param cookie 29 | * token 目前是邮箱+密码 30 | */ 31 | final case class UserToken(cookie: String) 32 | 33 | object UserToken { 34 | 35 | implicit val decoder: Decoder[UserToken] = deriveDecoder[UserToken] 36 | 37 | case class UserSecurityInfo(id: Int, email: String, password: String, username: String) { 38 | 39 | def toCookieValue: String = { 40 | val base64 = Base64.getEncoder.encode(s"$email:$password".getBytes(Charset.forName("utf8"))) 41 | new String(base64) 42 | } 43 | } 44 | 45 | object UserSecurityInfo { 46 | 47 | implicit val encoder: Encoder[UserSecurityInfo] = deriveEncoder[UserSecurityInfo] 48 | 49 | implicit val decoder: Decoder[UserSecurityInfo] = (c: HCursor) => 50 | if (!c.succeeded) null 51 | else 52 | for { 53 | id <- c.getOrElse("id")(0) 54 | email <- c.downField("email").as[String] 55 | password <- c.downField("password").as[String] 56 | username <- c.getOrElse("username")("") 57 | } yield UserSecurityInfo(id, email, password, username) 58 | 59 | implicit val userSecuritySchema: Schema[UserSecurityInfo] = DeriveSchema.gen[UserSecurityInfo] 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/model/AddFriend.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.model 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | import scalikejdbc.{WrappedResultSet, _} 23 | 24 | /** 添加好友 25 | * @see 26 | * table:t_friend_group_friends 27 | * @param id 28 | * 表ID 无意义 29 | * @param uid 30 | * 用户ID 31 | * @param fgid 32 | * 分组ID 33 | */ 34 | final case class AddFriend(uid: Int, fgid: Int, id: Int = 0) 35 | 36 | object AddFriend extends BaseModel[AddFriend] { 37 | 38 | override lazy val columns: collection.Seq[String] = autoColumns[AddFriend]() 39 | 40 | override def tableName: String = "t_friend_group_friends" 41 | 42 | implicit val decoder: Decoder[AddFriend] = deriveDecoder[AddFriend] 43 | implicit val encoder: Encoder[AddFriend] = deriveEncoder[AddFriend] 44 | 45 | override def apply(rs: WrappedResultSet)(implicit sp: SyntaxProvider[AddFriend]): AddFriend = 46 | autoConstruct[AddFriend](rs, sp) 47 | } 48 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/model/BaseModel.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.model 18 | 19 | import scalikejdbc._ 20 | 21 | trait BaseModel[T] extends SQLSyntaxSupport[T] { 22 | 23 | def apply(rs: WrappedResultSet)(implicit sp: SyntaxProvider[T]): T 24 | 25 | } 26 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/model/FriendGroup.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.model 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | import scalikejdbc.{WrappedResultSet, _} 23 | 24 | /** 用户创建的好友列表 25 | * 26 | * @see 27 | * table:t_friend_group 28 | * @param id 29 | * 分组ID 30 | * @param uid 31 | * 用户id,该分组所属的用户ID 32 | * @param groupName 33 | * 群组名称 34 | */ 35 | final case class FriendGroup(id: Int, uid: Int, groupName: String) 36 | 37 | object FriendGroup extends BaseModel[FriendGroup] { 38 | 39 | override lazy val columns: collection.Seq[String] = autoColumns[FriendGroup]() 40 | 41 | override def apply(rs: WrappedResultSet)(implicit sp: SyntaxProvider[FriendGroup]): FriendGroup = 42 | autoConstruct[FriendGroup](rs, sp) 43 | 44 | override def tableName: String = "t_friend_group" 45 | 46 | implicit val decoder: Decoder[FriendGroup] = deriveDecoder[FriendGroup] 47 | 48 | implicit val encoder: Encoder[FriendGroup] = (a: FriendGroup) => 49 | if (a == null) Json.Null 50 | else 51 | Json.obj( 52 | ("id", Json.fromInt(a.id)), 53 | ("uid", Json.fromInt(a.id)), 54 | ("groupname", Json.fromString(a.groupName)) 55 | ) 56 | } 57 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/model/GroupList.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.model 18 | 19 | import org.bitlap.zim.domain.Group 20 | 21 | import io.circe._ 22 | import io.circe.generic.semiauto._ 23 | 24 | import scalikejdbc.{WrappedResultSet, _} 25 | import zio.schema._ 26 | 27 | /** 群组信息 28 | * 29 | * @see 30 | * table:t_group 31 | * @param id 32 | * 群组id 33 | * @param groupName 34 | * 群组名称 35 | * @param avatar 36 | * 头像 37 | * @param createId 38 | * 创建人ID 39 | */ 40 | final case class GroupList( 41 | override val id: Int, 42 | override val groupName: String, 43 | avatar: String, 44 | createId: Int 45 | ) extends Group(id, groupName) 46 | 47 | object GroupList extends BaseModel[GroupList] { 48 | 49 | // 能自动处理驼峰和非驼峰 不能处理 group_name => groupname 50 | override lazy val columns: collection.Seq[String] = autoColumns[GroupList]() 51 | 52 | override def tableName: String = "t_group" 53 | 54 | implicit val decoder: Decoder[GroupList] = deriveDecoder[GroupList] 55 | 56 | implicit val encoder: Encoder[GroupList] = (a: GroupList) => 57 | if (a == null) Json.Null 58 | else 59 | Json.obj( 60 | ("id", Json.fromInt(a.id)), 61 | ("groupname", Json.fromString(a.groupName)), 62 | ("avatar", Json.fromString(a.avatar)), 63 | ("createId", Json.fromInt(a.createId)) 64 | ) 65 | 66 | override def apply(rs: WrappedResultSet)(implicit sp: SyntaxProvider[GroupList]): GroupList = autoConstruct(rs, sp) 67 | 68 | implicit val groupListSchema: Schema[GroupList] = DeriveSchema.gen[GroupList] 69 | 70 | } 71 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/model/GroupMember.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.model 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | import scalikejdbc.{WrappedResultSet, _} 23 | 24 | /** 群组成员 25 | * 26 | * @see 27 | * table:t_group_members 28 | * @param id 29 | * 表ID 无意义 30 | * @param gid 31 | * 群组编号 32 | * @param uid 33 | * 用户编号 34 | */ 35 | final case class GroupMember(gid: Int, uid: Int, id: Int = 0) 36 | 37 | object GroupMember extends BaseModel[GroupMember] { 38 | 39 | override lazy val columns: collection.Seq[String] = autoColumns[GroupMember]() 40 | 41 | override def apply(rs: WrappedResultSet)(implicit sp: SyntaxProvider[GroupMember]): GroupMember = 42 | autoConstruct[GroupMember](rs, sp) 43 | 44 | override def tableName: String = "t_group_members" 45 | 46 | implicit val decoder: Decoder[GroupMember] = deriveDecoder[GroupMember] 47 | implicit val encoder: Encoder[GroupMember] = deriveEncoder[GroupMember] 48 | 49 | } 50 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim 18 | 19 | import java.time.ZonedDateTime 20 | import java.time.format.DateTimeFormatter 21 | 22 | import scala.util.Try 23 | 24 | import io.circe._ 25 | 26 | import zio.schema._ 27 | 28 | /** @author 29 | * 梦境迷离 30 | * @since 2022/2/2 31 | * @version 1.0 32 | */ 33 | package object domain { 34 | 35 | implicit val encodeDate: Encoder[ZonedDateTime] = 36 | Encoder.encodeString.contramap[ZonedDateTime](t => 37 | if (t == null) "" else t.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) 38 | ) 39 | 40 | implicit val decodeDate: Decoder[ZonedDateTime] = Decoder.decodeString.emapTry { str => 41 | Try { 42 | if (str == null) ZonedDateTime.now() else ZonedDateTime.parse(str) 43 | } 44 | } 45 | 46 | // 定义自己的schema 用以描述日期序列化 47 | implicit val zonedDateTimeSchema: Schema[ZonedDateTime] = Schema[String].transformOrFail( 48 | f => Right(if (f == null) ZonedDateTime.now() else ZonedDateTime.parse(f)), 49 | g => Right(if (g == null) "" else g.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))) 50 | ) 51 | 52 | } 53 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ws/Constants.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.ws 18 | 19 | /** @author 20 | * 梦境迷离 21 | * @version 1.0,2022/1/11 22 | */ 23 | object Constants { 24 | 25 | final val SCHEDULE_JOB_ACTOR: String = "scheduleJobActor" 26 | final val USER_STATUS_CHANGE_ACTOR: String = "userStatusChangeActor" 27 | final val WS_MESSAGE_FORWARD_ACTOR: String = "wsMessageForwardActor" 28 | 29 | } 30 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ws/Group.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.ws 18 | 19 | import io.circe._ 20 | import io.circe.generic.semiauto._ 21 | 22 | /** 添加群的信息 23 | */ 24 | final case class Group(groupId: Int, remark: String) 25 | 26 | object Group { 27 | 28 | implicit val decoder: Decoder[Group] = deriveDecoder[Group] 29 | implicit val encoder: Encoder[Group] = deriveEncoder[Group] 30 | 31 | } 32 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ws/RefuseOrAgreeMessage.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.ws 18 | 19 | import org.bitlap.zim.domain.Mine 20 | 21 | import io.circe._ 22 | import io.circe.generic.semiauto._ 23 | 24 | /** 同意或拒绝添加群的信息 25 | */ 26 | final case class RefuseOrAgreeMessage(toUid: Int, groupId: Int, messageBoxId: Int, mine: Mine) 27 | 28 | object RefuseOrAgreeMessage { 29 | 30 | implicit val decoder: Decoder[RefuseOrAgreeMessage] = deriveDecoder[RefuseOrAgreeMessage] 31 | implicit val encoder: Encoder[RefuseOrAgreeMessage] = deriveEncoder[RefuseOrAgreeMessage] 32 | 33 | } 34 | -------------------------------------------------------------------------------- /modules/zim-domain/src/main/scala/org/bitlap/zim/domain/ws/protocol/Command.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.domain.ws.protocol 18 | 19 | import org.bitlap.zim.domain.Message 20 | 21 | import akka.actor.ActorRef 22 | 23 | import io.circe.parser.decode 24 | 25 | /** ws actor command 26 | */ 27 | sealed trait Command[+T] 28 | 29 | /** proxy 30 | * @param uId 31 | * @param msg 32 | * Now, default type is `String`, we use toJson to convert anything, should fix it in the future. 33 | * @param originActorRef 34 | * The message comes from user, who send message to server flow by akka. 35 | */ 36 | final case class TransmitMessageProxy( 37 | uId: Int, 38 | msg: String, 39 | originActorRef: Option[ActorRef] 40 | ) extends Command[String] { 41 | 42 | def getMessage: Message = decode[Message](msg).getOrElse(null) 43 | 44 | } 45 | 46 | /** 在线用户 47 | */ 48 | final case class OnlineUserMessage(description: Option[String]) extends Command[Unit] 49 | 50 | /** 用户状态变更 51 | */ 52 | final case class UserStatusChangeMessage(uId: Int, typ: String, description: Option[String] = None) 53 | extends Command[Unit] 54 | -------------------------------------------------------------------------------- /modules/zim-infra/src/main/resources/reference.conf: -------------------------------------------------------------------------------- 1 | infrastructure { 2 | mysql { 3 | url = "jdbc:mysql://localhost:3306/zim?useUnicode=true&useSSL=false&characterEncoding=utf-8" 4 | user = "root" 5 | password = "root" 6 | databaseName = "zim" 7 | connection { 8 | initialPoolSize = 1, 9 | maxPoolSize = 5, 10 | timeoutMillis = 3000, 11 | validationQuery = "select 1", 12 | driver = "com.mysql.jdbc.Driver" 13 | } 14 | } 15 | 16 | javamail { 17 | host = "x", 18 | username = "", 19 | password = "", 20 | port = 0, 21 | threadPoolSize = 20, 22 | connectionPoolCoreSize = 10, 23 | debug = true 24 | sender = "111.@qq.com" 25 | } 26 | } 27 | application { 28 | name = "ZIM" 29 | server { 30 | port = 8989 31 | interface = "0.0.0.0" 32 | webHost = "im.dreamylost.cn" 33 | } 34 | } -------------------------------------------------------------------------------- /modules/zim-infra/src/main/scala/org/bitlap/zim/infrastructure/properties/MysqlConfigurationProperties.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.infrastructure.properties 18 | 19 | import com.typesafe.config._ 20 | 21 | /** mysql configuration 22 | * 23 | * @author 24 | * 梦境迷离 25 | * @since 2021/12/25 26 | * @version 1.0 27 | */ 28 | final case class MysqlConfigurationProperties( 29 | url: String, 30 | user: String, 31 | password: String, 32 | databaseName: String, 33 | initialSize: Integer, 34 | maxSize: Integer, 35 | connectionTimeoutMillis: Long, 36 | validationQuery: String, 37 | driverName: String 38 | ) 39 | 40 | object MysqlConfigurationProperties { 41 | 42 | lazy val conf: Config = ConfigFactory.load().getConfig("infrastructure.mysql") 43 | 44 | def apply(config: Config = conf): MysqlConfigurationProperties = 45 | MysqlConfigurationProperties( 46 | url = config.getString("url"), 47 | user = config.getString("user"), 48 | password = config.getString("password"), 49 | databaseName = config.getString("databaseName"), 50 | initialSize = config.getInt("connection.initialPoolSize"), 51 | maxSize = config.getInt("connection.maxPoolSize"), 52 | connectionTimeoutMillis = config.getLong("connection.timeoutMillis"), 53 | validationQuery = config.getString("connection.validationQuery"), 54 | driverName = config.getString("connection.driver") 55 | ) 56 | 57 | } 58 | -------------------------------------------------------------------------------- /modules/zim-infra/src/main/scala/org/bitlap/zim/infrastructure/properties/ZimConfigurationProperties.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.infrastructure.properties 18 | 19 | import com.typesafe.config.{Config, ConfigFactory} 20 | 21 | import zio._ 22 | 23 | /** application configuration(exclude database) 24 | * 25 | * @author 26 | * 梦境迷离 27 | * @since 2021/12/25 28 | * @version 1.0 29 | */ 30 | final case class ZimConfigurationProperties( 31 | name: String, 32 | interface: String, 33 | port: Int, 34 | webHost: String 35 | ) 36 | 37 | object ZimConfigurationProperties { 38 | 39 | lazy val config: Config = ConfigFactory.load().getConfig("application") 40 | 41 | lazy val live: ULayer[ZimConfigurationProperties] = ZLayer.succeed(ZimConfigurationProperties(config)) 42 | 43 | def apply(config: Config = config): ZimConfigurationProperties = 44 | ZimConfigurationProperties( 45 | name = config.getString("name"), 46 | interface = config.getString("server.interface"), 47 | port = config.getInt("server.port"), 48 | webHost = config.getString("server.webHost") 49 | ) 50 | 51 | } 52 | -------------------------------------------------------------------------------- /modules/zim-infra/src/main/scala/org/bitlap/zim/infrastructure/util/DateUtil.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.infrastructure.util 18 | 19 | import java.time.ZonedDateTime 20 | import java.time.format.DateTimeFormatter 21 | 22 | /** 时间工具 23 | * 24 | * @since 2021年12月31日 25 | * @author 26 | * 梦境迷离 27 | */ 28 | object DateUtil { 29 | 30 | final lazy val pattern: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd") 31 | 32 | /** 获取格式化后的当前时间yyyy-MM-dd 33 | * @param now 34 | */ 35 | def getDateString(now: ZonedDateTime = ZonedDateTime.now()): String = 36 | now.format(pattern) 37 | 38 | } 39 | -------------------------------------------------------------------------------- /modules/zim-infra/src/main/scala/org/bitlap/zim/infrastructure/util/LogUtil.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.infrastructure.util 18 | 19 | import zio._ 20 | import zio.stream._ 21 | 22 | /** @author 23 | * 梦境迷离 24 | * @since 2022/1/20 25 | * @version 1.0 26 | */ 27 | object LogUtil { 28 | def info(msg: => String): UIO[Unit] = ZIO.logInfo(msg) 29 | 30 | def debug(msg: => String): UIO[Unit] = ZIO.debug(msg) 31 | 32 | def error(msg: => String): UIO[Unit] = ZIO.logError(msg) 33 | 34 | // 后面要把非必要的stream去掉 35 | def infoS(msg: => String): UStream[Unit] = 36 | ZStream.fromZIO(info(msg)) 37 | 38 | def debugS(msg: => String): UStream[Unit] = 39 | ZStream.fromZIO(debug(msg)) 40 | 41 | def errorS(msg: => String): UStream[Unit] = 42 | ZStream.fromZIO(error(msg)) 43 | } 44 | -------------------------------------------------------------------------------- /modules/zim-infra/src/main/scala/org/bitlap/zim/infrastructure/util/SecurityUtil.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.infrastructure.util 18 | 19 | import java.nio.charset.StandardCharsets.US_ASCII 20 | 21 | import zio._ 22 | import zio.crypto.hash.{Hash, HashAlgorithm, MessageDigest} 23 | 24 | /** SpringSecurity加密工具 PasswordEncoder 25 | * 26 | * @since 2021年12月31日 27 | * @author 28 | * 梦境迷离 29 | */ 30 | object SecurityUtil { 31 | 32 | /** 采用SHA-256算法 33 | * 34 | * @param rawPassword 35 | * @return 36 | * 80位加密后的密码 37 | */ 38 | def encrypt(rawPassword: String): Task[MessageDigest[String]] = 39 | Hash.hash[HashAlgorithm.SHA256](rawPassword, US_ASCII).provideLayer(Hash.live) 40 | 41 | /** 验证密码和加密后密码是否一致 42 | * 43 | * @param rawPassword 44 | * 明文密码 45 | * @param password 46 | * 加密后的密码 47 | * @return 48 | * Boolean 49 | */ 50 | def matched(rawPassword: String, password: String): Task[Boolean] = 51 | (if (rawPassword == null && password == null) ZIO.succeed(true) 52 | else if (rawPassword == null || password == null) ZIO.succeed(false) 53 | else if (rawPassword == "" || password == "") ZIO.succeed(false) 54 | else Hash.verify[HashAlgorithm.SHA256](rawPassword, MessageDigest[String](password), charset = US_ASCII)) 55 | .provideLayer(Hash.live) 56 | 57 | } 58 | -------------------------------------------------------------------------------- /modules/zim-infra/src/main/scala/org/bitlap/zim/infrastructure/util/UuidUtil.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.infrastructure.util 18 | 19 | import java.util.UUID 20 | 21 | import zio._ 22 | 23 | /** UUID工具 24 | * 25 | * @since 2021年12月31日 26 | * @author 27 | * 梦境迷离 28 | */ 29 | object UuidUtil { 30 | 31 | /** 64位随机UUID 32 | */ 33 | def getUuid64: UIO[String] = 34 | ZIO.succeed((UUID.randomUUID.toString + UUID.randomUUID.toString).replace("-", "")) 35 | 36 | /** 32位随机UUID 37 | */ 38 | def getUuid32: UIO[String] = 39 | ZIO.succeed(UUID.randomUUID.toString.replace("-", "")) 40 | 41 | } 42 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/application-docker.conf: -------------------------------------------------------------------------------- 1 | # 将zim构建为容器时使用,区别就是MySQL host和Redis host用了容器名 2 | infrastructure { 3 | mysql { 4 | # 如果改了,docker-compose.yml中也得改 5 | url = "jdbc:mysql://zim_mysql_server:3306/zim?useUnicode=true&useSSL=false&characterEncoding=utf-8" 6 | user = "root" 7 | password = "" 8 | databaseName = "zim" 9 | connection { 10 | initialPoolSize = 1, 11 | maxPoolSize = 5, 12 | timeoutMillis = 3000, 13 | validationQuery = "select 1", 14 | driver = "com.mysql.jdbc.Driver" 15 | } 16 | } 17 | # 容器是为了快速启动zim,不使用注册功能的话,邮件可以不配,忽略即可。 18 | javamail { 19 | host = "host", 20 | username = "", 21 | password = "", 22 | port = 0, 23 | threadPoolSize = 20, 24 | connectionPoolCoreSize = 10, 25 | debug = true 26 | sender = "111.@qq.com" 27 | } 28 | } 29 | 30 | cache { 31 | redis = { 32 | host = "zim_redis_server" 33 | port = 6379 34 | } 35 | } 36 | 37 | application { 38 | name = "ZIM" 39 | server { 40 | port = 9000 41 | interface = "0.0.0.0" 42 | webHost = "im.dreamylost.cn" # 根据需要,可能需要修改 43 | } 44 | } 45 | 46 | akka { 47 | akka.http.server.idle-timeout = 5 s 48 | akka.http.client.idle-timeout = 5 s 49 | actor.default-dispatcher.fork-join-executor.parallelism-max = 64 50 | http.server.websocket.periodic-keep-alive-max-idle = 3 second 51 | http.server.websocket.periodic-keep-alive-mode = pong 52 | actor.debug.unhandled = true 53 | actor.debug.receive = true 54 | loggers = ["akka.event.slf4j.Slf4jLogger"] 55 | loglevel = "DEBUG" 56 | stdout-loglevel = "DEBUG" 57 | logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" 58 | akka.http.server.parsing.max-method-length = 4k 59 | } 60 | custom-dispatcher { 61 | type = Dispatcher 62 | executor = "thread-pool-executor" 63 | thread-pool-executor { 64 | fixed-pool-size = 32 65 | } 66 | throughput = 10 67 | } 68 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/application.conf.example: -------------------------------------------------------------------------------- 1 | infrastructure { 2 | mysql { 3 | url = "jdbc:mysql://localhost:3306/zim?useUnicode=true&useSSL=false&characterEncoding=utf-8" 4 | user = "root" 5 | password = "root" 6 | databaseName = "zim" 7 | connection { 8 | initialPoolSize = 1, 9 | maxPoolSize = 5, 10 | timeoutMillis = 3000, 11 | validationQuery = "select 1", 12 | driver = "com.mysql.jdbc.Driver" 13 | } 14 | } 15 | 16 | javamail { 17 | host = "host", 18 | username = "", 19 | password = "", 20 | port = 0, 21 | threadPoolSize = 20, 22 | connectionPoolCoreSize = 10, 23 | debug = true 24 | sender = "111.@qq.com" 25 | } 26 | } 27 | 28 | cache { 29 | redis = { 30 | host = "localhost" 31 | port = 6379 32 | } 33 | } 34 | 35 | application { 36 | name = "ZIM" 37 | server { 38 | port = 9000 39 | interface = "0.0.0.0" 40 | webHost = "im.dreamylost.cn" # 根据需要,可能需要修改 41 | } 42 | } 43 | 44 | akka { 45 | akka.http.server.idle-timeout = 5 s 46 | akka.http.client.idle-timeout = 5 s 47 | actor.default-dispatcher.fork-join-executor.parallelism-max = 64 48 | http.server.websocket.periodic-keep-alive-max-idle = 3 second 49 | http.server.websocket.periodic-keep-alive-mode = pong 50 | actor.debug.unhandled = true 51 | actor.debug.receive = true 52 | loggers = ["akka.event.slf4j.Slf4jLogger"] 53 | loglevel = "DEBUG" 54 | stdout-loglevel = "DEBUG" 55 | logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" 56 | akka.http.server.parsing.max-method-length = 4k 57 | } 58 | custom-dispatcher { 59 | type = Dispatcher 60 | executor = "thread-pool-executor" 61 | thread-pool-executor { 62 | fixed-pool-size = 32 63 | } 64 | throughput = 10 65 | } 66 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | System.out 6 | 7 | %X{akkaTimestamp} %-5level[%thread] %logger{0} - %msg%n 8 | 9 | 10 | 11 | 12 | logs/zim-akka.log 13 | 14 | %date %level %msg%n 15 | 16 | 17 | 10 18 | logs/zim-akka.log.%i.gz 19 | 20 | 21 | 512MB 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/css/style.css: -------------------------------------------------------------------------------- 1 | *{margin:0;padding:0;box-sizing:border-box;color:#f1f1f1}body{font-family:Verdana,Geneva,Tahoma,sans-serif;background:#eeaeca;background:radial-gradient(circle,rgba(238,174,202,1) 0,rgba(148,187,233,1) 100%)}.container{height:100vh;width:80vw;margin:0 auto;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center}.container .num{font-size:8rem;margin-bottom:40px}.container .stg{font-size:3rem;margin-bottom:40px;display:none;animation:.7s ease-in-out show}@keyframes show{0%{opacity:0}100%{opacity:1}} -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/403.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 |
11 |
12 |
13 | 14 |
15 |

User X

16 |

17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 该页面不存在-404.life 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |

15 |

16 |
17 | 18 | 返回主页 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 未知错误-500.life 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 |

15 |

16 |
17 | 18 | 返回主页 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/creategroup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 创建群组 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 |
19 |
20 | 21 |
22 | 24 |
25 |
26 | 27 |
28 |
29 | 30 | 31 |
32 | 33 |
34 |
35 |
36 | 37 |
38 | 注:上传的图片不能够超过500kb 39 |
40 | 41 |
42 | 43 | 44 |
45 |
46 | 47 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/createusergroup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 创建分组 6 | 7 | 8 | 9 | 10 | 16 | 17 | 18 |
19 |
20 | 21 |
22 | 24 |
25 |
26 |
27 | 28 | 29 |
30 |
31 | 32 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/find.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 查找/添加群组 6 | 7 | 8 | 9 | 10 |
11 | 15 |
16 |
17 |
18 | 20 | 21 | 22 | 23 | 24 | 25 |
26 |
27 |
28 |
29 |
30 | 32 | 33 | 34 | 35 |
36 |
37 |
38 |
39 |
40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/friend.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 好友信息 6 | 7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 | 15 |
16 | 17 |
18 |
19 | 20 |
21 | 22 |
23 | 24 |
25 | 26 |
27 | 28 |
29 |
30 |
31 | 32 |
33 | 34 |
35 |
36 |
37 | 38 |
39 | 40 |
41 |
42 |
43 |
44 |
45 | 46 | 47 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/html/setting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 设置 7 | 8 | 11 | 12 | 13 |
14 | 18 |
19 |
哈哈哈哈哈哈
20 |
哈哈哈哈哈哈
21 |
22 |
23 |
24 |
25 |
26 | 27 |
28 |
29 |
30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/4.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(1).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(1).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(10).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(10).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(2).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(2).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(3).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(3).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(4).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(4).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(5).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(5).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(6).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(6).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(7).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(7).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(8).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(8).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/avatar/avatar(9).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/avatar/avatar(9).jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/favicon.ico -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/group/group_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/group/group_1.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/group/group_2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/group/group_2.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/group/group_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/group/group_3.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/image/group/group_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/image/group/group_4.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/js/403.js: -------------------------------------------------------------------------------- 1 | navigator.sayswho=(function(){var ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(M[1])){tem=/\brv[ :]+(\d+)/g.exec(ua)||[];return"IE "+(tem[1]||"")}if(M[1]==="Chrome"){tem=ua.match(/\b(OPR|Edge)\/(\d+)/);if(tem!=null){return tem.slice(1).join(" ").replace("OPR","Opera")}}M=M[2]?[M[1],M[2]]:[navigator.appName,navigator.appVersion,"-?"];if((tem=ua.match(/version\/(\d+)/i))!=null){M.splice(1,1,tem[1])}return M.join(" ")})();$(".box .version").html(navigator.sayswho);var text=["403","Forbidden"];var counter=0;var elem=$(".monitor");function scanning(){elem.html("Forbidden");var inst=setInterval(change,1000)}function change(){elem.html(text[counter]);elem.toggleClass("text");counter++;if(counter>=text.length){counter=0}}var box=".box";var tl=new TimelineMax();tl.to(box,4,{right:"0",ease:Power0.easeNone});tl.call(function(){$(box).addClass("scanned");$(".scan-window").addClass("scanning");scanning()},null,null,2.5); -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/js/404-script.js: -------------------------------------------------------------------------------- 1 | // Declare the Elements 2 | const dispNum = document.querySelector(".display .num"); 3 | const dispErr = document.querySelector(".container .stg"); 4 | 5 | 6 | window.onload = function () { 7 | 8 | function showNum () { 9 | const randomNum = Math.floor(Math.random() * 1000); 10 | const randomStr = randomNum.toString() 11 | 12 | dispNum.textContent = randomStr 13 | } 14 | 15 | var interval = setInterval( showNum , 500); 16 | 17 | 18 | 19 | setTimeout(()=> { 20 | clearInterval(interval); 21 | 22 | dispNum.textContent = "404"; 23 | dispErr.style.display = "block"; 24 | dispErr.textContent = "呀!这个页面走丢了" 25 | }, 4000); 26 | } -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/js/500-script.js: -------------------------------------------------------------------------------- 1 | // Declare the Elements 2 | const dispNum = document.querySelector(".display .num"); 3 | const dispErr = document.querySelector(".container .stg"); 4 | 5 | 6 | window.onload = function () { 7 | 8 | function showNum () { 9 | const randomNum = Math.floor(Math.random() * 1000); 10 | const randomStr = randomNum.toString() 11 | 12 | dispNum.textContent = randomStr 13 | } 14 | 15 | var interval = setInterval( showNum , 500); 16 | 17 | 18 | 19 | setTimeout(()=> { 20 | clearInterval(interval); 21 | 22 | dispNum.textContent = "500"; 23 | dispErr.style.display = "block"; 24 | dispErr.textContent = "呀!发现未知服务" 25 | }, 4000); 26 | } -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/js/friend.js: -------------------------------------------------------------------------------- 1 | function getQueryString(name) { 2 | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); 3 | var r = unescape(unescape(window.location.search)).substr(1).match(reg); 4 | if (r != null) return unescape(r[2]); return null; 5 | } 6 | layui.use(['jquery', 'form'], function(layim){ 7 | var $ = layui.jquery,form = layui.form; 8 | $(document).ready(function() { 9 | var username = getQueryString("username"); 10 | var sign = getQueryString("sign"); 11 | var avatar = getQueryString("avatar"); 12 | var email = getQueryString("email"); 13 | var sex = getQueryString("sex"); 14 | if (sex == "1") { 15 | $("#sex").val("男"); 16 | } else { 17 | $("#sex").val("女"); 18 | } 19 | $("#username").val(username); 20 | $("#LAY_demo_upload").attr("src", avatar); 21 | $("#email").val(email); 22 | $("#sign").val(sign); 23 | }); 24 | }); -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/js/setting.js: -------------------------------------------------------------------------------- 1 | layui.use(['layim', 'flow', 'element'], function(){ 2 | var layim = parent.layim,layer = layui.layer,$ = layui.jquery,flow = layui.flow,element = layui.element(); 3 | var socket = parent.socket; 4 | 5 | element.on('tab(setting)', function(){ 6 | console.log($(this).text() + this.getAttribute('lay-id')); 7 | }); 8 | }); -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/json/particles2.json: -------------------------------------------------------------------------------- 1 | { 2 | "particles": { 3 | "number": { 4 | "value": 100 5 | }, 6 | "shape": { 7 | "type": "circle" 8 | }, 9 | "size": { 10 | "value": 10, 11 | "random": true 12 | }, 13 | "line_linked": { 14 | "enable": false 15 | }, 16 | "move": { 17 | "enable": true, 18 | "speed": 2, 19 | "direction": "bottom", 20 | "straight": false 21 | } 22 | }, 23 | "interactivity": { 24 | "detect_on": "canvas", 25 | "events": { 26 | "onhover": { 27 | "enable": false 28 | } 29 | }, 30 | "modes": { 31 | "push": { 32 | "particles_nb": 12 33 | } 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/code.css: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name: layui.code 4 | @Author: 贤心 5 | @Site: http://www.layui.com 6 | 7 | */ 8 | 9 | /* 加载就绪标志 */ 10 | html #layuicss-skincodecss{display:none; position: absolute; width:1989px;} 11 | 12 | /* 默认风格 */ 13 | .layui-code-view{display: block; position: relative; margin: 10px 0; padding: 0; border: 1px solid #ddd; border-left-width: 6px; background-color: #F2F2F2; color: #333; font-family: Courier New; font-size: 12px;} 14 | .layui-code-h3{position: relative; padding: 0 10px; height: 30px; line-height: 30px; border-bottom: 1px solid #ddd; font-size: 12px;} 15 | .layui-code-h3 a{position: absolute; right: 10px; top: 0; color: #999;} 16 | .layui-code-view .layui-code-ol{position: relative; overflow: auto;} 17 | .layui-code-view .layui-code-ol li{position: relative; margin-left: 45px; line-height: 20px; padding: 0 5px; border-left: 1px solid #ddd; list-style-type: decimal-leading-zero; *list-style-type: decimal; background-color: #fff;} 18 | .layui-code-view pre{margin: 0;} 19 | 20 | /* notepadd++风格 */ 21 | .layui-code-notepad{border: 1px solid #0C0C0C; border-left-color: #3F3F3F; background-color: #0C0C0C; color: #C2BE9E} 22 | .layui-code-notepad .layui-code-h3{border-bottom: none;} 23 | .layui-code-notepad .layui-code-ol li{background-color: #3F3F3F; border-left: none;} -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/laydate/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/laydate/icon.png -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/icon-ext.png -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/icon.png -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/loading-0.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/loading-1.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layer/default/loading-2.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/html/find.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 发现 9 | 10 | 11 | 14 | 15 | 16 | 17 |
18 |
此为自定义的【查找】页面,因需求不一,所以官方暂不提供该模版结构与样式,实际使用时,可移至该文件到你的项目中,对页面自行把控。 19 |
文件所在目录(相对于layui.js):/css/modules/layim/html/find.html
20 |
21 | 22 | 23 | 24 | 25 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/1.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/2.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/3.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/4.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/5.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/6.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/skin/logo.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/css/modules/layim/voice/default.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/css/modules/layim/voice/default.wav -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/font/iconfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/font/iconfont.eot -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/font/iconfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/font/iconfont.ttf -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/font/iconfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/font/iconfont.woff -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/0.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/1.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/10.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/10.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/11.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/11.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/12.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/12.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/13.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/13.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/14.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/14.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/15.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/15.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/16.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/16.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/17.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/17.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/18.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/18.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/19.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/19.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/2.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/20.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/20.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/21.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/21.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/22.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/22.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/23.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/23.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/24.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/24.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/25.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/25.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/26.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/26.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/27.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/27.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/28.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/28.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/29.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/29.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/3.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/30.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/30.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/31.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/31.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/32.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/32.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/33.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/33.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/34.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/34.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/35.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/35.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/36.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/36.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/37.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/37.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/38.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/38.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/39.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/39.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/4.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/40.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/40.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/41.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/41.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/42.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/42.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/43.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/43.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/44.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/44.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/45.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/45.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/46.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/46.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/47.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/47.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/48.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/48.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/49.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/49.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/5.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/50.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/50.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/51.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/51.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/52.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/52.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/53.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/53.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/54.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/54.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/55.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/55.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/56.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/56.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/57.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/57.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/58.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/58.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/59.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/59.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/6.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/60.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/60.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/61.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/61.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/62.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/62.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/63.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/63.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/64.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/64.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/65.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/65.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/66.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/66.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/67.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/67.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/68.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/68.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/69.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/69.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/7.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/7.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/70.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/70.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/71.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/71.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/8.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/images/face/9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/layui/images/face/9.gif -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/lay/all-mobile.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name:用于打包移动完整版 4 | @Author:贤心 5 | @License:LGPL 6 | 7 | */ 8 | 9 | layui.define(function(exports){ 10 | exports('layui.mobile', layui.v); 11 | }); 12 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/lay/all.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name:用于打包PC完整版,即包含layui.js和所有模块的完整合并(该文件不会存在于构建后的目录) 4 | @Author:贤心 5 | @License:LGPL 6 | 7 | */ 8 | 9 | layui.define(function(exports){ 10 | var cache = layui.cache; 11 | layui.config({ 12 | dir: cache.dir.replace(/lay\/dest\/$/, '') 13 | }); 14 | exports('layui.all', layui.v); 15 | }); 16 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/lay/modules/code.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name:layui.code 代码修饰器 4 | @Author:贤心 5 | @License:LGPL 6 | 7 | */ 8 | 9 | layui.define('jquery', function(exports){ 10 | "use strict"; 11 | 12 | var $ = layui.jquery; 13 | var about = 'http://www.layui.com/doc/modules/code.html'; //关于信息 14 | 15 | exports('code', function(options){ 16 | var elems = []; 17 | options = options || {}; 18 | options.elem = $(options.elem||'.layui-code'); 19 | options.about = 'about' in options ? options.about : true; 20 | 21 | options.elem.each(function(){ 22 | elems.push(this); 23 | }); 24 | 25 | layui.each(elems.reverse(), function(index, item){ 26 | var othis = $(item), html = othis.html(); 27 | 28 | //转义HTML标签 29 | if(othis.attr('lay-encode') || options.encode){ 30 | html = html.replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&') 31 | .replace(//g, '>').replace(/'/g, ''').replace(/"/g, '"') 32 | } 33 | 34 | othis.html('
  1. ' + html.replace(/[\r\t\n]+/g, '
  2. ') + '
') 35 | 36 | if(!othis.find('>.layui-code-h3')[0]){ 37 | othis.prepend('

'+ (othis.attr('lay-title')||options.title||'code') + (options.about ? 'layui.code' : '') + '

'); 38 | } 39 | 40 | var ol = othis.find('>.layui-code-ol'); 41 | othis.addClass('layui-box layui-code-view'); 42 | 43 | //识别皮肤 44 | if(othis.attr('lay-skin') || options.skin){ 45 | othis.addClass('layui-code-' +(othis.attr('lay-skin') || options.skin)); 46 | } 47 | 48 | //按行数适配左边距 49 | if((ol.find('li').length/100|0) > 0){ 50 | ol.css('margin-left', (ol.find('li').length/100|0) + 'px'); 51 | } 52 | 53 | //设置最大高度 54 | if(othis.attr('lay-height') || options.height){ 55 | ol.css('max-height', othis.attr('lay-height') || options.height); 56 | } 57 | 58 | }); 59 | 60 | }); 61 | }).addcss('modules/code.css', 'skincodecss'); -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/lay/modules/mobile.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name:layui 移动模块入口 | 构建后则为移动模块集合 4 | @Author:贤心 5 | @License:MIT 6 | 7 | */ 8 | 9 | 10 | if(!layui['layui.mobile']){ 11 | layui.config({ 12 | base: layui.cache.dir + 'lay/modules/mobile/' 13 | }).extend({ 14 | 'layer-mobile': 'layer-mobile' 15 | ,'zepto': 'zepto' 16 | ,'upload-mobile': 'upload-mobile' 17 | ,'layim-mobile': 'layim-mobile' 18 | }); 19 | } 20 | 21 | layui.define([ 22 | 'layer-mobile' 23 | ,'zepto' 24 | ,'layim-mobile' 25 | ], function(exports){ 26 | exports('mobile', { 27 | layer: layui['layer-mobile'] //弹层 28 | ,layim: layui['layim-mobile'] //WebIM 29 | }); 30 | }); -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/lay/modules/mobile/layim-mobile-open.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name:layim mobile 开源包 4 | @Author:贤心 5 | @License:MIT 6 | 7 | */ 8 | 9 | layui.define(function(exports){ 10 | exports('layim-mobile', layui.v); 11 | }); -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/layui/lay/modules/util.js: -------------------------------------------------------------------------------- 1 | /** 2 | 3 | @Name:layui.util 工具集 4 | @Author:贤心 5 | @License:LGPL 6 | 7 | */ 8 | 9 | layui.define('jquery', function(exports){ 10 | "use strict"; 11 | 12 | var $ = layui.jquery 13 | 14 | ,util = { 15 | //固定块 16 | fixbar: function(options){ 17 | options = options || {}; 18 | options.bgcolor = options.bgcolor ? ('background-color:' + options.bgcolor) : ''; 19 | 20 | var TOP_BAR = 'layui-fixbar-top', timer, is, icon = [ 21 | options.bar1 === true ? '' : options.bar1 //bar1 - 信息图标 22 | ,options.bar2 === true ? '' : options.bar2 //bar2 - 问号图标 23 | ,'' //置顶 24 | ] 25 | 26 | ,dom = $([''].join('')) 31 | 32 | ,topbar = dom.find('.'+TOP_BAR) 33 | 34 | ,scroll = function(){ 35 | var stop = $(document).scrollTop(); 36 | if(stop >= (options.showHeight || 200)){ 37 | is || (topbar.show(), is = 1); 38 | } else { 39 | is && (topbar.hide(), is = 0); 40 | } 41 | }; 42 | 43 | if($('.layui-fixbar')[0]) return; 44 | typeof options.css === 'object' && (dom.css(options.css)); 45 | $('body').append(dom), scroll(); 46 | 47 | //bar点击事件 48 | dom.find('li').on('click', function(){ 49 | var othis = $(this), type = othis.attr('lay-type'); 50 | if(type === 'top'){ 51 | $('html,body').animate({ 52 | scrollTop : 0 53 | }, 200);; 54 | } 55 | options.click && options.click.call(this, type); 56 | }); 57 | 58 | //Top显示控制 59 | $(document).on('scroll', function(){ 60 | if(timer) clearTimeout(timer); 61 | timer = setTimeout(function(){ 62 | scroll(); 63 | }, 100); 64 | }); 65 | } 66 | }; 67 | 68 | exports('util', util); 69 | }); -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg1.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg1_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg1_small.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg2.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg2_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg2_small.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg3.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg3_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg3_small.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg4.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg4_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg4_small.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg5.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/resources/static/themes/bg5_small.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/modules/zim-server/src/main/resources/static/themes/bg5_small.jpg -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/CacheType.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server 18 | 19 | /** @author 20 | * 梦境迷离 21 | * @version 1.0,2022/8/18 22 | */ 23 | sealed trait CacheType 24 | 25 | object CacheType { 26 | 27 | final case object ZioCache extends CacheType 28 | final case object CatsCache extends CacheType 29 | 30 | } 31 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/ZimServer.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server 18 | 19 | import org.bitlap.zim.infrastructure.InfrastructureConfiguration 20 | import org.bitlap.zim.infrastructure.properties.ZimConfigurationProperties 21 | import org.bitlap.zim.server.module._ 22 | import org.bitlap.zim.server.service.ApiServiceImpl 23 | 24 | import zio._ 25 | 26 | /** main方法 27 | * 28 | * @author 29 | * 梦境迷离 30 | * @version 1.0,2021/12/24 31 | */ 32 | object ZimServer extends zio.ZIOAppDefault { 33 | 34 | override def run: ZIO[Any, Throwable, Unit] = (for { 35 | _ <- Console.printLine(""" 36 | | ____ 37 | | ,--, ,' , `. 38 | | ,----,,--.'| ,-+-,.' _ | 39 | | .' .`|| |, ,-+-. ; , || 40 | | .' .' .'`--'_ ,--.'|' | || 41 | | ,---, ' ./ ,' ,'| | | ,', | |, 42 | | ; | .' / ' | | | | / | |--' 43 | | `---' / ;--,| | : | : | | , 44 | | / / / .`|' : |__ | : | |/ 45 | | ./__; .' | | '.'|| | |`-' 46 | | ; | .' ; : ;| ;/ 47 | | `---' | , / '---'""".stripMargin) 48 | _ <- ZIO.serviceWithZIO[InfrastructureConfiguration](_.initPool()) // init pool 49 | _ <- ZIO.serviceWithZIO[AkkaHttpModule](_.httpServer()) 50 | _ <- ZIO.never 51 | } yield ()).provide( 52 | AkkaModule.live, 53 | AkkaHttpModule.live, 54 | InfrastructureConfiguration.live, 55 | ZimConfigurationProperties.live, 56 | ApiServiceImpl.live, 57 | Scope.default 58 | ) 59 | } 60 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/actor/ScheduleStateful.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.actor 18 | 19 | import org.bitlap.zim.domain.ws.Constants 20 | import org.bitlap.zim.domain.ws.protocol._ 21 | import org.bitlap.zim.infrastructure.util.LogUtil 22 | import org.bitlap.zim.server.service.ws.WsService 23 | 24 | import zio._ 25 | import zio.actors.Actor.Stateful 26 | import zio.actors.Context 27 | 28 | /** zio actor 29 | * 30 | * @author 31 | * 梦境迷离 32 | * @version 1.0,2022/1/11 33 | */ 34 | object ScheduleStateful { 35 | 36 | val stateful: Stateful[Any, Unit, Command] = new Stateful[Any, Unit, Command] { 37 | 38 | override def receive[A](state: Unit, msg: Command[A], context: Context): UIO[(Unit, A)] = { 39 | val taskIO = msg match { 40 | case OnlineUserMessage(descr) => 41 | WsService.getConnections.flatMap { i => 42 | LogUtil.debug( 43 | s"${descr.getOrElse("receive")}|actor:${Constants.SCHEDULE_JOB_ACTOR}| Total online user => $i" 44 | ) 45 | } 46 | case _ => ZIO.unit 47 | } 48 | 49 | // FIXME: remove asInstanceOf 50 | taskIO.foldZIO( 51 | e => LogUtil.error(s"ScheduleStateful $e").as(() -> "".asInstanceOf[A]), 52 | _ => ZIO.succeed(() -> "".asInstanceOf[A]) 53 | ) 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/actor/UserStatusStateful.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.actor 18 | 19 | import org.bitlap.zim.domain.ws.protocol._ 20 | import org.bitlap.zim.infrastructure.util.LogUtil 21 | import org.bitlap.zim.server.service.ws.WsService 22 | 23 | import zio._ 24 | import zio.actors.Actor.Stateful 25 | import zio.actors.Context 26 | 27 | /** zio actor 28 | * 29 | * @author 30 | * 梦境迷离 31 | * @version 1.0,2022/1/11 32 | */ 33 | object UserStatusStateful { 34 | 35 | val stateful: Stateful[Any, Unit, Command] = new Stateful[Any, Unit, Command] { 36 | 37 | override def receive[A](state: Unit, msg: Command[A], context: Context): UIO[(Unit, A)] = { 38 | val taskIO = msg match { 39 | case _ @UserStatusChangeMessage(uId, typ, _) => 40 | WsService.changeOnline(uId, typ) 41 | case _ => ZIO.succeed(false) 42 | } 43 | taskIO.foldZIO( 44 | e => LogUtil.error(s"UserStatusStateful $e").as(() -> "".asInstanceOf[A]), 45 | _ => ZIO.succeed(() -> "".asInstanceOf[A]) 46 | ) 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/module/AkkaModule.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.module 18 | 19 | import akka.actor.typed.ActorSystem 20 | 21 | import zio._ 22 | 23 | /** akka actor configuration 24 | * 25 | * @author 26 | * 梦境迷离 27 | * @since 2021/12/25 28 | * @version 2.0 29 | */ 30 | object AkkaModule { 31 | 32 | private lazy val akkaActorSystem: ActorSystem[Nothing] = ActorSystem.wrap(akka.actor.ActorSystem("akka_actor_system")) 33 | 34 | private lazy val wsAkkaActorSystem: ActorSystem[Nothing] = 35 | ActorSystem.wrap(akka.actor.ActorSystem("ws_akka_actor_system")) 36 | 37 | lazy val live: ZLayer[Any with Any with Scope, Throwable, ActorSystem[Nothing]] = 38 | ZLayer.fromZIO(ZIO.acquireRelease(ZIO.attempt(akkaActorSystem))(a => ZIO.attempt(a.terminate()).ignore)) 39 | 40 | private lazy val actorSystemLive: ZLayer[Any, Throwable, ActorSystem[Nothing]] = 41 | ZLayer.fromZIO(ZIO.attempt(wsAkkaActorSystem)) 42 | 43 | def make: ZIO[Any, Throwable, ActorSystem[Nothing]] = Scope.global.use { 44 | ZIO.service[ActorSystem[Nothing]].provideLayer(actorSystemLive) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/module/ZioActorModule.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.module 18 | 19 | import org.bitlap.zim.domain.ws._ 20 | import org.bitlap.zim.server.actor._ 21 | 22 | import zio._ 23 | import zio.actors._ 24 | 25 | /** zio actor configuration 26 | * 27 | * @author 28 | * 梦境迷离 29 | * @since 2021/12/25 30 | * @version 2.0 31 | */ 32 | object ZioActorModule { 33 | 34 | lazy val scheduleActor: ZIO[Scope, Throwable, ActorRef[protocol.Command]] = 35 | live 36 | .flatMap(_.make(Constants.SCHEDULE_JOB_ACTOR, zio.actors.Supervisor.none, (), ScheduleStateful.stateful)) 37 | 38 | lazy val userStatusActor: ZIO[Scope, Throwable, ActorRef[protocol.Command]] = 39 | live 40 | .flatMap( 41 | _.make(Constants.USER_STATUS_CHANGE_ACTOR, zio.actors.Supervisor.none, (), UserStatusStateful.stateful) 42 | ) 43 | 44 | private lazy val live: ZIO[Scope, Throwable, ActorSystem] = 45 | ZIO.acquireReleaseExit(ActorSystem("zioActorSystem"))((release, _) => release.shutdown.ignore) 46 | } 47 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/package.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim 18 | 19 | /** @author 20 | * 梦境迷离 21 | * @version 1.0,2022/2/11 22 | */ 23 | package object server { 24 | 25 | // default cache 26 | implicit val defaultCache: CacheType = CacheType.CatsCache 27 | 28 | } 29 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/route/ZimActuatorApi.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.route 18 | 19 | import scala.concurrent.ExecutionContext.Implicits.global 20 | import scala.concurrent.Future 21 | 22 | import org.bitlap.zim.ZimBuildInfo 23 | import org.bitlap.zim.api.ActuatorEndpoint 24 | 25 | import akka.http.scaladsl.server.Route 26 | import akka.http.scaladsl.server.directives.DebuggingDirectives 27 | 28 | import sttp.tapir.server.akkahttp.AkkaHttpServerInterpreter 29 | 30 | /** Actuator端点的API http://host:port/api/v1.0/health 31 | * 32 | * @author 33 | * 梦境迷离 34 | * @since 2021/12/25 35 | * @version 2.0 36 | */ 37 | final class ZimActuatorApi { 38 | 39 | // https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/debugging-directives/logRequestResult.html 40 | lazy val route: Route = DebuggingDirectives.logRequestResult("actuator-logger") { 41 | AkkaHttpServerInterpreter().toRoute( 42 | ActuatorEndpoint.healthEndpoint.serverLogic[Future](_ => Future.successful(Right(ZimBuildInfo.toMap))) 43 | ) 44 | } 45 | 46 | } 47 | 48 | object ZimActuatorApi { 49 | def apply(): ZimActuatorApi = new ZimActuatorApi() 50 | } 51 | -------------------------------------------------------------------------------- /modules/zim-server/src/main/scala/org/bitlap/zim/server/route/ZimWsApi.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.route 18 | 19 | import scala.concurrent._ 20 | 21 | import org.bitlap.zim.api._ 22 | import org.bitlap.zim.server.service.ws._ 23 | 24 | import akka._ 25 | import akka.http.scaladsl.model.ws._ 26 | import akka.http.scaladsl.server._ 27 | import akka.stream._ 28 | import akka.stream.scaladsl.Flow 29 | 30 | import sttp.tapir.server.akkahttp._ 31 | 32 | import zio._ 33 | 34 | /** @author 35 | * 梦境迷离 36 | * @since 2022/1/16 37 | * @version 1.0 38 | */ 39 | final class ZimWsApi()(implicit materializer: Materializer) { 40 | 41 | implicit val ec: ExecutionContext = materializer.executionContext 42 | 43 | lazy val route: Route = AkkaHttpServerInterpreter().toRoute(WsEndpoint.wsEndpoint.serverLogic[Future] { uid => 44 | val ret: Either[Unit, Flow[Message, String, NotUsed]] = 45 | try 46 | Unsafe.unsafe { implicit runtime => 47 | Right(Runtime.default.unsafe.run(WsService.openConnection(uid)).getOrThrowFiberFailure()) 48 | } 49 | catch { case _: Exception => Left(()) } 50 | Future.successful(ret) 51 | }) 52 | 53 | } 54 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/resources/application.conf: -------------------------------------------------------------------------------- 1 | infrastructure { 2 | mysql { 3 | # INIT=RUNSCRIPT FROM 'classpath:sql/schema.sql' 4 | url = "jdbc:h2:mem:zim?caseSensitive=false;MODE=MYSQL;TRACE_LEVEL_FILE=2;" 5 | user = "" 6 | password = "" 7 | databaseName = "zim" 8 | connection { 9 | initialPoolSize = 1, 10 | maxPoolSize = 5, 11 | timeoutMillis = 3000, 12 | validationQuery = "select 1", 13 | driver = "org.h2.Driver" 14 | } 15 | } 16 | 17 | javamail { 18 | host = "smtp.qq.com", 19 | username = "568845948@qq.com", 20 | password = "xxx", 21 | sender = "568845948@qq.com" 22 | port = 587, 23 | threadPoolSize = 20, 24 | connectionPoolCoreSize = 10, 25 | debug = true 26 | } 27 | } 28 | 29 | caffeine.disabledLog = false 30 | caffeine.expireAfterWriteSeconds = 300 31 | 32 | application { 33 | 34 | name = "Zim-Application" 35 | server { 36 | webHost = "im.dreamylost.cn" 37 | port = 9000 38 | interface = "localhost" 39 | } 40 | } 41 | 42 | akka { 43 | loggers = ["akka.event.slf4j.Slf4jLogger"] 44 | loglevel = "DEBUG" 45 | logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" 46 | } 47 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/resources/logback-test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d{ISO8601} %-5level [%10thread] %-40logger:%line{15} - %msg%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/CommonTestSupport.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server 18 | 19 | import zio._ 20 | 21 | /** @since 2022/8/27 22 | * @author 23 | * 梦境迷离 24 | */ 25 | trait CommonTestSupport { 26 | 27 | def unsafeRun[T](action: => ZIO[Any, Throwable, T]): T = 28 | Unsafe.unsafe { implicit runtime => 29 | Runtime.default.unsafe.run(action).getOrThrowFiberFailure() 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/module/MysqlConfigSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.module 18 | 19 | import org.bitlap.zim.server.ZIOBaseSuit 20 | 21 | import scalikejdbc._ 22 | import zio.Scope 23 | import zio.test._ 24 | import zio.test.Assertion._ 25 | 26 | object MysqlConfigSpec extends ZIOBaseSuit { 27 | 28 | def spec: Spec[Environment with TestEnvironment with Scope, Any] = suite("MysqlConfigSpec")( 29 | test("test the database connect working state") { 30 | assert(isConnected)(equalTo(true)) 31 | } 32 | ) 33 | 34 | val isConnected: Boolean = NamedDB(Symbol(h2ConfigurationProperties.databaseName)).conn.isValid(0) 35 | 36 | } 37 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/service/MailServiceSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.service 18 | 19 | import org.bitlap.zim.infrastructure.properties._ 20 | import org.bitlap.zim.server.CommonTestSupport 21 | import org.scalatest.flatspec._ 22 | import org.scalatest.matchers.should._ 23 | 24 | import com.typesafe.config.ConfigFactory 25 | 26 | import zio._ 27 | 28 | /** @author 29 | * 梦境迷离 30 | * @since 2022/1/9 31 | * @version 1.0 32 | */ 33 | final class MailServiceSpec extends AnyFlatSpec with Matchers with CommonTestSupport { 34 | 35 | // 本地 36 | lazy val live: ULayer[MailConfigurationProperties] = ZLayer.succeed( 37 | MailConfigurationProperties(ConfigFactory.load("application-test.conf").getConfig("infrastructure.javamail")) 38 | ) 39 | 40 | "sendHtmlMail" should "send async ignore error" in { 41 | val task = 42 | MailServiceImpl 43 | .sendHtmlMail("12222@qq.com", "hello world", """""") 44 | .provide(MailConfigurationProperties.live, MailServiceImpl.live) 45 | val ret = unsafeRun(task) 46 | assert(ret != null) 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/service/TestServiceEnv.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.service 18 | 19 | import org.bitlap.zim.api.repository._ 20 | import org.bitlap.zim.api.service.UserService 21 | import org.bitlap.zim.infrastructure._ 22 | import org.bitlap.zim.infrastructure.repository.RStream 23 | 24 | import zio._ 25 | 26 | /** 测试service的所有layer 27 | * 28 | * @author 29 | * 梦境迷离 30 | * @since 2022/2/11 31 | * @version 1.0 32 | */ 33 | trait TestServiceEnv { 34 | 35 | lazy val infra: InfrastructureConfiguration = new InfrastructureConfiguration() 36 | 37 | val friendGroupLayer: ULayer[FriendGroupRepository[RStream]] = ZLayer.succeed(infra.friendGroupRepository) 38 | 39 | val groupLayer: ULayer[GroupRepository[RStream]] = ZLayer.succeed(infra.groupRepository) 40 | 41 | val receiveLayer: ULayer[ReceiveRepository[RStream]] = ZLayer.succeed(infra.receiveRepository) 42 | 43 | val groupMemberLayer: ULayer[GroupMemberRepository[RStream]] = ZLayer.succeed(infra.groupMemberRepository) 44 | 45 | val friendGroupMemberLayer: ULayer[FriendGroupFriendRepository[RStream]] = 46 | ZLayer.succeed(infra.friendGroupFriendRepository) 47 | 48 | val addMessageLayer: ULayer[AddMessageRepository[RStream]] = ZLayer.succeed(infra.addMessageRepository) 49 | 50 | val userLayer: ZLayer[Any, Throwable, UserRepository[RStream]] = 51 | ZLayer.succeed(infra.userRepository) 52 | 53 | lazy val userServiceLayer: ZLayer[Any, Throwable, UserService[RStream]] = 54 | ZLayer.succeed(infra) >>> UserServiceImpl.live 55 | 56 | } 57 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/util/DateHelper.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.util 18 | 19 | import java.time.{ZonedDateTime, ZoneId} 20 | import java.time.format.DateTimeFormatter 21 | import java.util.Locale 22 | 23 | /** @author 24 | * 梦境迷离 25 | * @since 2022/2/12 26 | * @version 1.0 27 | */ 28 | object DateHelper { 29 | 30 | val fromPattern: DateTimeFormatter = DateTimeFormatter 31 | .ofPattern("yyyy-MM-dd HH:mm:ss") 32 | .withLocale(Locale.CHINA) 33 | .withZone(ZoneId.of("Asia/Shanghai")) 34 | 35 | def getConstantTime: ZonedDateTime = 36 | ZonedDateTime.parse("2022-02-11 08:00:00", fromPattern) 37 | 38 | } 39 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/util/DateUtilSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.util 18 | 19 | import java.time.ZonedDateTime 20 | 21 | import org.bitlap.zim.infrastructure.util.DateUtil 22 | import org.scalatest.flatspec.AnyFlatSpec 23 | import org.scalatest.matchers.should.Matchers 24 | 25 | /** @author 26 | * 梦境迷离 27 | * @since 2022/2/8 28 | * @version 1.0 29 | */ 30 | class DateUtilSpec extends AnyFlatSpec with Matchers { 31 | 32 | "getDateString" should "ok" in { 33 | val dateString = DateUtil.getDateString(ZonedDateTime.parse("2020-02-21 00:00:00", DateHelper.fromPattern)) 34 | dateString shouldBe "2020-02-21" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/util/SchemaSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.util 18 | 19 | import org.bitlap.zim.api.ApiJsonCodec 20 | import org.bitlap.zim.domain.input.UserToken.UserSecurityInfo 21 | import org.scalatest.flatspec.AnyFlatSpec 22 | import org.scalatest.matchers.should.Matchers 23 | 24 | import zio.schema.codec.ProtobufCodec 25 | 26 | /** @author 27 | * 梦境迷离 28 | * @since 2022/3/5 29 | * @version 1.0 30 | */ 31 | class SchemaSpec extends AnyFlatSpec with Matchers with ApiJsonCodec { 32 | 33 | "Schema" should "ok" in { 34 | val userSecurityInfo = 35 | UserSecurityInfo(209, "dreamylost@qq.com", "jZae727K08KaOmKSgOaGzww/XVqGr/PKEgIMkjrcbJI=", "顶顶顶顶") 36 | val chunkByte = ProtobufCodec.protobufCodec[UserSecurityInfo].encode(userSecurityInfo) 37 | val str = ProtobufCodec.protobufCodec[UserSecurityInfo].decode(chunkByte) 38 | val id = str.map(_.id) 39 | id.getOrElse(0) shouldBe userSecurityInfo.id 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/util/SecuritySpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.util 18 | 19 | import org.bitlap.zim.infrastructure.util._ 20 | import org.bitlap.zim.server.CommonTestSupport 21 | import org.scalatest.flatspec._ 22 | import org.scalatest.matchers.should._ 23 | 24 | /** @author 25 | * 梦境迷离 26 | * @since 2022/1/9 27 | * @version 1.0 28 | */ 29 | final class SecuritySpec extends AnyFlatSpec with Matchers with CommonTestSupport { 30 | 31 | "encrypt" should "ok" in { 32 | val encrypt = unsafeRun(SecurityUtil.encrypt("123456")) 33 | println(encrypt.value) 34 | assert(encrypt.value == "jZae727K08KaOmKSgOaGzww/XVqGr/PKEgIMkjrcbJI=") 35 | } 36 | 37 | "getUuid32" should "ok" in { 38 | val encrypt = unsafeRun(SecurityUtil.encrypt("123456")) 39 | val matchPwd = unsafeRun(SecurityUtil.matched("123456", encrypt.value)) 40 | println(matchPwd) 41 | assert(matchPwd) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /modules/zim-server/src/test/scala/org/bitlap/zim/server/util/UuidSpec.scala: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 bitlap 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package org.bitlap.zim.server.util 18 | 19 | import org.bitlap.zim.infrastructure.util.UuidUtil 20 | import org.bitlap.zim.server.CommonTestSupport 21 | import org.scalatest.flatspec.AnyFlatSpec 22 | import org.scalatest.matchers.should.Matchers 23 | 24 | /** @author 25 | * 梦境迷离 26 | * @since 2022/1/9 27 | * @version 1.0 28 | */ 29 | final class UuidSpec extends AnyFlatSpec with Matchers with CommonTestSupport { 30 | 31 | "getUuid64" should "ok" in { 32 | val uuid = unsafeRun(UuidUtil.getUuid64) 33 | println(uuid) 34 | assert(uuid != null) 35 | assert(uuid.length == 64) 36 | } 37 | 38 | "getUuid32" should "ok" in { 39 | val uuid = unsafeRun(UuidUtil.getUuid32) 40 | println(uuid) 41 | assert(uuid != null) 42 | assert(uuid.length == 32) 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /my.cnf: -------------------------------------------------------------------------------- 1 | [mysqld] 2 | skip-name-resolve 3 | character_set_server=utf8 4 | datadir=/usr/local/mysql/data 5 | server-id=1000 6 | [mysql] 7 | default-character-set = utf8 8 | [mysql.server] 9 | default-character-set = utf8 10 | [mysqld_safe] 11 | default-character-set = utf8 12 | [client] 13 | default-character-set = utf8 -------------------------------------------------------------------------------- /native-packager-deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | sbt clean 5 | 6 | sbt universal:packageBin 7 | # FIXME: To copy static file from prefix version. 8 | version=$1 9 | pre_version=$2 10 | 11 | scp ~/Projects/zim/modules/zim-server/target/universal/zim-server-$version.zip root@your_ip:/home/zim/zim-server-$version.zip 12 | # FIXME stop start 13 | ssh root@your_ip "lsof -i:8989 | awk 'NR==2{print $2}' | xargs kill -9;" 14 | ssh root@your_ip "cd /home/zim; unzip -o zim-server-$version.zip; nohup ./zim-server-$version/bin/zim-server -Xms1024M > zim.log 2>&1 &" 15 | # FIXME: Static files are in the service's current directory, and each deployment will use a new directory. 16 | ssh root@your_ip "cp -r /home/zim/zim-server-$pre_version/bin/static/ /home/zim/zim-server-$version/bin/" -------------------------------------------------------------------------------- /openapi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/openapi.jpg -------------------------------------------------------------------------------- /prepare.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ## 将 application.conf.example 拷贝一份为 application.conf 4 | for i in `find . -type f -name 'application.conf.example'` 5 | do 6 | cp -n $i `echo $i | sed -e 's/.example//'` 7 | done 8 | -------------------------------------------------------------------------------- /project/BuildInfoSettings.scala: -------------------------------------------------------------------------------- 1 | import com.typesafe.sbt.GitPlugin.autoImport.git 2 | 3 | import sbt.{Compile, Def, SettingKey} 4 | import sbt.Keys._ 5 | import sbtbuildinfo.BuildInfoKeys.buildInfoKeys 6 | import sbtbuildinfo.BuildInfoPlugin.autoImport._ 7 | 8 | object BuildInfoSettings { 9 | 10 | private val gitCommitString = SettingKey[String]("gitCommit") 11 | 12 | val value: Seq[Def.Setting[_]] = Seq( 13 | buildInfoObject := "ZimBuildInfo", 14 | buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, gitCommitString) ++ Seq[BuildInfoKey]( 15 | Compile / libraryDependencies 16 | ), 17 | buildInfoPackage := s"${organization.value}.zim", 18 | buildInfoOptions ++= Seq(BuildInfoOption.ToJson, BuildInfoOption.BuildTime), 19 | gitCommitString := git.gitHeadCommit.value.getOrElse("Not Set") 20 | ) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /project/Commands.scala: -------------------------------------------------------------------------------- 1 | import sbt.Command 2 | 3 | /** @author 4 | * 梦境迷离 5 | * @since 2022/1/15 6 | * @version 1.0 7 | */ 8 | object Commands { 9 | 10 | val FmtSbtCommand = Command.command("fmt")(state => "scalafmtSbt" :: "scalafmtAll" :: state) 11 | 12 | val FmtSbtCheckCommand = 13 | Command.command("check")(state => "scalafmtSbtCheck" :: "scalafmtCheckAll" :: state) 14 | 15 | val value = Seq( 16 | FmtSbtCommand, 17 | FmtSbtCheckCommand 18 | ) 19 | 20 | } 21 | -------------------------------------------------------------------------------- /project/Information.scala: -------------------------------------------------------------------------------- 1 | import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.headerCreateAll 2 | import sbt.* 3 | import sbt.Keys._ 4 | 5 | /** @author 6 | * 梦境迷离 7 | * @since 2022/1/15 8 | * @version 1.0 9 | */ 10 | object Information { 11 | 12 | val value: Seq[Def.Setting[_]] = Seq( 13 | Compile / compile := (Compile / compile).dependsOn(Compile / headerCreateAll).value, 14 | organization := "org.bitlap", 15 | organizationName := "bitlap", 16 | startYear := Some(2023), 17 | description := "zim is a functional-style, asynchronous and streaming IM based on scala and zio", 18 | homepage := Some(url(s"https://github.com/bitlap/zim")), 19 | licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt")), 20 | developers := List( 21 | Developer( 22 | "jxnu-liguobin", 23 | "梦境迷离", 24 | "dreamylost@outlook.com", 25 | url("https://github.com/jxnu-liguobin") 26 | ) 27 | ), 28 | scmInfo := Some( 29 | ScmInfo( 30 | url("https://github.com/bitlap/zim"), 31 | "scm:git@github.com:bitlap/zim.git" 32 | ) 33 | ) 34 | ) 35 | 36 | } 37 | -------------------------------------------------------------------------------- /project/ProjectSetting.scala: -------------------------------------------------------------------------------- 1 | import org.scalafmt.sbt.ScalafmtPlugin.autoImport.scalafmtOnCompile 2 | 3 | import ProjectSetting.optimizerOptions 4 | import sbt.{CrossVersion, Def, _} 5 | import sbt.Keys._ 6 | 7 | /** @author 8 | * 梦境迷离 9 | * @version 1.0,2022/1/11 10 | */ 11 | object ProjectSetting { 12 | 13 | lazy val scala213 = "2.13.8" 14 | 15 | def extraOptions(optimize: Boolean): List[String] = List("-Wunused:imports") ++ optimizerOptions(optimize) 16 | 17 | def optimizerOptions(optimize: Boolean): List[String] = 18 | if (optimize) List("-opt:l:inline", "-opt-inline-from:zio.internal.**") else Nil 19 | 20 | lazy val stdOptions = List("-deprecation", "-encoding", "UTF-8", "-feature", "-unchecked", "-Xfatal-warnings") 21 | 22 | lazy val std2xOptions = 23 | List( 24 | "-language:higherKinds", 25 | "-language:existentials", 26 | "-explaintypes", 27 | "-Yrangepos", 28 | "-Xlint:_,-missing-interpolator,-type-parameter-shadow", 29 | "-Ywarn-numeric-widen", 30 | "-Ywarn-value-discard" 31 | ) 32 | 33 | val value: Seq[Def.Setting[_]] = Seq( 34 | scalaVersion := scala213, 35 | scalacOptions := (stdOptions ++ extraOptions(!isSnapshot.value)), 36 | testFrameworks := Seq(new TestFramework("zio.test.sbt.ZTestFramework"), TestFrameworks.ScalaTest), 37 | autoAPIMappings := true, 38 | version := (ThisBuild / version).value, 39 | Test / parallelExecution := false, // see https://www.scalatest.org/user_guide/async_testing 40 | Global / cancelable := true, 41 | // OneJar 42 | exportJars := true, 43 | scalafmtOnCompile := true 44 | ) 45 | 46 | val noPublish: Seq[Def.Setting[_]] = Seq( 47 | publish / skip := true 48 | ) 49 | 50 | } 51 | -------------------------------------------------------------------------------- /project/build.properties: -------------------------------------------------------------------------------- 1 | sbt.version = 1.9.9 -------------------------------------------------------------------------------- /project/plugins.sbt: -------------------------------------------------------------------------------- 1 | addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") 2 | addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") 3 | addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") 4 | addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.10") 5 | //addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.1.1") 6 | addSbtPlugin("com.github.sbt" % "sbt-native-packager" % "1.11.0") 7 | addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.9.0") 8 | -------------------------------------------------------------------------------- /version.sbt: -------------------------------------------------------------------------------- 1 | ThisBuild / version := "0.6.4" 2 | -------------------------------------------------------------------------------- /zim-1.drawio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitlap/zim/11ae7c66c777e58c6b07656b195466ef57e38123/zim-1.drawio.png --------------------------------------------------------------------------------