diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..2959201f4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.js linguist-language=java +*.css linguist-language=java +*.html linguist-language=java diff --git a/api/pom.xml b/api/pom.xml index 1845bc0f4..4faf3598b 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.8.0-SNAPSHOT + 0.8.0 4.0.0 diff --git a/api/src/main/java/com/alibaba/nacos/api/exception/NacosException.java b/api/src/main/java/com/alibaba/nacos/api/exception/NacosException.java index 7806e9635..1bbd56dc9 100644 --- a/api/src/main/java/com/alibaba/nacos/api/exception/NacosException.java +++ b/api/src/main/java/com/alibaba/nacos/api/exception/NacosException.java @@ -34,8 +34,6 @@ public class NacosException extends Exception { public NacosException() { } - ; - public NacosException(int errCode, String errMsg) { this.errCode = errCode; this.errMsg = errMsg; diff --git a/client/pom.xml b/client/pom.xml index 1bf49a0f1..07624377d 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.8.0-SNAPSHOT + 0.8.0 ../pom.xml diff --git a/cmdb/pom.xml b/cmdb/pom.xml index 102cbe3e0..6cc7b3a58 100644 --- a/cmdb/pom.xml +++ b/cmdb/pom.xml @@ -18,7 +18,7 @@ nacos-all com.alibaba.nacos - 0.8.0-SNAPSHOT + 0.8.0 ../pom.xml 4.0.0 diff --git a/common/pom.xml b/common/pom.xml index f90047d07..ade453ee1 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.8.0-SNAPSHOT + 0.8.0 ../pom.xml 4.0.0 diff --git a/common/src/main/java/com/alibaba/nacos/common/util/HttpMethod.java b/common/src/main/java/com/alibaba/nacos/common/util/HttpMethod.java index 9b3778153..acbcc2675 100644 --- a/common/src/main/java/com/alibaba/nacos/common/util/HttpMethod.java +++ b/common/src/main/java/com/alibaba/nacos/common/util/HttpMethod.java @@ -33,7 +33,7 @@ public class HttpMethod { public static final String DELETE = "DELETE"; - public static final String OPTIONS = "PATCH"; + public static final String OPTIONS = "OPTIONS"; public static final String TRACE = "TRACE"; } diff --git a/config/pom.xml b/config/pom.xml index cdc571f91..2eb8fab31 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -17,7 +17,7 @@ com.alibaba.nacos nacos-all - 0.8.0-SNAPSHOT + 0.8.0 4.0.0 diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigKey.java b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigKey.java index 0be7b4ed1..a48b58f6b 100644 --- a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigKey.java +++ b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigKey.java @@ -36,8 +36,6 @@ public class ConfigKey implements Serializable { public ConfigKey() { } - ; - public ConfigKey(String appName, String dataId, String group) { this.appName = appName; this.dataId = dataId; diff --git a/config/src/main/resources/META-INF/nacos-db.sql b/config/src/main/resources/META-INF/nacos-db.sql index 3256dc270..73bef7b76 100644 --- a/config/src/main/resources/META-INF/nacos-db.sql +++ b/config/src/main/resources/META-INF/nacos-db.sql @@ -189,6 +189,6 @@ CREATE TABLE roles ( role varchar(50) NOT NULL ); -INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); +INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE); -INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN'); +INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN'); diff --git a/config/src/main/resources/META-INF/schema.sql b/config/src/main/resources/META-INF/schema.sql index b4240d34f..657b024ef 100644 --- a/config/src/main/resources/META-INF/schema.sql +++ b/config/src/main/resources/META-INF/schema.sql @@ -184,6 +184,6 @@ CREATE TABLE roles ( role varchar(50) NOT NULL ); -INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); +INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE); -INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN'); +INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN'); diff --git a/console/pom.xml b/console/pom.xml index 64e3e13d3..3c29c55c0 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.8.0-SNAPSHOT + 0.8.0 nacos-console diff --git a/console/src/main/java/com/alibaba/nacos/console/filter/JwtAuthenticationTokenFilter.java b/console/src/main/java/com/alibaba/nacos/console/filter/JwtAuthenticationTokenFilter.java index 5981158c8..b760d6d89 100644 --- a/console/src/main/java/com/alibaba/nacos/console/filter/JwtAuthenticationTokenFilter.java +++ b/console/src/main/java/com/alibaba/nacos/console/filter/JwtAuthenticationTokenFilter.java @@ -47,7 +47,7 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter { protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String jwt = resolveToken(request); - if (!StringUtils.isEmpty(jwt.trim()) && SecurityContextHolder.getContext().getAuthentication() == null) { + if (jwt != null && !"".equals(jwt.trim()) && SecurityContextHolder.getContext().getAuthentication() == null) { if (this.tokenProvider.validateToken(jwt)) { /** * get auth info diff --git a/console/src/main/java/com/alibaba/nacos/console/utils/PasswordEncoderUtil.java b/console/src/main/java/com/alibaba/nacos/console/utils/PasswordEncoderUtil.java new file mode 100644 index 000000000..4e1587671 --- /dev/null +++ b/console/src/main/java/com/alibaba/nacos/console/utils/PasswordEncoderUtil.java @@ -0,0 +1,30 @@ +/* + * Copyright 1999-2018 Alibaba Group Holding Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.alibaba.nacos.console.utils; + +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; + +/** + * Password encoder tool + * + * @author nacos + */ +public class PasswordEncoderUtil { + + public static void main(String[] args) { + System.out.println(new BCryptPasswordEncoder().encode("nacos")); + } +} diff --git a/console/src/main/resources/META-INF/nacos-default.properties b/console/src/main/resources/META-INF/nacos-default.properties index c02a8e60f..6fd4d8c20 100644 --- a/console/src/main/resources/META-INF/nacos-default.properties +++ b/console/src/main/resources/META-INF/nacos-default.properties @@ -35,6 +35,8 @@ nacos.cmdb.eventTaskInterval=10 nacos.cmdb.labelTaskInterval=300 nacos.cmdb.loadDataAtStart=false +#management.endpoints.web.exposure.include=* + db.num=2 db.url.0=jdbc:mysql://11.162.196.161:3306/diamond_devtest?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true db.url.1=jdbc:mysql://11.163.152.91:3306/diamond_devtest?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true @@ -45,4 +47,4 @@ db.password=4b9622f3f70c7677835ac5a6719e7caf #management.security=false #security.basic.enabled=false #nacos.security.ignore.urls=/** -nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health,/v1/cs/**,/v1/ns/**,/v1/cmdb/** +nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/** diff --git a/console/src/main/resources/META-INF/schema.sql b/console/src/main/resources/META-INF/schema.sql index 8d22aa35f..d4e69a210 100644 --- a/console/src/main/resources/META-INF/schema.sql +++ b/console/src/main/resources/META-INF/schema.sql @@ -184,6 +184,6 @@ CREATE TABLE roles ( role varchar(50) NOT NULL ); -INSERT INTO users (username, password, enabled) VALUES ('admin', '$2a$10$HxtJtd59imujvbux.i55zOGewhnJiLVXX8D9AETDMV.XtBLDGOXtW', TRUE); +INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE); -INSERT INTO roles (username, role) VALUES ('admin', 'ROLE_ADMIN'); +INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN'); diff --git a/console/src/main/resources/static/console-fe/.eslintrc b/console/src/main/resources/static/console-fe/.eslintrc index 1f3d55b5e..bbb6e5c04 100644 --- a/console/src/main/resources/static/console-fe/.eslintrc +++ b/console/src/main/resources/static/console-fe/.eslintrc @@ -12,6 +12,7 @@ "no-template-curly-in-string": "off", "no-unused-vars": "off", "no-tabs": "off", + "no-param-reassign": "off", "react/no-string-refs": "off", "react/no-unused-state": "off", "no-return-assign": "off", @@ -29,6 +30,6 @@ "generator-star-spacing": "off", "wrap-iife": "off", "arrow-parens": "off", - "indent": "off", + "indent": "off" } } diff --git a/console/src/main/resources/static/console-fe/package.json b/console/src/main/resources/static/console-fe/package.json index 562f86694..0660ef0ef 100644 --- a/console/src/main/resources/static/console-fe/package.json +++ b/console/src/main/resources/static/console-fe/package.json @@ -64,7 +64,7 @@ "webpack-dev-server": "^3.1.13" }, "dependencies": { - "@alifd/next": "^1.11.5", + "@alifd/next": "^1.11.10", "axios": "^0.18.0", "jquery": "^3.3.1", "moment": "^2.23.0", diff --git a/console/src/main/resources/static/console-fe/public/css/bootstrap.css b/console/src/main/resources/static/console-fe/public/css/bootstrap.css index 3bcd6346c..ce3ef2335 100644 --- a/console/src/main/resources/static/console-fe/public/css/bootstrap.css +++ b/console/src/main/resources/static/console-fe/public/css/bootstrap.css @@ -323,7 +323,6 @@ select, textarea { font-family: inherit; font-size: inherit; - line-height: inherit; } a { @@ -7122,4 +7121,4 @@ td.visible-print { td.hidden-print { display: none !important; } -} \ No newline at end of file +} diff --git a/console/src/main/resources/static/console-fe/public/index.html b/console/src/main/resources/static/console-fe/public/index.html index a0046fee9..5d4dbe01b 100644 --- a/console/src/main/resources/static/console-fe/public/index.html +++ b/console/src/main/resources/static/console-fe/public/index.html @@ -20,7 +20,7 @@ Nacos - + diff --git a/console/src/main/resources/static/console-fe/src/components/EditorNameSpace/EditorNameSpace.js b/console/src/main/resources/static/console-fe/src/components/EditorNameSpace/EditorNameSpace.js index 857d181c6..d1a30c75a 100644 --- a/console/src/main/resources/static/console-fe/src/components/EditorNameSpace/EditorNameSpace.js +++ b/console/src/main/resources/static/console-fe/src/components/EditorNameSpace/EditorNameSpace.js @@ -194,7 +194,7 @@ class EditorNameSpace extends React.Component { - {MENU.map(item => ( diff --git a/console/src/main/resources/static/console-fe/src/layouts/Header.js b/console/src/main/resources/static/console-fe/src/layouts/Header.js index 17ac95ec5..371d5f866 100644 --- a/console/src/main/resources/static/console-fe/src/layouts/Header.js +++ b/console/src/main/resources/static/console-fe/src/layouts/Header.js @@ -32,6 +32,8 @@ class Header extends React.Component { static propTypes = { locale: PropTypes.object, + history: PropTypes.object, + location: PropTypes.object, language: PropTypes.string, changeLanguage: PropTypes.func, }; @@ -53,7 +55,6 @@ class Header extends React.Component { const base64Url = token.split('.')[1]; const base64 = base64Url.replace('-', '+').replace('_', '/'); const parsedToken = JSON.parse(window.atob(base64)); - console.log(parsedToken); return parsedToken.sub; } return ''; diff --git a/console/src/main/resources/static/console-fe/src/layouts/MainLayout.js b/console/src/main/resources/static/console-fe/src/layouts/MainLayout.js index c8c191673..4209056b4 100644 --- a/console/src/main/resources/static/console-fe/src/layouts/MainLayout.js +++ b/console/src/main/resources/static/console-fe/src/layouts/MainLayout.js @@ -20,6 +20,8 @@ import $ from 'jquery'; import { setParams } from '../globalLib'; import { connect } from 'react-redux'; +import './index.scss'; + @withRouter @connect(state => ({ ...state.locale })) @ConfigProvider.config @@ -29,6 +31,7 @@ class MainLayout extends React.Component { static propTypes = { navList: PropTypes.array, history: PropTypes.object, + location: PropTypes.object, locale: PropTypes.object, children: PropTypes.any, }; @@ -72,6 +75,11 @@ class MainLayout extends React.Component { iconClass.className = tmpClassName; } + /** + * Click the back button + * TODO: this.props.history.goBack(); ??? + * @param url + */ nacosGoBack(url) { const params = window.location.hash.split('?')[1]; const urlArr = params.split('&') || []; @@ -91,6 +99,9 @@ class MainLayout extends React.Component { } } } + if (localStorage.getItem('namespace')) { + queryParams.push(`namespace=${localStorage.getItem('namespace')}`); + } this.props.history.push(`/${url}?${queryParams.join('&')}`); } @@ -201,7 +212,8 @@ class MainLayout extends React.Component { } nacosLoopNav(data, _index = 0, parent) { - const { locale = {} } = this.props; + const { locale = {}, location = {} } = this.props; + const { pathname } = location; let index = _index; // 遍历导航,只显示2级 const self = this; @@ -238,6 +250,7 @@ class MainLayout extends React.Component { } else { return (
  • {nacosVersion} )} -
    diff --git a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/NewConfig/NewConfig.js b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/NewConfig/NewConfig.js index 56e90e606..66d5bb2cb 100644 --- a/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/NewConfig/NewConfig.js +++ b/console/src/main/resources/static/console-fe/src/pages/ConfigurationManagement/NewConfig/NewConfig.js @@ -433,8 +433,8 @@ class NewConfig extends React.Component { color={'#333'} >

    {locale.newListing}

    -
    - + + {this.state.addonBefore}
    @@ -456,7 +453,7 @@ class NewConfig extends React.Component { } /> - + {locale.annotation} - -
    + + + + + + -
    - - - -
    - - + - + } @@ -560,12 +559,11 @@ class NewConfig extends React.Component { } required - {...formItemLayout} >
    - +