#1 Re: mORMot 2 » How to record user behavior logs? » 2024-04-02 07:00:00

Thank you!  Of course, if there are events, use events, if there are interfaces, use interfaces, and callback functions are also acceptable.

#2 mORMot 2 » How to record user behavior logs? » 2024-03-28 00:40:30

htits2008
Replies: 2

In order to improve system security and project reliability, a user audit function is added to record user behavior logs. One method is to use TSynLog, another method is to intercept method events from the interface, and finally the framework's time machine.
I hope everyone can help improve the plan and provide key suggestions.

#3 Re: mORMot 2 » linkto the server behind NGINX » 2024-02-21 01:14:13

thanks
I have a front-end application for Vue3, which uses methods for static files and interfaces for data. Two servers are publicly available online through a TRestHttpServer. Using a browser, this application works very well. In order to process a large amount of data, I developed a Lazarus client and implemented this feature through an interface. The problem is that if the server is placed behind NGINX using the HTTPS protocol, my client cannot connect to the  server. What should I do?

#4 mORMot 2 » linkto the server behind NGINX » 2024-02-05 01:23:06

htits2008
Replies: 3

Behind NGINX in the HTTPS protocol, there is our TRestHttpServer in the HTTP protocol. How can our TRestHttpClient connect to this server? What protocol does the client use?

#5 Re: mORMot 2 » Difference in URL parsing between mORMot1 and 2 » 2023-11-08 01:05:51

en,I have same trouble。and it take me afew day try to read forum and change my code。

      //Server.RootRedirectToUri('/static/web/'); //old code ,
      Server.RootRedirectToUri('/static/web');
      server.Route.Get('/static/web','/static/web/index.html',urmGet);
      server.Route.get('/static/assets/*','/static/web/assets/*',urmGet); 

#6 Re: mORMot 2 » How to compile to aarch64 Linux ? » 2023-06-05 07:46:00

Thanks help!!!
Now , I have  install a IDE of Lazarus in aarch64 Linux.

#7 Re: mORMot 2 » How to compile to aarch64 Linux ? » 2023-06-01 00:34:40

I try some sample in ex.  And the httpServerRaw is passed . It can runing in aarch64 linux os. Other servers are say "error while linking".

#8 mORMot 2 » How to compile to aarch64 Linux ? » 2023-06-01 00:18:43

htits2008
Replies: 4

In the new stable version, I found that there are static files with the aarch64 Linux directory. Does this support cross compiling to this situation in the new version?

I attempted to compile under CodeTyphon under Win64 and encountered an error while linking. Master, can you tell me the relevant solutions?
follow the res file

stripped

#9 Re: mORMot 2 » two DB service have same method,how to » 2023-03-31 08:02:46

ServiceRunningContext^.Factory.ORM; can do some CRUD

#10 Re: mORMot 2 » two DB service have same method,how to » 2023-03-31 07:34:04

When I called an interface service in a long running thread on the server, an error occurred. Some objects are not initialized

#11 Re: mORMot 2 » two DB service have same method,how to » 2023-03-31 02:54:55

I define a function named fDB; And It done.

function FDB: TRestServer;
begin
 fDB:=ServiceRunningContext^.Request.Server;
end;   

#12 mORMot 2 » two DB service have same method,how to » 2023-03-31 00:44:27

htits2008
Replies: 4

使用接口建立服务,我设计了一个TInterfacedObjectWithCustomCreate为基类的ImplementationClass。现在,我有两个不同root的DB,aDB,bDB.分别注册了这个ImplementationClass。在ImplementationClass的方法里,我怎么分别这是运行在aDB或者是bDB?或者说,我在方法的运行期间,怎么样获取它注册的工厂类和TRESTSERVERDB


Using an interface to create a service, I designed an ImplementationClass with TInterfacedObjectWithCustomCreate as the base class. Now, I have two different root DBs, aDB and bDB. Each has registered this ImplementationClass. In the ImplementationClass method, how can I distinguish whether this is running on aDB or bDB? In other words, how do I obtain the registered factory class and TRESTSERVERDB of a method during its operation

#13 mORMot 1 » How to prevent intermediaries from repeatedly obtaining server data? » 2022-10-28 07:55:25

htits2008
Replies: 1

Today I found a problem. In the JS client, after logging in to the server, execute the remote service to get the data. When we use F12 to debug the browsing page, the URL of the last data retrieval will be displayed in the network tag. If I copy this URL, I can open it in other browsers or computers and get data. Is this a disguised way to skip security verification? After I log out, the above URL will no longer be valid. I wonder if there are properties on the server side that can be used for time comparison between two ends? Or  The session_signature can only be used once on the server side? My usage environment is window, M2

http://127.0.0.1:19217/orp/orp_FTS.whereQuery?aTypeTable=orp_rs_dzwj&aWhere=%20where%20NianDu%3D%221989%22&aPage=1&aPageLine=30&session_signature=000f52f8001d8f15d8a3c4db

#14 Re: mORMot 1 » session_signature is not invalidated after logout? is this default? » 2022-09-28 08:58:59

I down the new release mORMot 2.0.4099 . and it is ok! thanks !

#16 Re: mORMot 1 » session_signature is not invalidated after logout? is this default? » 2022-09-28 07:51:32

I have same sample. I think that javascript client can't login out. and It shall down by time out only.
<code>
20220928 14503721 call      mormot.rest.sqlite3.TRestServerDB(0a049570) Auth UserName=xxx&Session=733137&session_signature=000b2fd10082dc93c261c1d9
20220928 14503721 debug     mormot.rest.sqlite3.TRestServerDB(0a049570) TRestServerRoutingRest.Error: {  "errorCode":400,  "errorText":"Bad Request"  }
</code>

#18 mORMot 1 » How to add a scheduled service method to the rest server? » 2022-07-27 07:46:04

htits2008
Replies: 1

Guys, I want to add a scheduled service method to the rest server. This method mainly completes the functions of statistics, backup, synchronization, etc. These functions need to call the interface methods on the server. I hope to get some advice.

#19 Re: mORMot 1 » How to return unified error reporting » 2022-07-19 08:46:51

I find the way . It can run.

aFileStream:rawUtf8;
FFileStream:= Base64ToBin(aFileStream);   

#20 Re: mORMot 1 » How to return unified error reporting » 2022-07-15 06:58:16

I found base-64 encoded strings in server's log.
20220715 06444743 call      mormot.rest.sqlite3.TRestServerDB(01742b20) ITypeAction.upLoadFile{"aTypeCode":"pdf","aTypeID":0,"aFilename":"pdf0.pdf","aFileStream":"JVBERi0xLjcNCiWhs8XXDQo3IDAgb2JqDQo8PC9UeXB ............
20220715 06444743 debug     mormot.rest.sqlite3.TRestServerDB(01742b20) TRestServerRoutingRest.Error: {  "errorCode":406,  "errorText":"ITypeAction.upLoadFile failed parsing aFileStream: RawByteString from input JSON"  }
20220715 06444743 srvr      xxx  POST orp/TypeAction.upLoadFile Interface=406 out=120 B in 4.29ms

but it can run to my code in upLoadFile function.

#21 Re: mORMot 1 » How to return unified error reporting » 2022-07-15 03:14:30

I have same error . I have interface service it work ok when use V1.18. and I turn to V2 ,It can't work . Something is  different?

 function upLoadFile(aTypeCode: rawUtf8; aTypeID: Integer;
      aFilename: rawUtf8; aFileStream: RawByteString; fileDate: TDateTime;
      aLoginID: Integer): Integer; 

AJAX:

			reader.readAsDataURL(file)
			reader.onload = (fd) => {    
                let fdd = fd.target.result.substring(fd.target.result.indexOf(',') + 1); // read from file by 
				axios({
                    method:     "POST",                       
                    url:       '/TypeAction.upLoadFile',
                    headers : {'Content-Type': 'multipart/form-data'} ,
					contentType: "application/json;charset=utf-8",
                    data:{					
                        aTypeCode :'pdf',
                        aTypeID : 0,
                        aFilename:'pdf0.pdf',     
						aFileStream: fdd,
						fileDate: Date(),
						aLoginID: 9
                    },
                    timeout:  8000
                }).then()......

The error info:
20220715 01495607 debug     mormot.rest.sqlite3.TRestServerDB(04e07b20) TRestServerRoutingRest.Error: {  "errorCode":406,  "errorText":"ITypeAction.upLoadFile failed parsing aFileStream: RawByteString from input JSON"  }

#23 Re: mORMot 1 » strings code Different in client and server » 2022-01-27 00:48:11

pvn0 wrote:

You need to provide more info, compiled with Delphi? Which version? Both client and server using same compiler & build mode? Modern Delphi string type is UnicodeString by default UTF-16 encoded so as expected uses more space then UTF-8 encoded rawutf8.

I use codetyphon 7.6 ,fpc 3.3.1, windows 7 64bit.
In server side ,I add to interface object.

  TORP_FTSObject =class(TInterfacedObject, Iorp_FTS)
    function fullToHalf(aStr:rawutf8):rawutf8; 
  end;

#24 mORMot 1 » strings code Different in client and server » 2022-01-26 06:30:17

htits2008
Replies: 3

Hi, Master!
   I have some strings code Different in client and server 。I want change some UTF8char(CJK) to ansichar. In client it do ok, and the length of strings is 285. but in server it make Garbled code, and the length of strings is 190。
Can I get any suggest?

function fullToHalf(aStr: rawutf8): rawutf8;
var
 str0,str1,str2:strings;
  strcnw:strings;
 Flags: TReplaceFlags;
 n,iCount:Integer;
const
 strcn:string='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ‘1234567890-=\~!#$%^&()_+|〔〕{};’:,。/<>?【】“”';
 stren:string='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`1234567890-=\~!#$%^&()_+|[]{};'':,./<>?[]""';
begin
 try
 strcnw:=utf8String(strcn);
 str0:=astr;
         with tsynlog.Enter() do
        begin
          log(sllinfo,str0);
         log(sllinfo,inttostr(length(strcn))+' char');  //190 or 285 
         log(sllinfo,inttostr(length(strcnw))+' wchar');   //190 or 285 
         log(sllinfo,inttostr(length(stren))+' echar'); //95
        end;
 for n:=1 to 93 do
 begin
 str1:=copy(strcnw,n*2-1,2); // copy(strcnw,n*3-2,3);
 str2:=copy(stren,n,1);

 Flags:=[rfReplaceAll];
 str0:=StringReplace(str0,str1,str2,iCount);
 if iCount>0 then
 begin
   with tsynlog.Enter() do
   begin
        log(sllinfo,str1+' '+str2 +' '+inttostr(iCount));
        //log(sllinfo,);
   end;
 end;
 end;
 Result:=str0;
 with tsynlog.Enter() do
begin
 log(sllinfo,' result: ');
 log(sllinfo,Result);
end;

  except
     on E:exception do
     begin
        with tsynlog.Enter() do
        begin
          log(sllinfo,' half error:  '+E.Message);

        end;
     end;
  end;
end; 

#25 Re: mORMot 1 » Search engine » 2022-01-10 08:22:45

mpv wrote:
htits2008 wrote:

Hi,mpv!
Can you share a Complete example ?

Please, see real life project sources here

Thank's mpv!
I think I find a node.js by freepascal.  you are nice!

#26 Re: mORMot 1 » Search engine » 2022-01-07 03:50:04

mpv wrote:

You need to allow custom tokenizer by call to EnableCustomTokenizer, and when execute a statement SELECT fts3_tokenizer during just after connecting to database

Hi,mpv!
Can you share a Complete example ?

#28 Re: mORMot 1 » salt in password » 2021-03-10 02:54:14

in the AuthUser table , data created by CreateMissingTables .
Admin , Supervisor , User , same PasswordHashHexa=67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd

#29 mORMot 1 » salt in password » 2021-03-10 02:04:39

htits2008
Replies: 2

Hi,every one!
I see "salt" in password encryption. I want to find an easy way to provide different "salt" to generate different passwords. Prevent the password of "user" from overriding the password of "admin" to obtain permission. So what should I do?

#31 mORMot 1 » How to save a File to MongoDB with mORMot Framework? » 2015-03-25 08:17:06

htits2008
Replies: 12

How to save a File to MongoDB with mORMot Framework?
I Use TMongoClient to link MongoDB like sample in Documentation. But the Sample don't  tell me how to save a  Pictrue , file or stream  to MongoDB.
Could You tell how to do? and get it back.
----------------------------------------------
here is the Sample.
---------------------------------------------
var Coll: TMongoCollection;
    doc: variant;
    i: integer;
begin
  Coll := DB.CollectionOrCreate[COLL_NAME];
  TDocVariant.New(doc);
  for i := 1 to 10 do
  begin
    doc.Clear;
    doc.Name := 'Name '+IntToStr(i+1);
    doc.Number := i;
    Coll.Save(doc);
    writeln('Inserted with _id=',doc._id);
  end;
end;
-----------------------------
http://synopse.info/files/html/Synopse% … #TITLE_187

Board footer

Powered by FluxBB