TheodoreKrypton / tgfs

Use telegram as file storage
Apache License 2.0
36 stars 8 forks source link

errorMessage: 'INPUT_FILTER_INVALID' #23

Closed klyamkovya closed 6 months ago

klyamkovya commented 7 months ago

Компилировал на Win11x64 через консоль nmp 10.5.0. Файл конфигурации заново создавался при запуске, telegramm запросил разрешения на подключение, затем выдал d:\tgfs\node_modules.bin>tgfs -w [2024-03-11T10:38:43.390] [INFO] - [Running gramJS version 2.18.37] [2024-03-11T10:38:43.399] [INFO] - [Connecting to 149.154.167.50:80/TCPFull...] [2024-03-11T10:38:43.497] [INFO] - [Connection to 149.154.167.50:80/TCPFull complete!] [2024-03-11T10:38:43.499] [INFO] - [Using LAYER 160 for initial connect] [2024-03-11T10:38:43.716] [INFO] - [Running gramJS version 2.18.37] [2024-03-11T10:38:43.717] [INFO] - [Connecting to 149.154.167.50:80/TCPFull...] [2024-03-11T10:38:43.812] [INFO] - [Connection to 149.154.167.50:80/TCPFull complete!] [2024-03-11T10:38:43.812] [INFO] - [Using LAYER 160 for initial connect] d:\tgfs\node_modules\telegram\errors\index.js:28 return new RPCBaseErrors_1.RPCError(rpcError.errorMessage, request, rpcError.errorCode); ^

RPCError: 400: INPUT_FILTER_INVALID (caused by messages.SearchGlobal) at RPCMessageToError (d:\tgfs\node_modules\telegram\errors\index.js:28:12) at MTProtoSender._handleRPCResult (d:\tgfs\node_modules\telegram\network\MTProtoSender.js:534:58) at MTProtoSender._processMessage (d:\tgfs\node_modules\telegram\network\MTProtoSender.js:464:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async MTProtoSender._recvLoop (d:\tgfs\node_modules\telegram\network\MTProtoSender.js:415:17) { code: 400, errorMessage: 'INPUT_FILTER_INVALID' }

Node.js v20.11.1 Что можно сделать?

TheodoreKrypton commented 7 months ago

Hello. Is there a pinned "metadata.json" file in your file channel?

klyamkovya commented 7 months ago

Hello. To be honest, I don't know how to do this( But if you tell me, I can And I don't find the metadata.json file in the \tgfs-master directory

TheodoreKrypton commented 7 months ago

It should be automatically created if you fill in the channel id in the config. Can you check that channel to see if a file named "metadata.json" was created and pinned?

klyamkovya commented 7 months ago

Here are all my actions. The config was created step by step, based on requests D:\Users\KlyamkovYA>D:\tgfs\node_modules.bin\tgfs.cmd -w ? The config file is malformed or not found. Create a config file now? Yes ? Where do you want to save this config file D:\Users\KlyamkovYA\config.yaml ? Visit https://my.telegram.org/apps, create an app and paste the app_id, app_token here App api_id xxxxxxx ? App api_hash xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ? Where do you want to save the account session D:\Users\KlyamkovYA\tgfs ? Where do you want to save the bot session D:\Users\KlyamkovYA\tgfs ? Create a bot from https://t.me/botfather and paste the bot token here Bot token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ? Create a PRIVATE channel and paste the channel id here Channel to store the files https://t.me/xxxxxxxxxxxxxxxxx [2024-03-11T14:52:56.244] [INFO] - [Running gramJS version 2.18.37] [2024-03-11T14:52:56.249] [INFO] - [Connecting to 149.154.167.91:80/TCPFull...] [2024-03-11T14:52:58.023] [INFO] - [Connection to 149.154.167.91:80/TCPFull complete!] [2024-03-11T14:52:58.024] [INFO] - [Using LAYER 160 for initial connect] ? phone number? +79129059078 [2024-03-11T14:53:21.839] [INFO] - [Phone migrated to 2] [2024-03-11T14:53:21.951] [INFO] - [Reconnecting to new data center 2] [2024-03-11T14:53:22.062] [WARN] - [Disconnecting...] [2024-03-11T14:53:22.063] [INFO] - [Disconnecting from 149.154.167.91:80/TCPFull...] [2024-03-11T14:53:22.063] [INFO] - [Connecting to 149.154.167.50:80/TCPFull...] [2024-03-11T14:53:24.031] [INFO] - [Connection to 149.154.167.50:80/TCPFull complete!] [2024-03-11T14:53:24.031] [INFO] - [Using LAYER 160 for initial connect] ? one-time code? 15002 [2024-03-11T14:53:43.618] [INFO] - [Signed in successfully as Юрий Клямков] [2024-03-11T14:53:43.620] [INFO] - [Running gramJS version 2.18.37] [2024-03-11T14:53:43.621] [INFO] - [Connecting to 149.154.167.50:80/TCPFull...] [2024-03-11T14:53:43.721] [INFO] - [Connection to 149.154.167.50:80/TCPFull complete!] [2024-03-11T14:53:43.721] [INFO] - [Using LAYER 160 for initial connect] D:\tgfs\node_modules\telegram\errors\index.js:28 return new RPCBaseErrors_1.RPCError(rpcError.errorMessage, request, rpcError.errorCode); ^ RPCError: 400: INPUT_FILTER_INVALID (caused by messages.SearchGlobal) at RPCMessageToError (D:\tgfs\node_modules\telegram\errors\index.js:28:12) at MTProtoSender._handleRPCResult (D:\tgfs\node_modules\telegram\network\MTProtoSender.js:534:58) at MTProtoSender._processMessage (D:\tgfs\node_modules\telegram\network\MTProtoSender.js:464:15) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async MTProtoSender._recvLoop (D:\tgfs\node_modules\telegram\network\MTProtoSender.js:415:17) { code: 400, errorMessage: 'INPUT_FILTER_INVALID' } Node.js v20.11.1 There are no files on the channel(. Or I don’t know where to look

TheodoreKrypton commented 7 months ago

You should put the channel id (the number after t.me/), instead of the url to that channel in the config. You can directly edit the config file and remove the "t.me" prefix

klyamkovya commented 7 months ago

After editing config.yaml, the same error occurred. I deleted the config file, ran \tgfs\node_modules.bin\tgfs.cmd -w again. I entered all the details of the bot and channel, without https://t.me/, and got the same error. Maybe the problem is that I'm running the script from my home network due to NAT? And the bot token in the config should look like this? numbers: numbers/letters

TheodoreKrypton commented 7 months ago

Can you confirm again that the channel id you put in the config contains only numbers? I am not sure if you accidentally put a invite link in it instead of the id

klyamkovya commented 7 months ago

ID consists not only of numbers, there are also letters and special characters Something like this (modified) https://t.me/+ghURDKn8KlGfRTD9 In the config I only use this part +ghURDKn8KlGfRTD9

klyamkovya commented 7 months ago

I installed ubuntu on a virtual machine, compiled with npm 10.5.0 and got the same error. error I'm desperate

TheodoreKrypton commented 7 months ago

ID consists not only of numbers, there are also letters and special characters Something like this (modified) https://t.me/+ghURDKn8KlGfRTD9 In the config I only use this part +ghURDKn8KlGfRTD9

I think this is the reason. The id should be a pure number. And please refer to this part to obtain a legit id. Right click on any message and copy the url. The channel id is in the url.

klyamkovya commented 7 months ago

Oh yes, I found it! Should the value /1 at the end of the channel number also be added? /xxxxxxxxxx/1 or xxxxxxxxxx ?

klyamkovya commented 7 months ago

Yes, it worked! Thank you for your patience) Now how to install the password on WebDAV and connect to it?

TheodoreKrypton commented 7 months ago

You are welcome. The password can be set directly in the config file. Any webdav client should work.

klyamkovya commented 7 months ago

I tried to set a password in this section tgfs: users: user: test password: test But then when you run the tgfs -w script, it is reported ? The config file is malformed or not found. Create a config file now? (Y/n) and a new config.yaml is created A script running on Ubuntu when trying to connect to a WebDAV server reports [2024-03-16T11:00:18.239] [INFO] GET / [2024-03-16T11:00:18.240] [INFO] GET 405 Get method not working?

Andrew666 commented 7 months ago

I tried to set a password in this section tgfs: users: user: test password: test But then when you run the tgfs -w script, it is reported ? The config file is malformed or not found. Create a config file now? (Y/n) and a new config.yaml is created A script running on Ubuntu when trying to connect to a WebDAV server reports [2024-03-16T11:00:18.239] [INFO] GET / [2024-03-16T11:00:18.240] [INFO] GET 405 Get method not working?

I have the same problem.

klyamkovya commented 7 months ago

And it can only be launched via perl tgfs -w Is this normal?

TheodoreKrypton commented 7 months ago

And it can only be launched via perl tgfs -w Is this normal?

I am not sure with that. I haven't used perl before but tgfs is installed as a binary command, so perhaps perl can execute it somehow.

I tried to set a password in this section tgfs: users: user: test password: test But then when you run the tgfs -w script, it is reported ? The config file is malformed or not found. Create a config file now? (Y/n) and a new config.yaml is created A script running on Ubuntu when trying to connect to a WebDAV server reports [2024-03-16T11:00:18.239] [INFO] GET / [2024-03-16T11:00:18.240] [INFO] GET 405 Get method not working?

The user part of the config should look like

...
tgfs:
  users:
    test:
      password: test
...

in your case, so you can login with username "test" and password "test"

@Andrew666 FYI

klyamkovya commented 7 months ago

Yes, I tried to write user: test password: test in the config.yaml file, but after that the command when launched displays The config file is malformed or not found. Create a config file now? (Y/n) seems like config.yaml is missing. If you refuse, there is no launch, if you create a new one, there is no user and password. And yes, the user and password in ubuntu are test, test. An attempt to correct the config in Windows with a different login/password leads to the same result.

TheodoreKrypton commented 7 months ago

Yes, I tried to write user: test password: test in the config.yaml file, but after that the command when launched displays The config file is malformed or not found. Create a config file now? (Y/n) seems like config.yaml is missing. If you refuse, there is no launch, if you create a new one, there is no user and password.

No. Please take a careful look at it. It's not

user: test
password: test

instead, it should be

users:
  test:  (this is the user name)
    password: test

and if multiple users are to use the service:

users:
  test1:
    password: test1
  test2:
    password: test2
  test3:
    password: test3
klyamkovya commented 7 months ago

Yes, it works. But after logging into the WebDAV page - HTTP ERROR 405 On console: [2024-03-16T19:34:43.627] [INFO] GET / [2024-03-16T19:34:43.630] [INFO] GET 405

Andrew666 commented 7 months ago

And it can only be launched via perl tgfs -w Is this normal?

I am not sure with that. I haven't used perl before but tgfs is installed as a binary command, so perhaps perl can execute it somehow.

I tried to set a password in this section tgfs: users: user: test password: test But then when you run the tgfs -w script, it is reported ? The config file is malformed or not found. Create a config file now? (Y/n) and a new config.yaml is created A script running on Ubuntu when trying to connect to a WebDAV server reports [2024-03-16T11:00:18.239] [INFO] GET / [2024-03-16T11:00:18.240] [INFO] GET 405 Get method not working?

The user part of the config should look like

...
tgfs:
  users:
    test:
      password: test
...

in your case, so you can login with username "test" and password "test"

@Andrew666 FYI

Yes, thanks, it works, but when downloading a file larger than 1mb, everything breaks Screenshot_2024-03-16-17-44-43-07_61c78dc80ee02b53007c815fefe993e3

TheodoreKrypton commented 7 months ago

Have you put in a bot token as well? The bot should also be added as an admin of your channel

klyamkovya commented 7 months ago

I was able to connect via the WebDAV Total Commander plugin. Everything is fine, the problem can be closed. I understand correctly, the unlimited storage itself is located in the Telegram channel, and the WebDAV server is only an interface for entering the storage?

TheodoreKrypton commented 7 months ago

I was able to connect via the WebDAV Total Commander plugin. Everything is fine, the problem can be closed. I understand correctly, the unlimited storage itself is located in the Telegram channel, and the WebDAV server is only an interface for entering the storage?

Yes exactly. WebDAV is only one of the interfaces. You can also access the storage via the cmd api. For example:

tgfs cmd ls /

More examples can be found in the README

Andrew666 commented 7 months ago

Have you put in a bot token as well? The bot should also be added as an admin of your channel

Yes, the token is correct, the bot has been added to the administrators. Maybe I should also register a bot in this section? manager: host: 0.0.0.0 port: 1901 path: / bot: token: '' chat_id: 0

TheodoreKrypton commented 7 months ago

Have you put in a bot token as well? The bot should also be added as an admin of your channel

Yes, the token is correct, the bot has been added to the administrators. Maybe I should also register a bot in this section? manager: host: 0.0.0.0 port: 1901 path: / bot: token: '' chat_id: 0

No the manager is still under development. This section of config shouldn't affect anything. But what is your problem now?

Andrew666 commented 7 months ago

I use Cyberduck, everything is fine when uploading small files, I get an error message when uploading files larger than 1 MB. I don't know what else to do(

klyamkovya commented 7 months ago

I was also happy early(. The sprint crashes when uploading a ~3Mb file. Maybe you need to change the value of _chunk_sizekb: 1024? error

TheodoreKrypton commented 7 months ago

I was also happy early(. The sprint crashes when uploading a ~3Mb file. Maybe you need to change the value of _chunk_sizekb: 1024? error

No, that field doesn't matter. It is the size for each chunk when downloading files. Can you try the following command to see if it works

tgfs cmd cp /<path-to-big-file> /remote_file_path
Andrew666 commented 7 months ago

I am running tgfs on a remote linux machine. And I create webdav on my home Windows PC. Unfortunately, I can't spell out the paths

klyamkovya commented 7 months ago

I ran the command on ubuntu, where tgfs was running error

klyamkovya commented 7 months ago

Now the same file via WebDAV error

TheodoreKrypton commented 7 months ago

I ran the command on ubuntu, where tgfs was running error

Can you confirm the file size is between 1MB - 10MB? If it is, it should be a bug that I should fix.

klyamkovya commented 7 months ago

Tried to copy different files. Even up to 1 MB is not copied File 435 096 b test@mubuntu:~/tgfs-master/node_modules/.bin$ ./tgfs -w [2024-03-18T14:32:29.644] [INFO] - [Running gramJS version 2.18.37] [2024-03-18T14:32:29.664] [INFO] - [Connecting to 149.154.167.50:80/TCPFull...] [2024-03-18T14:32:29.831] [INFO] - [Connection to 149.154.167.50:80/TCPFull complete!] [2024-03-18T14:32:29.832] [INFO] - [Using LAYER 160 for initial connect] [2024-03-18T14:32:30.116] [INFO] - [Running gramJS version 2.18.37] [2024-03-18T14:32:30.117] [INFO] - [Connecting to 149.154.167.50:80/TCPFull...] [2024-03-18T14:32:30.214] [INFO] - [Connection to 149.154.167.50:80/TCPFull complete!] [2024-03-18T14:32:30.215] [INFO] - [Using LAYER 160 for initial connect] [2024-03-18T14:32:31.039] [INFO] - [Starting indirect file download in chunks of 524288 at 0, stride 1048576] [2024-03-18T14:32:31.155] [INFO] - [Connecting to 149.154.167.41:443/TCPFull...] [2024-03-18T14:32:31.267] [INFO] - [Connection to 149.154.167.41:443/TCPFull complete!] [2024-03-18T14:32:31.533] [INFO] WebDAV is running on 192.168.0.110:1900/ [2024-03-18T14:32:31.534] [INFO] Manager is running on 192.168.0.110:1901/ [2024-03-18T14:33:01.269] [WARN] - [Disconnecting...] [2024-03-18T14:33:01.270] [INFO] - [Disconnecting from 149.154.167.41:443/TCPFull...] [2024-03-18T14:34:43.015] [INFO] PROPFIND / [2024-03-18T14:34:43.069] [INFO] PROPFIND 207 URIError: URI malformed at decodeURIComponent () at Array.map () at Path.decode (/home/test/tgfs-master/node_modules/webdav-server/lib/manager/v2/Path.js:22:33) at HTTPRequestContext.RequestContext (/home/test/tgfs-master/node_modules/webdav-server/lib/server/v2/RequestContext.js:104:29) at new HTTPRequestContext (/home/test/tgfs-master/node_modules/webdav-server/lib/server/v2/RequestContext.js:166:28) at HTTPRequestContext.create (/home/test/tgfs-master/node_modules/webdav-server/lib/server/v2/RequestContext.js:181:19) at WebDAVServer.executeRequest (/home/test/tgfs-master/node_modules/webdav-server/lib/server/v2/webDAVServer/StartStop.js:12:40) at /home/test/tgfs-master/node_modules/webdav-server/lib/extensions/Express.js:21:16 at Layer.handle [as handle_request] (/home/test/tgfs-master/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/home/test/tgfs-master/node_modules/express/lib/router/index.js:328:13) [2024-03-18T14:34:56.630] [INFO] PROPFIND / [2024-03-18T14:34:56.638] [INFO] PROPFIND 207 [2024-03-18T14:35:39.543] [INFO] PROPFIND / [2024-03-18T14:35:39.549] [INFO] PROPFIND 207

TheodoreKrypton commented 7 months ago

I tried from my side and it worked without any problem. Can you try to create a new channel and fill the new channel id into config to try again? @klyamkovya @Andrew666

klyamkovya commented 7 months ago

Did. Same problem(. And files uploaded to the channel via Telegram are not visible when connected via WebDAV. Is this how it should be? Could the problem be that ubuntu 192.168.0.110 is on the private network behind the router?

TheodoreKrypton commented 7 months ago

Did. Same problem(. And files uploaded to the channel via Telegram are not visible when connected via WebDAV. Is this how it should be? Could the problem be that ubuntu 192.168.0.110 is on the private network behind the router?

No that should not happen, you should see the file messages when uploading files. Can you see there is a "metadata.json" file created and pinned automatically in the Telegram channel?

klyamkovya commented 7 months ago

No that should not happen, you should see the file messages when uploading files. Can you see there is a "metadata.json" file created and pinned automatically in the Telegram channel?

The file "metadata.json" was created on first launch

klyamkovya commented 7 months ago

I tried to copy a file of 6,631,496 bytes, a message appeared on the channel tg This is what happened on the console and the script dropped out. console Is there a requirement for the program to run? I have 2Gb RAM on my ubuntu VM

TheodoreKrypton commented 7 months ago

I tried to copy a file of 6,631,496 bytes, a message appeared on the channel

tg

This is what happened on the console and the script dropped out.

console

Is there a requirement for the program to run? I have 2Gb RAM on my ubuntu VM

2GB RAM should be enough. Let me add some logging on another branch and please help me test on that branch.

klyamkovya commented 7 months ago

2GB RAM should be enough. Let me add some logging on another branch and please help me test on that branch.

I'm ready). Where to get the source?

TheodoreKrypton commented 6 months ago

@klyamkovya @Andrew666 Just pushed a new version, please try the latest version. The problem should have been fixed.

klyamkovya commented 6 months ago

Thank you. So far this message: "npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 698 packages, and audited 699 packages in 5m

63 packages are looking for funding run npm fund for details" I will sort this out

klyamkovya commented 6 months ago

Thank you. Now files are copied via WebDAV! Should files that are uploaded to a channel from a phone be visible in the list or is such functionality not provided?

TheodoreKrypton commented 6 months ago

Thank you. Now files are copied via WebDAV! Should files that are uploaded to a channel from a phone be visible in the list or is such functionality not provided?

No because you need to go through the tgfs server to update the metainfo.json. The metainfo.json is managing all the directory and files relationship. Maybe in the future I will add a bot to let you upload files through the bot.

klyamkovya commented 6 months ago

Clear. Please clarify what file sizes are supported for copying?

TheodoreKrypton commented 6 months ago

Clear. Please clarify what file sizes are supported for copying?

Depends on your account. Premium users can upload single files of up to 2GB I guess. Otherwise 1GB. But I may add a function to partition big files to enable uploading for file of any size.