🐛 Still reading the abandoned temporary dest config
This commit is contained in:
parent
c41f8b77ce
commit
6cda5751df
@ -4,14 +4,9 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix hash bug">
|
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Provide a way to bypass nexus and serving content to prevent nexus reverse proxy issue">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources.local.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources.local.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/dataSources/bac83d8a-c619-4680-a07f-6674b93fbfea.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/dataSources/bac83d8a-c619-4680-a07f-6674b93fbfea.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/models/attachments.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/attachments.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pkg/internal/services/merger.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/merger.go" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/models/destination.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/models/destination.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/server/api/attachments_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/server/api/attachments_api.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/analyzer.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/analyzer.go" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/uploader.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/uploader.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pkg/internal/services/uploader.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/uploader.go" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/settings.toml" beforeDir="false" afterPath="$PROJECT_DIR$/settings.toml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/settings.toml" beforeDir="false" afterPath="$PROJECT_DIR$/settings.toml" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
@ -48,33 +43,33 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"DefaultGoTemplateProperty": "Go File",
|
"DefaultGoTemplateProperty": "Go File",
|
||||||
"Go Build.Backend.executor": "Debug",
|
"Go Build.Backend.executor": "Debug",
|
||||||
"Go 构建.Backend.executor": "Run",
|
"Go 构建.Backend.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||||
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||||
"RunOnceActivity.go.modules.automatic.dependencies.download": "true",
|
"RunOnceActivity.go.modules.automatic.dependencies.download": "true",
|
||||||
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
|
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
|
||||||
"git-widget-placeholder": "master",
|
"git-widget-placeholder": "master",
|
||||||
"go.import.settings.migrated": "true",
|
"go.import.settings.migrated": "true",
|
||||||
"go.sdk.automatically.set": "true",
|
"go.sdk.automatically.set": "true",
|
||||||
"last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hypernet/Paperclip",
|
"last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hypernet/Paperclip",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"run.code.analysis.last.selected.profile": "pProject Default",
|
"run.code.analysis.last.selected.profile": "pProject Default",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
},
|
},
|
||||||
"keyToStringList": {
|
"keyToStringList": {
|
||||||
"DatabaseDriversLRU": [
|
"DatabaseDriversLRU": [
|
||||||
"postgresql"
|
"postgresql"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RecentsManager">
|
<component name="RecentsManager">
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
<recent name="$PROJECT_DIR$/pkg/internal/gap" />
|
<recent name="$PROJECT_DIR$/pkg/internal/gap" />
|
||||||
@ -125,7 +120,6 @@
|
|||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value=":zap: Fix the RandString method cause the lag" />
|
|
||||||
<MESSAGE value=":bug: Fix mark clean required issue" />
|
<MESSAGE value=":bug: Fix mark clean required issue" />
|
||||||
<MESSAGE value=":sparkles: Support use rid to get file" />
|
<MESSAGE value=":sparkles: Support use rid to get file" />
|
||||||
<MESSAGE value=":boom: Replace attachment id by rid when fetching" />
|
<MESSAGE value=":boom: Replace attachment id by rid when fetching" />
|
||||||
@ -150,7 +144,8 @@
|
|||||||
<MESSAGE value=":wastebasket: Remove account" />
|
<MESSAGE value=":wastebasket: Remove account" />
|
||||||
<MESSAGE value=":bug: Bug fixes" />
|
<MESSAGE value=":bug: Bug fixes" />
|
||||||
<MESSAGE value=":bug: Fix hash bug" />
|
<MESSAGE value=":bug: Fix hash bug" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix hash bug" />
|
<MESSAGE value=":bug: Provide a way to bypass nexus and serving content to prevent nexus reverse proxy issue" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value=":bug: Provide a way to bypass nexus and serving content to prevent nexus reverse proxy issue" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
<settings-migrated>true</settings-migrated>
|
<settings-migrated>true</settings-migrated>
|
||||||
|
@ -116,7 +116,7 @@ func AnalyzeAttachment(file models.Attachment) error {
|
|||||||
|
|
||||||
// Do analyze jobs
|
// Do analyze jobs
|
||||||
if !file.IsAnalyzed || len(file.HashCode) == 0 {
|
if !file.IsAnalyzed || len(file.HashCode) == 0 {
|
||||||
destMap := viper.GetStringMap("destinations.temporary")
|
destMap := viper.GetStringMap("destinations.0")
|
||||||
|
|
||||||
var dest models.LocalDestination
|
var dest models.LocalDestination
|
||||||
rawDest, _ := jsoniter.Marshal(destMap)
|
rawDest, _ := jsoniter.Marshal(destMap)
|
||||||
@ -259,7 +259,7 @@ func AnalyzeAttachment(file models.Attachment) error {
|
|||||||
func HashAttachment(file models.Attachment) (hash string, err error) {
|
func HashAttachment(file models.Attachment) (hash string, err error) {
|
||||||
const chunkSize = 32 * 1024
|
const chunkSize = 32 * 1024
|
||||||
|
|
||||||
destMap := viper.GetStringMapString("destinations.temporary")
|
destMap := viper.GetStringMapString("destinations.0")
|
||||||
destPath := filepath.Join(destMap["path"], file.Uuid)
|
destPath := filepath.Join(destMap["path"], file.Uuid)
|
||||||
|
|
||||||
// Check if the file exists
|
// Check if the file exists
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
func MergeFileChunks(meta models.Attachment, arrange []string) (models.Attachment, error) {
|
func MergeFileChunks(meta models.Attachment, arrange []string) (models.Attachment, error) {
|
||||||
// Fetch destination from config
|
// Fetch destination from config
|
||||||
destMap := viper.GetStringMapString("destinations.temporary")
|
destMap := viper.GetStringMapString("destinations.0")
|
||||||
|
|
||||||
var dest models.LocalDestination
|
var dest models.LocalDestination
|
||||||
dest.Path = destMap["path"]
|
dest.Path = destMap["path"]
|
||||||
|
@ -98,7 +98,7 @@ func RunScheduleDeletionTask() {
|
|||||||
|
|
||||||
func DeleteFile(meta models.Attachment) error {
|
func DeleteFile(meta models.Attachment) error {
|
||||||
if !meta.IsUploaded {
|
if !meta.IsUploaded {
|
||||||
destMap := viper.GetStringMap("destinations.temporary")
|
destMap := viper.GetStringMap("destinations.0")
|
||||||
var dest models.LocalDestination
|
var dest models.LocalDestination
|
||||||
rawDest, _ := jsoniter.Marshal(destMap)
|
rawDest, _ := jsoniter.Marshal(destMap)
|
||||||
_ = jsoniter.Unmarshal(rawDest, &dest)
|
_ = jsoniter.Unmarshal(rawDest, &dest)
|
||||||
@ -113,7 +113,7 @@ func DeleteFile(meta models.Attachment) error {
|
|||||||
|
|
||||||
var destMap map[string]any
|
var destMap map[string]any
|
||||||
if meta.Destination == models.AttachmentDstTemporary {
|
if meta.Destination == models.AttachmentDstTemporary {
|
||||||
destMap = viper.GetStringMap("destinations.temporary")
|
destMap = viper.GetStringMap("destinations.0")
|
||||||
} else {
|
} else {
|
||||||
destMap = viper.GetStringMap("destinations.permanent")
|
destMap = viper.GetStringMap("destinations.permanent")
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func UploadFileToTemporary(ctx *fiber.Ctx, file *multipart.FileHeader, meta models.Attachment) error {
|
func UploadFileToTemporary(ctx *fiber.Ctx, file *multipart.FileHeader, meta models.Attachment) error {
|
||||||
destMap := viper.GetStringMap("destinations.temporary")
|
destMap := viper.GetStringMap(fmt.Sprintf("destinations.%d", meta.Destination))
|
||||||
|
|
||||||
var dest models.BaseDestination
|
var dest models.BaseDestination
|
||||||
rawDest, _ := jsoniter.Marshal(destMap)
|
rawDest, _ := jsoniter.Marshal(destMap)
|
||||||
@ -36,7 +36,7 @@ func UploadFileToTemporary(ctx *fiber.Ctx, file *multipart.FileHeader, meta mode
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UploadChunkToTemporary(ctx *fiber.Ctx, cid string, file *multipart.FileHeader, meta models.Attachment) error {
|
func UploadChunkToTemporary(ctx *fiber.Ctx, cid string, file *multipart.FileHeader, meta models.Attachment) error {
|
||||||
destMap := viper.GetStringMap("destinations.temporary")
|
destMap := viper.GetStringMap("destinations.0")
|
||||||
|
|
||||||
var dest models.BaseDestination
|
var dest models.BaseDestination
|
||||||
rawDest, _ := jsoniter.Marshal(destMap)
|
rawDest, _ := jsoniter.Marshal(destMap)
|
||||||
@ -58,7 +58,7 @@ func UploadChunkToTemporary(ctx *fiber.Ctx, cid string, file *multipart.FileHead
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UploadChunkToTemporaryWithRaw(ctx *fiber.Ctx, cid string, raw []byte, meta models.Attachment) error {
|
func UploadChunkToTemporaryWithRaw(ctx *fiber.Ctx, cid string, raw []byte, meta models.Attachment) error {
|
||||||
destMap := viper.GetStringMap("destinations.temporary")
|
destMap := viper.GetStringMap("destinations.0")
|
||||||
|
|
||||||
var dest models.BaseDestination
|
var dest models.BaseDestination
|
||||||
rawDest, _ := jsoniter.Marshal(destMap)
|
rawDest, _ := jsoniter.Marshal(destMap)
|
||||||
@ -80,7 +80,7 @@ func UploadChunkToTemporaryWithRaw(ctx *fiber.Ctx, cid string, raw []byte, meta
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CheckChunkExistsInTemporary(meta models.Attachment, cid string) bool {
|
func CheckChunkExistsInTemporary(meta models.Attachment, cid string) bool {
|
||||||
destMap := viper.GetStringMap("destinations.temporary")
|
destMap := viper.GetStringMap("destinations.0")
|
||||||
|
|
||||||
var dest models.LocalDestination
|
var dest models.LocalDestination
|
||||||
rawDest, _ := jsoniter.Marshal(destMap)
|
rawDest, _ := jsoniter.Marshal(destMap)
|
||||||
@ -110,7 +110,7 @@ func ReUploadFileToPermanent(meta models.Attachment, dst int) error {
|
|||||||
rawDest, _ := jsoniter.Marshal(destMap)
|
rawDest, _ := jsoniter.Marshal(destMap)
|
||||||
_ = jsoniter.Unmarshal(rawDest, &dest)
|
_ = jsoniter.Unmarshal(rawDest, &dest)
|
||||||
|
|
||||||
prevDestMap := viper.GetStringMap("destinations.temporary")
|
prevDestMap := viper.GetStringMap("destinations.0")
|
||||||
|
|
||||||
// Currently, the temporary destination only supports the local.
|
// Currently, the temporary destination only supports the local.
|
||||||
// So we can do this.
|
// So we can do this.
|
||||||
|
@ -22,7 +22,7 @@ path = "uploads"
|
|||||||
[[destinations]]
|
[[destinations]]
|
||||||
type = "local"
|
type = "local"
|
||||||
path = "uploads/permanent"
|
path = "uploads/permanent"
|
||||||
access_baseurl = "http://localhost:8004"
|
access_baseurl = "http://192.168.50.133:8004"
|
||||||
|
|
||||||
[security]
|
[security]
|
||||||
internal_public_key = "keys/internal_public_key.pem"
|
internal_public_key = "keys/internal_public_key.pem"
|
||||||
|
Loading…
Reference in New Issue
Block a user