v0.0.3 twa sys

This commit is contained in:
2025-11-19 07:57:43 +07:00
parent a586da6edc
commit ccf08a3077
24 changed files with 75 additions and 35 deletions

View File

@ -28,10 +28,10 @@ export default class AElementFixed extends window.AObject {
this._snapLoopId = null; // rAF: monitor chạm đáy CHA khi đang snap this._snapLoopId = null; // rAF: monitor chạm đáy CHA khi đang snap
this._needIntroPose = true;// hiệu ứng intro khi snap this._needIntroPose = true;// hiệu ứng intro khi snap
this._snapWidth = null; // lock width (px) khi portal this._snapWidth = null; // lock width (px) khi portal
this._isInit = false;
this._bind();
this._onResize();
this._bind();
this._initObservers();
this._onResize();
} }
update(opts = {}) { update(opts = {}) {
@ -59,17 +59,10 @@ export default class AElementFixed extends window.AObject {
_onResize() { _onResize() {
const desktop = window.innerWidth >= this.o.breakpoint; const desktop = window.innerWidth >= this.o.breakpoint;
if (desktop) { if (!desktop) {
if (!this._isInit) {
this._initObservers();
this._isInit = true;
}
} else {
this._isInit = false;
this._stopInViewLoop(); this._stopInViewLoop();
this._stopSnapMonitor(); this._stopSnapMonitor();
this._unsnapAbsolute(); this._unsnapAbsolute();
this._teardownObservers();
} }
} }
@ -109,6 +102,7 @@ export default class AElementFixed extends window.AObject {
const vpBottom = e.rootBounds ? e.rootBounds.bottom : document.documentElement.clientHeight; const vpBottom = e.rootBounds ? e.rootBounds.bottom : document.documentElement.clientHeight;
const EPS = 0.75; const EPS = 0.75;
if (e.isIntersecting) { if (e.isIntersecting) {
console.log(e.target.style.bottom);
if (e.target.style.bottom === '0px') { if (e.target.style.bottom === '0px') {
this._startInViewLoop(); this._startInViewLoop();
@ -264,7 +258,7 @@ export default class AElementFixed extends window.AObject {
this.el.style.left = ''; this.el.style.left = '';
this.el.style.top = ''; this.el.style.top = '';
this.el.style.bottom = ''; this.el.style.bottom = '';
this.el.style.width = '';
this._restoreToHostBeforeProbe(); this._restoreToHostBeforeProbe();
} }
} }

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class Files public class Files
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class Folder public class Folder
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class Folders_has_StorageArea public class Folders_has_StorageArea
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class LocalServer public class LocalServer
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class MicrosoftAccount public class MicrosoftAccount
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class RefreshToken public class RefreshToken
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class RefreshToken_Log public class RefreshToken_Log
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class ServerAuthorization public class ServerAuthorization
{ {
@ -16,7 +16,7 @@ namespace TWASys_App.DBModels
public int Status { get; set; } public int Status { get; set; }
[NotMapped()] [NotMapped()]
public ICollection<ServerAuthorization_has_Token> Tokens { get; set; } = new List<ServerAuthorization_has_Token>(); public ICollection<Token> Tokens { get; set; } = new List<Token>();
[NotMapped()] [NotMapped()]
public ICollection<RefreshToken> RefreshTokens { get; set; } = new List<RefreshToken>(); public ICollection<RefreshToken> RefreshTokens { get; set; } = new List<RefreshToken>();

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class ServerAuthorization_has_Token public class ServerAuthorization_has_Token
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class StorageArea public class StorageArea
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class StorageArea_has_StorageServer public class StorageArea_has_StorageServer
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class StorageServer public class StorageServer
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class StorageServer_has_LocalServer public class StorageServer_has_LocalServer
{ {

View File

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class StorageServer_has_MicrosoftAccount public class StorageServer_has_MicrosoftAccount
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class StorageServers_ValidationDomain public class StorageServers_ValidationDomain
{ {

View File

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class SyncFile_Log public class SyncFile_Log
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class Token public class Token
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class TypeStorageServer public class TypeStorageServer
{ {

View File

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace TWASys_App.DBModels namespace TWASys_App.DBModels.SotrageModel
{ {
public class ValidationDomain public class ValidationDomain
{ {

View File

@ -6,10 +6,12 @@ using Microsoft.AspNetCore.Razor.Language.Intermediate;
using Microsoft.VisualBasic; using Microsoft.VisualBasic;
using MySqlConnector; using MySqlConnector;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Data.Common; using System.Data.Common;
using System.Xml.Linq; using System.Xml.Linq;
using TWASys_App.Dapper.AExtentions; using TWASys_App.Dapper.AExtentions;
using TWASys_App.DBModels; using TWASys_App.DBModels;
using TWASys_App.DBModels.SotrageModel;
namespace TWASys_App.Models namespace TWASys_App.Models
{ {
@ -24,7 +26,7 @@ namespace TWASys_App.Models
public ICollection<ValidationDomain> ValidationDomains { set; get; } = new List<ValidationDomain>(); public ICollection<ValidationDomain> ValidationDomains { set; get; } = new List<ValidationDomain>();
public int Size { set; get; }; public int Size { set; get; }
public string IpPublic { set; get; } = ""; public string IpPublic { set; get; } = "";
public string IpPrivatev4 { set; get; } = ""; public string IpPrivatev4 { set; get; } = "";
@ -208,6 +210,37 @@ namespace TWASys_App.Models
throw new NotImplementedException(); throw new NotImplementedException();
} }
private void ProccessToken(Dictionary<long, ServerAuthorization> dict, IList<dynamic> tokens, bool isToken =true)
{
foreach (dynamic token in tokens)
{
if (dict.ContainsKey(token.idServerAuthorization))
{
ServerAuthorization tm;
if (dict.TryGetValue(token.idServerAuthorization, out tm))
{
if (isToken)
{
tm.Tokens.Add(new Token { IdToken = token.idToken, AccessToken = token.accessToken, CreateDate = token.createDate, ExpireDate = token.expireDate });
}
else
{
tm.RefreshTokens.Add(new RefreshToken { });
}
}
}
else
{
var tmp = new ServerAuthorization
{
IdServerAuthorization = token.idServerAuthorization
};
tmp.Tokens.Add(new Token { IdToken = token.idToken, AccessToken = token.accessToken });
dict.TryAdd(token.idServerAuthorization, tmp);
}
}
}
public async Task<MessageHeader> UpdateStorageSize() public async Task<MessageHeader> UpdateStorageSize()
{ {
var fMess = new MessageHeader(); var fMess = new MessageHeader();
@ -228,7 +261,9 @@ namespace TWASys_App.Models
SELECT SELECT
sa.idServerAuthorization, sa.idServerAuthorization,
st.idToken, st.idToken,
t.accessToken t.accessToken,
t.createDate,
t.expireDate
FROM sa_need sa FROM sa_need sa
JOIN maxc m ON m.idServerAuthorization = sa.idServerAuthorization JOIN maxc m ON m.idServerAuthorization = sa.idServerAuthorization
JOIN ServerAuthorization_has_Token st JOIN ServerAuthorization_has_Token st
@ -254,8 +289,13 @@ namespace TWASys_App.Models
await con.OpenAsync(); await con.OpenAsync();
using var trans = await con.BeginTransactionAsync(); using var trans = await con.BeginTransactionAsync();
using var multi = await con.QueryMultipleAsync(sql, new { size = Size, id = IdStorageServer }, trans); using var multi = await con.QueryMultipleAsync(sql, new { size = Size, id = IdStorageServer }, trans);
IList<dynamic> tokens = (await multi.ReadAsync()).AsList(); IList<dynamic> tokens = (await multi.ReadAsync()).AsList();
IList<dynamic> rTokens = (await multi.ReadAsync()).AsList(); IList<dynamic> rTokens = (await multi.ReadAsync()).AsList();
Dictionary<long, ServerAuthorization> dict = new Dictionary<long, ServerAuthorization>();
ProccessToken(dict, tokens);
ProccessToken(dict, rTokens, false);
using (var writer = new StreamWriter(Path.GetFullPath("Json/dataServer.json"), false)) using (var writer = new StreamWriter(Path.GetFullPath("Json/dataServer.json"), false))
{ {
await writer.WriteAsync(JsonConvert.SerializeObject(new await writer.WriteAsync(JsonConvert.SerializeObject(new

View File

@ -6,6 +6,7 @@ using MySqlConnector;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.Data.Common; using System.Data.Common;
using TWASys_App.DBModels.SotrageModel;
namespace TWASys_App.Models namespace TWASys_App.Models
{ {

View File

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc;
using MySqlConnector; using MySqlConnector;
using Newtonsoft.Json; using Newtonsoft.Json;
using System.Data.Common; using System.Data.Common;
using TWASys_App.DBModels.SotrageModel;
namespace TWASys_App.Models namespace TWASys_App.Models
{ {

View File

@ -53,4 +53,8 @@
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="DBModels\WebAppModel\" />
</ItemGroup>
</Project> </Project>