mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-11-29 02:42:51 +00:00
fix bud with add new apikey every install
This commit is contained in:
parent
97729cb3dc
commit
72109c040e
2 changed files with 2 additions and 2 deletions
|
|
@ -141,7 +141,7 @@ config_after_install() {
|
||||||
|
|
||||||
/usr/local/x-ui/x-ui migrate
|
/usr/local/x-ui/x-ui migrate
|
||||||
|
|
||||||
local existing_apiKey=$(/usr/local/x-ui/x-ui setting -show true | grep -oP 'ApiKey: \K.*')
|
local existing_apiKey=$(/usr/local/x-ui/x-ui setting -show true | grep -oP 'apiKey: \K.*')
|
||||||
if [[ -z "$existing_apiKey" ]]; then
|
if [[ -z "$existing_apiKey" ]]; then
|
||||||
local config_apiKey=$(gen_random_string 32)
|
local config_apiKey=$(gen_random_string 32)
|
||||||
/usr/local/x-ui/x-ui setting -apiKey "${config_apiKey}"
|
/usr/local/x-ui/x-ui setting -apiKey "${config_apiKey}"
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ func (a *InboundController) initRouter(g *gin.RouterGroup) {
|
||||||
// getInbounds retrieves the list of inbounds for the logged-in user.
|
// getInbounds retrieves the list of inbounds for the logged-in user.
|
||||||
func (a *InboundController) getInbounds(c *gin.Context) {
|
func (a *InboundController) getInbounds(c *gin.Context) {
|
||||||
user := session.GetLoginUser(c)
|
user := session.GetLoginUser(c)
|
||||||
|
// TODO: need to rethink how to check the user in this place and other likes or leave it as is @MHSanaei
|
||||||
if user == nil {
|
if user == nil {
|
||||||
user = &model.User{}
|
user = &model.User{}
|
||||||
user.Id = 1
|
user.Id = 1
|
||||||
|
|
@ -151,7 +152,6 @@ func (a *InboundController) addInbound(c *gin.Context) {
|
||||||
if user == nil {
|
if user == nil {
|
||||||
inbound.UserId = 1
|
inbound.UserId = 1
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
inbound.UserId = user.Id
|
inbound.UserId = user.Id
|
||||||
}
|
}
|
||||||
if inbound.Listen == "" || inbound.Listen == "0.0.0.0" || inbound.Listen == "::" || inbound.Listen == "::0" {
|
if inbound.Listen == "" || inbound.Listen == "0.0.0.0" || inbound.Listen == "::" || inbound.Listen == "::0" {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue