ISM rewrite

Signed-off-by: arzumify <jliwin98@danwin1210.de>
This commit is contained in:
Tracker-Friendly 2025-01-08 18:31:34 +00:00
parent f26a267421
commit 7422201d98
4 changed files with 42 additions and 46 deletions

6
go.mod
View File

@ -3,8 +3,8 @@ module git.ailur.dev/ailur/fulgens
go 1.23.3 go 1.23.3
require ( require (
git.ailur.dev/ailur/fg-library/v3 v3.5.0 git.ailur.dev/ailur/fg-library/v3 v3.6.2
git.ailur.dev/ailur/fg-nucleus-library v1.1.0 git.ailur.dev/ailur/fg-nucleus-library v1.1.1
git.ailur.dev/ailur/pow v1.0.3 git.ailur.dev/ailur/pow v1.0.3
github.com/CAFxX/httpcompression v0.0.9 github.com/CAFxX/httpcompression v0.0.9
github.com/cespare/xxhash/v2 v2.3.0 github.com/cespare/xxhash/v2 v2.3.0
@ -19,6 +19,8 @@ require (
) )
require ( require (
git.ailur.dev/ailur/datatracker v1.0.0 // indirect
git.ailur.dev/ailur/fg-library/v2 v2.0.1 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect github.com/andybalholm/brotli v1.1.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.8 // indirect github.com/gabriel-vasile/mimetype v1.4.8 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect

30
go.sum
View File

@ -1,17 +1,19 @@
git.ailur.dev/ailur/fg-library/v2 v2.1.2 h1:Gk8ztytJfV2GYhsnfTDRWmvTzJ3Cn19V5p2suFCvu4E= git.ailur.dev/ailur/datatracker v1.0.0 h1:zJ0HppqiGEUkpwPVtKDGdHryUkTjnQvP2y+kFcA1gD0=
git.ailur.dev/ailur/fg-library/v2 v2.1.2/go.mod h1:gBnZQDV70YON6cnuwB+Jawm2EABbf9dGlV0Qw4obtxs= git.ailur.dev/ailur/datatracker v1.0.0/go.mod h1:0WE5ozzsgckCbIrKJRav+7iOhikl3B9XGHuJ8LCnRQE=
git.ailur.dev/ailur/fg-library/v3 v3.2.0 h1:SXVj6iCPQ6sR2ZmCZXhAU51mPgH9ERN7KZbMUB03/p4= git.ailur.dev/ailur/fg-library/v2 v2.0.1 h1:ltPYXf/Om0hnMD8gr1K5bkYrfHqKPSbb0hxa0wtTnZ0=
git.ailur.dev/ailur/fg-library/v3 v3.2.0/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs= git.ailur.dev/ailur/fg-library/v2 v2.0.1/go.mod h1:1jYbWhabGcIwp7CkhHqvRwC8eP+nHv5BrXPe9NX2HE8=
git.ailur.dev/ailur/fg-library/v3 v3.3.0 h1:VRe/shTbIfD00OWaywclb4flduAqRY81lMBXGHmMz5g=
git.ailur.dev/ailur/fg-library/v3 v3.3.0/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs=
git.ailur.dev/ailur/fg-library/v3 v3.4.0 h1:8Et4J6Psh7GBpQiDsQEd/hqftLzq6IMuB2AcCG+rsQA=
git.ailur.dev/ailur/fg-library/v3 v3.4.0/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs=
git.ailur.dev/ailur/fg-library/v3 v3.5.0 h1:BGDlS4nQ2PyZWNU4gH3eckVqhZUFIM/zKIj/HXx8RmA= git.ailur.dev/ailur/fg-library/v3 v3.5.0 h1:BGDlS4nQ2PyZWNU4gH3eckVqhZUFIM/zKIj/HXx8RmA=
git.ailur.dev/ailur/fg-library/v3 v3.5.0/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs= git.ailur.dev/ailur/fg-library/v3 v3.5.0/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs=
git.ailur.dev/ailur/fg-nucleus-library v1.0.5 h1:0YVSHFOeydGR/pfq5AfiKQ5gWuxSnx8u2K8mHvEDDTI= git.ailur.dev/ailur/fg-library/v3 v3.5.1 h1:9QH1myeXhGIlkihzYnH5jdgnD8UUStWC7aVWWq81hUU=
git.ailur.dev/ailur/fg-nucleus-library v1.0.5/go.mod h1:nKYjJ+zJD1YcrEGWlyyA5r6CrzW8DWHVAnL9hkn2tNw= git.ailur.dev/ailur/fg-library/v3 v3.5.1/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs=
git.ailur.dev/ailur/fg-library/v3 v3.5.2 h1:rGvZSvmWPRMDGcM7ORMEAR2bd6QJx8vUKdki1SjRkoE=
git.ailur.dev/ailur/fg-library/v3 v3.5.2/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs=
git.ailur.dev/ailur/fg-library/v3 v3.6.2 h1:PNJKxpvbel2iDeB9+/rpYRyMoim6JjRHOXPYFYky7Ng=
git.ailur.dev/ailur/fg-library/v3 v3.6.2/go.mod h1:ArNsafpqES2JuxQM5aM+bNe0FwHLIsL6pbjpiWvDwGs=
git.ailur.dev/ailur/fg-nucleus-library v1.1.0 h1:D0eWwdlaw4IiOwz96MiRwHIdU/VIwiHUCeO00HkzzsU= git.ailur.dev/ailur/fg-nucleus-library v1.1.0 h1:D0eWwdlaw4IiOwz96MiRwHIdU/VIwiHUCeO00HkzzsU=
git.ailur.dev/ailur/fg-nucleus-library v1.1.0/go.mod h1:CHuOSByCmookwkcpjJBiinHEF27+IA70BhVtnR2cAhA= git.ailur.dev/ailur/fg-nucleus-library v1.1.0/go.mod h1:CHuOSByCmookwkcpjJBiinHEF27+IA70BhVtnR2cAhA=
git.ailur.dev/ailur/fg-nucleus-library v1.1.1 h1:IRpAQqgikeT2FyhVbhe16GyIxuTsf1Xq8oLqeUplgHk=
git.ailur.dev/ailur/fg-nucleus-library v1.1.1/go.mod h1:stxiTyMv3Fa7GzpyLbBUh3ahlb7110p0NnCl8ZTjwBs=
git.ailur.dev/ailur/pow v1.0.3 h1:LjLSol4ax+M+SoajVjbBoDjfmjH6pKu3fDka7bl2KGY= git.ailur.dev/ailur/pow v1.0.3 h1:LjLSol4ax+M+SoajVjbBoDjfmjH6pKu3fDka7bl2KGY=
git.ailur.dev/ailur/pow v1.0.3/go.mod h1:ClAmIdHQ/N9wTq5S4YWhQ5d9CPUBcEjVuOkT07zBdJ4= git.ailur.dev/ailur/pow v1.0.3/go.mod h1:ClAmIdHQ/N9wTq5S4YWhQ5d9CPUBcEjVuOkT07zBdJ4=
github.com/CAFxX/httpcompression v0.0.9 h1:0ue2X8dOLEpxTm8tt+OdHcgA+gbDge0OqFQWGKSqgrg= github.com/CAFxX/httpcompression v0.0.9 h1:0ue2X8dOLEpxTm8tt+OdHcgA+gbDge0OqFQWGKSqgrg=
@ -25,8 +27,6 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gabriel-vasile/mimetype v1.4.7 h1:SKFKl7kD0RiPdbht0s7hFtjl489WcQ1VyPW8ZzUMYCA=
github.com/gabriel-vasile/mimetype v1.4.7/go.mod h1:GDlAgAyIRT27BhFl53XNAFtfjzOkLaF35JdEG0P7LtU=
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM= github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
github.com/go-chi/chi/v5 v5.2.0 h1:Aj1EtB0qR2Rdo2dG4O94RIU35w2lvQSj6BRA4+qwFL0= github.com/go-chi/chi/v5 v5.2.0 h1:Aj1EtB0qR2Rdo2dG4O94RIU35w2lvQSj6BRA4+qwFL0=
@ -83,16 +83,10 @@ github.com/valyala/gozstd v1.20.1 h1:xPnnnvjmaDDitMFfDxmQ4vpx0+3CdTg2o3lALvXTU/g
github.com/valyala/gozstd v1.20.1/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ= github.com/valyala/gozstd v1.20.1/go.mod h1:y5Ew47GLlP37EkTB+B4s7r6A5rdaeB7ftbl9zoYiIPQ=
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU= github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E= github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=

View File

@ -70,7 +70,7 @@ func checkScopes(scopes []string) (bool, string, error) {
return clientKeyShare, string(scopeString), nil return clientKeyShare, string(scopeString), nil
} }
func logFunc(message string, messageType library.MessageCode, information library.ServiceInitializationInformation) { func logFunc(message string, messageType library.MessageCode, information *library.ServiceInitializationInformation) {
// Log the message to the logger service // Log the message to the logger service
information.SendISMessage(loggerService, messageType, message) information.SendISMessage(loggerService, messageType, message)
} }
@ -108,7 +108,7 @@ func sha256Base64(s string) string {
return encoded return encoded
} }
func renderTemplate(statusCode int, w http.ResponseWriter, data map[string]interface{}, templatePath string, information library.ServiceInitializationInformation) { func renderTemplate(statusCode int, w http.ResponseWriter, data map[string]interface{}, templatePath string, information *library.ServiceInitializationInformation) {
var err error var err error
var requestedTemplate *template.Template var requestedTemplate *template.Template
// Output ls of the resource directory // Output ls of the resource directory
@ -133,7 +133,7 @@ func renderTemplate(statusCode int, w http.ResponseWriter, data map[string]inter
} }
} }
func renderString(statusCode int, w http.ResponseWriter, data string, information library.ServiceInitializationInformation) { func renderString(statusCode int, w http.ResponseWriter, data string, information *library.ServiceInitializationInformation) {
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
w.WriteHeader(statusCode) w.WriteHeader(statusCode)
_, err := w.Write([]byte(data)) _, err := w.Write([]byte(data))
@ -142,7 +142,7 @@ func renderString(statusCode int, w http.ResponseWriter, data string, informatio
} }
} }
func renderJSON(statusCode int, w http.ResponseWriter, data map[string]interface{}, information library.ServiceInitializationInformation) { func renderJSON(statusCode int, w http.ResponseWriter, data map[string]interface{}, information *library.ServiceInitializationInformation) {
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
w.WriteHeader(statusCode) w.WriteHeader(statusCode)
err := json.NewEncoder(w).Encode(data) err := json.NewEncoder(w).Encode(data)
@ -188,7 +188,7 @@ func verifyJwt(token string, publicKey ed25519.PublicKey, mem *sql.DB) ([]byte,
return userId, claims, true return userId, claims, true
} }
func Main(information library.ServiceInitializationInformation) { func Main(information *library.ServiceInitializationInformation) {
var conn library.Database var conn library.Database
var mem *sql.DB var mem *sql.DB
var publicKey ed25519.PublicKey var publicKey ed25519.PublicKey
@ -1599,13 +1599,13 @@ func Main(information library.ServiceInitializationInformation) {
case 0: case 0:
// A service would like to have the hostname // A service would like to have the hostname
// Send it to them // Send it to them
message.Respond(library.Success, hostName) message.Respond(library.Success, hostName, information)
case 1: case 1:
// A service would like to register a new OAuth entry // A service would like to register a new OAuth entry
// Validate the scopes // Validate the scopes
clientKeyShare, scopes, err := checkScopes(message.Message.(authLibrary.OAuthInformation).Scopes) clientKeyShare, scopes, err := checkScopes(message.Message.(authLibrary.OAuthInformation).Scopes)
if err != nil { if err != nil {
message.Respond(library.BadRequest, err) message.Respond(library.BadRequest, err, information)
return return
} }
@ -1621,7 +1621,7 @@ func Main(information library.ServiceInitializationInformation) {
} }
if err != nil { if err != nil {
message.Respond(library.InternalError, err) message.Respond(library.InternalError, err, information)
logFunc(err.Error(), 2, information) logFunc(err.Error(), 2, information)
return return
} }
@ -1629,7 +1629,7 @@ func Main(information library.ServiceInitializationInformation) {
message.Respond(library.Success, authLibrary.OAuthResponse{ message.Respond(library.Success, authLibrary.OAuthResponse{
AppID: appId, AppID: appId,
SecretKey: secret, SecretKey: secret,
}) }, information)
return return
} }
@ -1638,7 +1638,7 @@ func Main(information library.ServiceInitializationInformation) {
// It must be able to be sent via JSON, so we can't have pure-binary data // It must be able to be sent via JSON, so we can't have pure-binary data
secret, err = randomChars(512) secret, err = randomChars(512)
if err != nil { if err != nil {
message.Respond(library.InternalError, err) message.Respond(library.InternalError, err, information)
logFunc(err.Error(), 2, information) logFunc(err.Error(), 2, information)
return return
} }
@ -1650,7 +1650,7 @@ func Main(information library.ServiceInitializationInformation) {
_, err = conn.DB.Exec("INSERT INTO oauth (appId, secret, creator, name, redirectUri, scopes) VALUES ($1, $2, $3, $4, $5, $6)", message.ServiceID.String(), secret, ServiceInformation.ServiceID[:], message.Message.(authLibrary.OAuthInformation).Name, message.Message.(authLibrary.OAuthInformation).RedirectUri, scopes) _, err = conn.DB.Exec("INSERT INTO oauth (appId, secret, creator, name, redirectUri, scopes) VALUES ($1, $2, $3, $4, $5, $6)", message.ServiceID.String(), secret, ServiceInformation.ServiceID[:], message.Message.(authLibrary.OAuthInformation).Name, message.Message.(authLibrary.OAuthInformation).RedirectUri, scopes)
} }
if err != nil { if err != nil {
message.Respond(library.InternalError, err) message.Respond(library.InternalError, err, information)
logFunc(err.Error(), 2, information) logFunc(err.Error(), 2, information)
return return
} }
@ -1659,11 +1659,11 @@ func Main(information library.ServiceInitializationInformation) {
message.Respond(library.Success, authLibrary.OAuthResponse{ message.Respond(library.Success, authLibrary.OAuthResponse{
AppID: appId, AppID: appId,
SecretKey: secret, SecretKey: secret,
}) }, information)
case 2: case 2:
// A service would like to have the public key // A service would like to have the public key
// Send it to them // Send it to them
message.Respond(library.Success, publicKey) message.Respond(library.Success, publicKey, information)
} }
} }
}() }()

View File

@ -31,12 +31,12 @@ var (
loggerService = uuid.MustParse("00000000-0000-0000-0000-000000000002") loggerService = uuid.MustParse("00000000-0000-0000-0000-000000000002")
) )
func logFunc(message string, messageType library.MessageCode, information library.ServiceInitializationInformation) { func logFunc(message string, messageType library.MessageCode, information *library.ServiceInitializationInformation) {
// Log the message to the logger service // Log the message to the logger service
information.SendISMessage(loggerService, messageType, message) information.SendISMessage(loggerService, messageType, message)
} }
func respondError(message library.InterServiceMessage, err error, information library.ServiceInitializationInformation, myFault bool) { func respondError(message library.InterServiceMessage, err error, information *library.ServiceInitializationInformation, myFault bool) {
// Respond with an error message // Respond with an error message
var errCode = library.BadRequest var errCode = library.BadRequest
if myFault { if myFault {
@ -45,7 +45,7 @@ func respondError(message library.InterServiceMessage, err error, information li
errCode = library.InternalError errCode = library.InternalError
} }
message.Respond(errCode, err) message.Respond(errCode, err, information)
} }
func checkUserExists(userID uuid.UUID) bool { func checkUserExists(userID uuid.UUID) bool {
@ -64,7 +64,7 @@ func checkUserExists(userID uuid.UUID) bool {
} }
// addQuota can be used with a negative quota to remove quota from a user // addQuota can be used with a negative quota to remove quota from a user
func addQuota(information library.ServiceInitializationInformation, message library.InterServiceMessage) { func addQuota(information *library.ServiceInitializationInformation, message library.InterServiceMessage) {
// Add more quota to a user // Add more quota to a user
userID := message.Message.(nucleusLibrary.Quota).User userID := message.Message.(nucleusLibrary.Quota).User
if checkUserExists(userID) { if checkUserExists(userID) {
@ -80,11 +80,11 @@ func addQuota(information library.ServiceInitializationInformation, message libr
} }
// Success // Success
message.Respond(library.Success, nil) message.Respond(library.Success, nil, information)
} }
// And so does addReserved // And so does addReserved
func addReserved(information library.ServiceInitializationInformation, message library.InterServiceMessage) { func addReserved(information *library.ServiceInitializationInformation, message library.InterServiceMessage) {
// Add more reserved space to a user // Add more reserved space to a user
userID := message.Message.(nucleusLibrary.Quota).User userID := message.Message.(nucleusLibrary.Quota).User
if checkUserExists(userID) { if checkUserExists(userID) {
@ -118,7 +118,7 @@ func addReserved(information library.ServiceInitializationInformation, message l
} }
// Success // Success
message.Respond(library.Success, nil) message.Respond(library.Success, nil, information)
} }
func getQuota(userID uuid.UUID) (int64, error) { func getQuota(userID uuid.UUID) (int64, error) {
@ -131,7 +131,7 @@ func getQuota(userID uuid.UUID) (int64, error) {
return quota, nil return quota, nil
} }
func getUsed(userID uuid.UUID, information library.ServiceInitializationInformation) (int64, error) { func getUsed(userID uuid.UUID, information *library.ServiceInitializationInformation) (int64, error) {
// Get the used space for a user by first getting the reserved space from file storage // Get the used space for a user by first getting the reserved space from file storage
_, err := os.Stat(filepath.Join(information.Configuration["path"].(string), userID.String())) _, err := os.Stat(filepath.Join(information.Configuration["path"].(string), userID.String()))
if os.IsNotExist(err) { if os.IsNotExist(err) {
@ -166,7 +166,7 @@ func getUsed(userID uuid.UUID, information library.ServiceInitializationInformat
return used + reserved, nil return used + reserved, nil
} }
func modifyFile(information library.ServiceInitializationInformation, message library.InterServiceMessage) { func modifyFile(information *library.ServiceInitializationInformation, message library.InterServiceMessage) {
// Check if the file already exists // Check if the file already exists
path := filepath.Join(information.Configuration["path"].(string), message.Message.(nucleusLibrary.File).User.String(), message.Message.(nucleusLibrary.File).Name) path := filepath.Join(information.Configuration["path"].(string), message.Message.(nucleusLibrary.File).User.String(), message.Message.(nucleusLibrary.File).Name)
@ -225,7 +225,7 @@ func modifyFile(information library.ServiceInitializationInformation, message li
} }
} }
func getFile(information library.ServiceInitializationInformation, message library.InterServiceMessage) { func getFile(information *library.ServiceInitializationInformation, message library.InterServiceMessage) {
// Check if the file exists // Check if the file exists
path := filepath.Join(information.Configuration["path"].(string), message.Message.(nucleusLibrary.File).User.String(), message.Message.(nucleusLibrary.File).Name) path := filepath.Join(information.Configuration["path"].(string), message.Message.(nucleusLibrary.File).User.String(), message.Message.(nucleusLibrary.File).Name)
@ -252,7 +252,7 @@ func getFile(information library.ServiceInitializationInformation, message libra
} }
} }
func deleteFile(information library.ServiceInitializationInformation, message library.InterServiceMessage) { func deleteFile(information *library.ServiceInitializationInformation, message library.InterServiceMessage) {
// Check if the file exists // Check if the file exists
path := filepath.Join(information.Configuration["path"].(string), message.Message.(nucleusLibrary.File).User.String(), message.Message.(nucleusLibrary.File).Name) path := filepath.Join(information.Configuration["path"].(string), message.Message.(nucleusLibrary.File).User.String(), message.Message.(nucleusLibrary.File).Name)
@ -279,7 +279,7 @@ func deleteFile(information library.ServiceInitializationInformation, message li
} }
// processInterServiceMessages listens for incoming messages and processes them // processInterServiceMessages listens for incoming messages and processes them
func processInterServiceMessages(information library.ServiceInitializationInformation) { func processInterServiceMessages(information *library.ServiceInitializationInformation) {
// Listen for incoming messages // Listen for incoming messages
for { for {
message := information.AcceptMessage() message := information.AcceptMessage()
@ -305,7 +305,7 @@ func processInterServiceMessages(information library.ServiceInitializationInform
} }
} }
func Main(information library.ServiceInitializationInformation) { func Main(information *library.ServiceInitializationInformation) {
// Start up the ISM processor // Start up the ISM processor
information.StartISProcessor() information.StartISProcessor()