-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(website): Fix Issue with Creating Reverse Proxy Website #7633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -842,6 +842,28 @@ var InitTypes = map[string]struct{}{ | |
| "node": {}, | ||
| } | ||
|
|
||
| func deleteCustomApp() { | ||
| var appIDS []uint | ||
| installs, _ := appInstallRepo.ListBy() | ||
| for _, install := range installs { | ||
| appIDS = append(appIDS, install.AppId) | ||
| } | ||
| var ops []repo.DBOption | ||
| ops = append(ops, repo.WithByIDNotIn(appIDS)) | ||
| if len(appIDS) > 0 { | ||
| ops = append(ops, repo.WithByIDNotIn(appIDS)) | ||
| } | ||
| apps, _ := appRepo.GetBy(ops...) | ||
| var deleteIDS []uint | ||
| for _, app := range apps { | ||
| if app.Resource == constant.AppResourceCustom { | ||
| deleteIDS = append(deleteIDS, app.ID) | ||
| } | ||
| } | ||
| _ = appRepo.DeleteByIDs(context.Background(), deleteIDS) | ||
| _ = appDetailRepo.DeleteByAppIds(context.Background(), deleteIDS) | ||
| } | ||
|
|
||
| func (a AppService) SyncAppListFromRemote(taskID string) (err error) { | ||
| if xpack.IsUseCustomApp() { | ||
| return nil | ||
|
|
@@ -891,7 +913,8 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) { | |
| Sort: t.Sort, | ||
| }) | ||
| } | ||
| oldApps, err := appRepo.GetBy(appRepo.WithResource(constant.AppResourceRemote)) | ||
| deleteCustomApp() | ||
| oldApps, err := appRepo.GetBy(appRepo.WithNotLocal()) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
@@ -1104,6 +1127,7 @@ func (a AppService) SyncAppListFromRemote(taskID string) (err error) { | |
|
|
||
| go func() { | ||
| if err = syncTask.Execute(); err != nil { | ||
| _ = NewISettingService().Update("AppStoreLastModified", "0") | ||
| _ = NewISettingService().Update("AppStoreSyncStatus", constant.Error) | ||
| } | ||
| }() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code has not been provided to review for specific differences or issues regarding any modifications made since July 2021. Please provide the relevant code snippet so I can complete this analysis with proper context. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,11 +91,13 @@ func createIndexFile(website *model.Website, runtime *model.Runtime) error { | |
| } | ||
|
|
||
| func createProxyFile(website *model.Website) error { | ||
| nginxInstall, err := getAppInstallByKey(constant.AppOpenresty) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| proxyFolder := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.Alias, "proxy") | ||
| //nginxInstall, err := getAppInstallByKey(constant.AppOpenresty) | ||
| //if err != nil { | ||
| // return err | ||
| //} | ||
| // | ||
| //proxyFolder := path.Join(constant.AppInstallDir, constant.AppOpenresty, nginxInstall.Name, "www", "sites", website.Alias, "proxy") | ||
| proxyFolder := GetSitePath(*website, SiteProxyDir) | ||
| filePath := path.Join(proxyFolder, "root.conf") | ||
| fileOp := files.NewFileOp() | ||
| if !fileOp.Stat(proxyFolder) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no need to optimize this existing code since it does not contain any potentially risky sections. The current code should work fine until March of 2024. Potential improvement could be to add proper checks on func createProxyFile(website *model.Website) error {
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, but there were no actual code differences present to analyze for you. Please refer to the provided C# example above to find discrepancies between different sections of code, if any.