diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7d7b9261f41..c4fb6b34d6cd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,7 +11,7 @@ jobs: mysql: image: mysql:5.7 env: - MYSQL_DATABASE: casdoor + MYSQL_DATABASE: user MYSQL_ROOT_PASSWORD: 123456 ports: - 3306:3306 @@ -85,7 +85,7 @@ jobs: mysql: image: mysql:5.7 env: - MYSQL_DATABASE: casdoor + MYSQL_DATABASE: user MYSQL_ROOT_PASSWORD: 123456 ports: - 3306:3306 diff --git a/.gitignore b/.gitignore index 12fbfa19cc29..c9459f93bfd1 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ commentsRouter*.go # ignore build result casdoor server +.DS_Store diff --git a/Dockerfile b/Dockerfile index 2c9d1cd33e61..621ab0669e72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,60 +3,31 @@ WORKDIR /web COPY ./web . RUN yarn install --frozen-lockfile --network-timeout 1000000 && yarn run build - -FROM golang:1.20.12 AS BACK -WORKDIR /go/src/casdoor +FROM golang:1.21 AS BACK +WORKDIR /work COPY . . RUN ./build.sh RUN go test -v -run TestGetVersionInfo ./util/system_test.go ./util/system.go > version_info.txt -FROM alpine:latest AS STANDARD -LABEL MAINTAINER="https://casdoor.org/" -ARG USER=casdoor - -RUN sed -i 's/https/http/' /etc/apk/repositories -RUN apk add --update sudo -RUN apk add curl -RUN apk add ca-certificates && update-ca-certificates - -RUN adduser -D $USER -u 1000 \ - && echo "$USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER \ - && chmod 0440 /etc/sudoers.d/$USER \ - && mkdir logs \ - && chown -R $USER:$USER logs - -USER 1000 -WORKDIR / -COPY --from=BACK --chown=$USER:$USER /go/src/casdoor/server ./server -COPY --from=BACK --chown=$USER:$USER /go/src/casdoor/swagger ./swagger -COPY --from=BACK --chown=$USER:$USER /go/src/casdoor/conf/app.conf ./conf/app.conf -COPY --from=BACK --chown=$USER:$USER /go/src/casdoor/version_info.txt ./go/src/casdoor/version_info.txt -COPY --from=FRONT --chown=$USER:$USER /web/build ./web/build - -ENTRYPOINT ["/server"] - - -FROM debian:latest AS db -RUN apt update \ - && apt install -y \ - mariadb-server \ - mariadb-client \ - && rm -rf /var/lib/apt/lists/* +FROM alpine:3.18 as alpine +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \ + apk update && \ + apk add -U --no-cache ca-certificates tzdata +FROM alpine:3.18 +LABEL MAINTAINER="https://github.com/99nil" +ENV TZ="Asia/Shanghai" -FROM db AS ALLINONE -LABEL MAINTAINER="https://casdoor.org/" +WORKDIR /work -RUN apt update -RUN apt install -y ca-certificates && update-ca-certificates +COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo +COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=BACK /work/server /usr/local/bin/server +COPY --from=BACK /work/conf/app.conf /work/conf/app.conf +COPY --from=BACK /work/swagger /work/swagger +COPY --from=BACK /work/version_info.txt /work/version_info.txt +COPY --from=FRONT /web/build /work/web/build -WORKDIR / -COPY --from=BACK /go/src/casdoor/server ./server -COPY --from=BACK /go/src/casdoor/swagger ./swagger -COPY --from=BACK /go/src/casdoor/docker-entrypoint.sh /docker-entrypoint.sh -COPY --from=BACK /go/src/casdoor/conf/app.conf ./conf/app.conf -COPY --from=BACK /go/src/casdoor/version_info.txt ./go/src/casdoor/version_info.txt -COPY --from=FRONT /web/build ./web/build +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -ENTRYPOINT ["/bin/bash"] -CMD ["/docker-entrypoint.sh"] +CMD ["server"] diff --git a/Makefile b/Makefile index c652e514e0b7..295fef503cc3 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ # Image URL to use all building/pushing image targets -REGISTRY ?= casbin -IMG ?= casdoor +REGISTRY ?= 99nil +IMG ?= user IMG_TAG ?=$(shell git --no-pager log -1 --format="%ad" --date=format:"%Y%m%d")-$(shell git describe --tags --always --dirty --abbrev=6) -NAMESPACE ?= casdoor -APP ?= casdoor +NAMESPACE ?= 99nil +APP ?= user HOST ?= test.com diff --git a/conf/app.conf b/conf/app.conf index 13e8061ef055..2de0e9628a52 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -1,10 +1,10 @@ -appname = casdoor +appname = user httpport = 8000 runmode = dev copyrequestbody = true driverName = mysql dataSourceName = root:123456@tcp(localhost:3306)/ -dbName = casdoor +dbName = user tableNamePrefix = showSql = false redisEndpoint = @@ -15,7 +15,7 @@ socks5Proxy = "127.0.0.1:10808" verificationCodeTimeout = 10 initScore = 0 logPostOnly = true -origin = +origin = user.99nil.com originFrontend = staticBaseUrl = "https://cdn.casbin.org" isDemoMode = false @@ -25,6 +25,6 @@ ldapServerPort = 389 radiusServerPort = 1812 radiusSecret = "secret" quota = {"organization": -1, "user": -1, "application": -1, "provider": -1} -logConfig = {"filename": "logs/casdoor.log", "maxdays":99999, "perm":"0770"} +logConfig = {"filename": "logs/user.log", "maxdays":99999, "perm":"0770"} initDataFile = "./init_data.json" -frontendBaseDir = "../casdoor" \ No newline at end of file +frontendBaseDir = "" \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 458cd7296b9a..89ee23c294cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,10 @@ version: '3.1' services: - casdoor: + user: restart: always build: context: ./ dockerfile: Dockerfile - target: STANDARD entrypoint: /bin/sh -c './server --createDatabase=true' ports: - "8000:8000" diff --git a/main.go b/main.go index c5d7ab8e0b85..8057584a0ebd 100644 --- a/main.go +++ b/main.go @@ -61,7 +61,7 @@ func main() { beego.InsertFilter("*", beego.BeforeRouter, routers.RecordMessage) beego.BConfig.WebConfig.Session.SessionOn = true - beego.BConfig.WebConfig.Session.SessionName = "casdoor_session_id" + beego.BConfig.WebConfig.Session.SessionName = "user_session_id" if conf.GetConfigString("redisEndpoint") == "" { beego.BConfig.WebConfig.Session.SessionProvider = "file" beego.BConfig.WebConfig.Session.SessionProviderConfig = "./tmp" diff --git a/object/init.go b/object/init.go index 3584cb66cc01..984fb37b997d 100644 --- a/object/init.go +++ b/object/init.go @@ -170,9 +170,9 @@ func initBuiltInApplication() { Owner: "admin", Name: "app-built-in", CreatedTime: util.GetCurrentTime(), - DisplayName: "Casdoor", - Logo: fmt.Sprintf("%s/img/casdoor-logo_1185x256.png", conf.GetConfigString("staticBaseUrl")), - HomepageUrl: "https://casdoor.org", + DisplayName: "99nil", + Logo: "https://raw.githubusercontent.com/99nil/material/main/logo/logo2.png", + HomepageUrl: "", Organization: "built-in", Cert: "cert-built-in", EnablePassword: true, diff --git a/routers/static_filter.go b/routers/static_filter.go index a1075f934bfd..1ea679349820 100644 --- a/routers/static_filter.go +++ b/routers/static_filter.go @@ -139,8 +139,8 @@ func StaticFilter(ctx *context.Context) { } dir = strings.ReplaceAll(dir, "\\", "/") ctx.ResponseWriter.WriteHeader(http.StatusNotFound) - errorText := fmt.Sprintf("The Casdoor frontend HTML file: \"index.html\" was not found, it should be placed at: \"%s/web/build/index.html\". For more information, see: https://casdoor.org/docs/basic/server-installation/#frontend-1", dir) - http.ServeContent(ctx.ResponseWriter, ctx.Request, "Casdoor frontend has encountered error...", time.Now(), strings.NewReader(errorText)) + errorText := fmt.Sprintf("The frontend HTML file: \"index.html\" was not found, it should be placed at: \"%s/web/build/index.html\".", dir) + http.ServeContent(ctx.ResponseWriter, ctx.Request, "frontend has encountered error...", time.Now(), strings.NewReader(errorText)) return } diff --git a/swagger/swagger.json b/swagger/swagger.json index c028b23d574f..978b4d9bfe5d 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -5070,7 +5070,7 @@ } } }, - "/apiapi/login/oauth/access_token": { + "/api/login/oauth/access_token": { "post": { "tags": [ "Token API" diff --git a/swagger/swagger.yml b/swagger/swagger.yml index b1a019d35c1f..b3cbb596254a 100644 --- a/swagger/swagger.yml +++ b/swagger/swagger.yml @@ -1,10 +1,8 @@ swagger: "2.0" info: - title: Casdoor RESTful API - description: Swagger Docs of Casdoor Backend API + title: 99nil User RESTful API + description: Swagger Docs of 99nil User API version: 1.376.1 - contact: - email: casbin@googlegroups.com basePath: / schemes: - https @@ -504,7 +502,7 @@ paths: post: tags: - Service API - description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs. + description: This API is not for 99nil User frontend to call, it is for 99nil User SDKs. operationId: ApiController.SendEmail parameters: - in: query @@ -532,7 +530,7 @@ paths: post: tags: - Service API - description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs. + description: This API is not for 99nil User frontend to call, it is for 99nil User SDKs. operationId: ApiController.SendNotification parameters: - in: body @@ -550,7 +548,7 @@ paths: post: tags: - Service API - description: This API is not for Casdoor frontend to call, it is for Casdoor SDKs. + description: This API is not for 99nil User frontend to call, it is for 99nil User SDKs. operationId: ApiController.SendSms parameters: - in: query @@ -2240,7 +2238,7 @@ paths: get: tags: - System API - description: get version info like Casdoor release version and commit ID + description: get version info like 99nil User release version and commit ID operationId: ApiController.GetVersionInfo responses: "200": @@ -3310,7 +3308,7 @@ paths: description: '"The Response object"' schema: $ref: '#/definitions/controllers.Response' - /apiapi/login/oauth/access_token: + /api/login/oauth/access_token: post: tags: - Token API diff --git a/web/public/index.html b/web/public/index.html index 61dfea0b954c..bd5ba19c0500 100644 --- a/web/public/index.html +++ b/web/public/index.html @@ -7,14 +7,14 @@ - + - + - Casdoor + 99nil diff --git a/web/src/App.js b/web/src/App.js index 77560c8df61c..bcb5b5405524 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -19,8 +19,8 @@ import Dashboard from "./basic/Dashboard"; import ShortcutsPage from "./basic/ShortcutsPage"; import * as Setting from "./Setting"; import {StyleProvider, legacyLogicalPropertiesTransformer} from "@ant-design/cssinjs"; -import {AppstoreTwoTone, BarsOutlined, DeploymentUnitOutlined, DollarTwoTone, DownOutlined, GithubOutlined, HomeTwoTone, InfoCircleFilled, LockTwoTone, LogoutOutlined, SafetyCertificateTwoTone, SettingOutlined, SettingTwoTone, ShareAltOutlined, WalletTwoTone} from "@ant-design/icons"; -import {Alert, Avatar, Button, Card, ConfigProvider, Drawer, Dropdown, FloatButton, Layout, Menu, Result, Tooltip} from "antd"; +import {AppstoreTwoTone, BarsOutlined, DollarTwoTone, DownOutlined, HomeTwoTone, LockTwoTone, LogoutOutlined, SafetyCertificateTwoTone, SettingOutlined, SettingTwoTone, WalletTwoTone} from "@ant-design/icons"; +import {Avatar, Button, Card, ConfigProvider, Drawer, Dropdown, FloatButton, Layout, Menu, Result} from "antd"; import {Link, Redirect, Route, Switch, withRouter} from "react-router-dom"; import OrganizationListPage from "./OrganizationListPage"; import OrganizationEditPage from "./OrganizationEditPage"; @@ -206,9 +206,9 @@ class App extends Component { getLogo(themes) { if (themes.includes("dark")) { - return `${Setting.StaticBaseUrl}/img/casdoor-logo_1185x256_dark.png`; + return "https://raw.githubusercontent.com/99nil/material/main/logo/logo.png"; } else { - return `${Setting.StaticBaseUrl}/img/casdoor-logo_1185x256.png`; + return "https://raw.githubusercontent.com/99nil/material/main/logo/logo.png"; } } @@ -380,15 +380,6 @@ class App extends Component { }); }} /> - -
{ - this.setState({ - isAiAssistantOpen: true, - }); - }}> - -
-
{Setting.isAdminUser(this.state.account) && !Setting.isMobile() && - - 🚀 SaaS Hosting 🔥 - - , "#")); + // res.push(Setting.getItem( + // + // 🚀 SaaS Hosting 🔥 + // + // , "#")); } res.push(Setting.getItem({i18next.t("general:User Management")}, "/orgs", , [ @@ -637,9 +628,6 @@ class App extends Component { { this.renderFooter() } - { - this.renderAiAssistant() - } ); } @@ -656,7 +644,7 @@ class App extends Component { { Conf.CustomFooter !== null ? Conf.CustomFooter : ( - Powered by {"Casdoor"} + Powered by 99nil ) } @@ -665,40 +653,6 @@ class App extends Component { ); } - renderAiAssistant() { - return ( - - - - help - AI Assistant - - - - - - - - - - } - placement="right" - width={500} - mask={false} - onClose={() => { - this.setState({ - isAiAssistantOpen: false, - }); - }} - visible={this.state.isAiAssistantOpen} - > -