remove rocket chat

This commit is contained in:
Peter Maquiran
2024-08-09 10:50:32 +01:00
parent 45e829bec3
commit 6cbd8d903c
67 changed files with 962 additions and 5618 deletions
-64
View File
@@ -1,64 +0,0 @@
import { AES, SHA1, enc } from "crypto-js";
import { environment } from 'src/environments/environment'
function prefix() {
return environment.version.lastCommitNumber + environment.id+"-";
}
export function GET({key, instance}) {
if(environment.storageProduction) {
try {
const newKey = prefix() + SHA1(key).toString()
const cipherText = localStorage.getItem(newKey)
const bytes = AES.decrypt(cipherText, newKey)
var decryptedData = bytes.toString(enc.Utf8);
const restoredData = JSON.parse(decryptedData)
Object.assign(instance, restoredData);
return restoredData
} catch(error) {
console.log(error)
return {}
}
} else {
const newKey = prefix() + key
const restoredData = JSON.parse(localStorage.getItem(newKey))
Object.assign(instance, restoredData);
return restoredData
}
}
export function SAVE({key, instance, dataToSave}) {
if(environment.storageProduction) {
const newKey = prefix() + SHA1(key).toString()
const stringifyData = JSON.stringify(dataToSave)
const cipherText = AES.encrypt(stringifyData, newKey).toString();
localStorage.setItem(newKey, cipherText)
} else {
const stringifyData = JSON.stringify(dataToSave)
const newKey = prefix() + key
localStorage.setItem(newKey, stringifyData)
}
}
export function DELETE({key, instance}) {
if(environment.storageProduction) {
const newKey = prefix() + SHA1(key).toString()
localStorage.removeItem(newKey)
} else {
const newKey = prefix() + key
localStorage.removeItem(newKey)
}
}
-116
View File
@@ -1,116 +0,0 @@
//import { models } from 'beast-orm'
import { environment } from 'src/environments/environment'
import { models } from 'src/plugin/src'
const { ArrayField, JsonField} = models.indexedDB.fields
export class MessageModel extends models.Model {
channels = ArrayField()
mentions = ArrayField()
msg = models.CharField()
sendAttempt = models.IntegerField()
rid = models.CharField()
t = models.CharField({default:'', blank: true})
ts = JsonField({blank:true})
u = JsonField()
_id = models.CharField({blank:true})
origin = models.CharField({blank:true})
_updatedAt = models.IntegerField()
messageSend = models.BooleanField()
offline = models.BooleanField()
hasFile = models.BooleanField({blank:true})
viewed = ArrayField({blank:true})
received = ArrayField({blank:true})
localReference = models.CharField({blank:true, unique: true})
attachments = ArrayField({blank:true})
file = JsonField({blank:true})
UploadAttachmentsTemp = models.IntegerField()
async getAttachments() {
console.log('this[id]', this['id'])
const _attachments = await attachments.filter({messageId: this['id']}).execute()
return _attachments[0]
}
}
export class attachments extends models.Model {
messageId = models.IntegerField()
attachments = ArrayField({blank:true})
file = JsonField({blank:true})
}
export class DeleteMessageModel extends models.Model {
messageId = models.CharField()
rid = models.CharField()
u = JsonField()
needToReceiveBy = ArrayField()
}
models.register({
databaseName: 'chat-storage'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
type: 'indexedDB',
version: 11,
models: [MessageModel, DeleteMessageModel, attachments]
})
// // acçoes
export class ActionModel extends models.Model{
static $tableName = 'ActionModel11'
ProcessId = models.IntegerField({unique: true})
Description = models.CharField()
Detail = models.CharField()
DateBegin = models.CharField()
DateEnd = models.CharField()
ActionType = models.CharField()
}
export class PublicationFolderModel extends models.Model{
DateBegin = models.CharField()
Description = models.CharField()
Detail = models.CharField()
}
export class PublicationDetailsModel extends models.Model{
DateIndex = models.CharField()
DocumentId = models.IntegerField({unique: true})
ProcessId = models.CharField()
Title = models.CharField()
Message = models.CharField()
DatePublication = models.CharField()
OriginalFileName = models.CharField()
FileBase64 = models.CharField()
FileExtension = models.CharField()
OrganicEntityId = models.IntegerField()
}
export class WebtrixUserModel extends models.Model {
FullName = models.CharField()
Role = models.CharField()
}
models.register({
databaseName: 'webtrix'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
type: 'indexedDB',
version: 1,
models: [WebtrixUserModel]
})
models.register({
databaseName: 'actions'+environment.version.lastCommitNumber + environment.id + Number(environment.storageProduction),
type: 'indexedDB',
version: 14,
models: [PublicationDetailsModel, ActionModel, PublicationFolderModel]
})
window["MessageModel"] = MessageModel