-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fair use of the API? #3
Comments
Hi Henrik, Thank you for asking. Unfortunately, I would like you to refrain from calling the API endpoint from other system. If you only want to use the endpoint, you can disable the UI by comment out like this: /src/main/java/com/dencode/web/servlet/pages/IndexServlet.java //@WebServlet("")
public class IndexServlet extends AbstractDencodeHttpServlet { If you have any other questions, feel free to ask. Thank you! |
Thanks for your reply. Do you know of any public API that does what DenCode do? |
I made DenCode because it doesn't exist in the world ;) /dencode endpoint is designed specifically for the web UI, so it is not general purpose and its specifications are not stable. You can use the following icon for the search result. Maybe the plugin that copies a result to the clipboard?
e.g.
-> link to https://dencode.com/?v=test-value
-> link to https://dencode.com/string?v=test-value
-> link to https://dencode.com/string/base64?v=test-value
-> link to https://dencode.com/string/hex?v=test-value |
Yes, exactly! I was not able to find any other service that is as good as DenCode. I need a couple of weeks to finish other stuff, before I can start on a encode/decode plugin for PowerToys Run. |
Of course, I'm in favor of using local libraries. The main reason DenCode is encoding on the server is because JavaScript is not good at character encoding conversion. I'm a Mac user but will contribute if possible. |
Hi @mozq Now I got time to start trying out your API. Can I use this header: |
Hi @hlaueriksson |
Did you set the cookie header and get an error? I think you have already dealt with it. Cookie header are unnecessary and will be removed. |
I can see your screen record now. Great!! If the input value and the result value are the same, it may be easier to find the desired result if you put them later in the display order or hide them. |
No, I did not set any cookies.
Yes, that's smart. I will try this approach. |
I'm parsing the I found two issues:
|
I have a question. When the web is sending a {
"type": "all",
"method": "all.all",
"value": "Hello, world!",
"oe": "UTF-8",
"nl": "crlf",
"tz": "Africa/Algiers",
"options": {
"decStrMorseCodeVariant": "international",
"decCipherCaesarShift": "-3",
"decCipherEnigmaMachine": "I",
"decCipherEnigmaReflector": "UKW-A",
"decCipherEnigmaRotor4": "Beta",
"decCipherEnigmaRotor3": "I",
"decCipherEnigmaRotor2": "II",
"decCipherEnigmaRotor1": "III",
"decCipherEnigmaReflectorRing": "1",
"decCipherEnigmaRotor4Ring": "1",
"decCipherEnigmaRotor3Ring": "1",
"decCipherEnigmaRotor2Ring": "1",
"decCipherEnigmaRotor1Ring": "1",
"decCipherEnigmaReflectorPosition": "1",
"decCipherEnigmaRotor4Position": "1",
"decCipherEnigmaRotor3Position": "1",
"decCipherEnigmaRotor2Position": "1",
"decCipherEnigmaRotor1Position": "1",
"decCipherEnigmaPlugboard": "",
"decCipherEnigmaUhr": "0",
"decCipherEnigmaUkwd": "",
"decCipherScytaleKey": "2",
"decCipherRailFenceKey": "2",
"encStrBinSeparatorEach": "",
"encStrHexSeparatorEach": "",
"encStrHexCase": "lower",
"encStrURLEncodingSpace": "",
"encStrBase64LineBreakEach": "",
"encStrAscii85Variant": "z85",
"encStrUnicodeEscapeSurrogatePairFormat": "",
"encStrProgramStringQuotes": "double",
"encStrMorseCodeVariant": "international",
"encStrLineSortOrder": "asc",
"encNumEnShortScaleFractionalPartNotation": "",
"encNumEnShortScaleSystem": "",
"encDateISO8601DecimalMark": ".",
"encDateISO8601ExtDecimalMark": ".",
"encDateISO8601WeekDecimalMark": ".",
"encDateISO8601OrdinalDecimalMark": ".",
"encColorRGBFnNotation": "percentage",
"encCipherCaesarShift": "-3",
"encCipherEnigmaMachine": "I",
"encCipherEnigmaReflector": "UKW-A",
"encCipherEnigmaRotor4": "Beta",
"encCipherEnigmaRotor3": "I",
"encCipherEnigmaRotor2": "II",
"encCipherEnigmaRotor1": "III",
"encCipherEnigmaReflectorRing": "1",
"encCipherEnigmaRotor4Ring": "1",
"encCipherEnigmaRotor3Ring": "1",
"encCipherEnigmaRotor2Ring": "1",
"encCipherEnigmaRotor1Ring": "1",
"encCipherEnigmaReflectorPosition": "1",
"encCipherEnigmaRotor4Position": "1",
"encCipherEnigmaRotor3Position": "1",
"encCipherEnigmaRotor2Position": "1",
"encCipherEnigmaRotor1Position": "1",
"encCipherEnigmaPlugboard": "",
"encCipherEnigmaUhr": "0",
"encCipherEnigmaUkwd": "",
"encCipherJisKeyboardMode": "lenient",
"encCipherScytaleKey": "2",
"encCipherRailFenceKey": "2"
}
} How does the web know the default If I send a POST request myself with |
The issues with the .properties file have been fixed. Thank you for letting me know. I've changed the default option values on the server side, could you try it with null? "options": {} |
I also changed the following default values in web. Please change these options. "decCipherEnigmaRotor3": "III", // "I" -> "III"
"decCipherEnigmaRotor2": "II",
"decCipherEnigmaRotor1": "I", // "III" -> "I"
"encCipherEnigmaRotor3": "III", // "I" -> "III"
"encCipherEnigmaRotor2": "II",
"encCipherEnigmaRotor1": "I", // "III" -> "I" |
Yes, after clearing the local storage the response is identical. Thanks! |
Hi @mozq and @hlaueriksson Could you please clarify a few details regarding API calls? I have some specific questions about encoding, body construction, and endpoints. Here's a sample code I'd like to decode: =FA=E5=E3=E4 Questions: Encoding and Character Set: Should I explicitly specify the encoding and character set when making a POST request? What's the correct way to format the request body for decoding tasks? Which specific endpoint should I use for decoding? Thanks in advance for your help! Truly appreciate your guidance. |
Hi @TheRamSan I’m not sure your usage purpose or environment, but since Quoted-printable has a simple specification, so I recommend implementing decoding logic within your application. Please refer to this code for decoding implementation. dencode-web/src/main/java/com/dencode/logic/dencoder/StringQuotedPrintableDencoder.java Lines 167 to 220 in e6f892d
|
Hello @mozq, I appreciate your code and your fantastic website. The work you've done is impressive, and I'm truly grateful. Currently, I'm using make.com to extract text from an eml file. Some of the text is encoded in Quoted-printable with the Windows-1255 character set, and I'm seeking a solution to decode it. Unfortunately, within make.com, I'm restricted to running only vanilla JS code, and even that is not straightforward. Typically, if the required functionality is not available in make.com tools, we resort to making an HTTP request to an API that can provide the necessary information. In this instance, I'm on the lookout for an API that can take a string as input and return the decoded text, preferably without the need to pre-select the character set, etc. Do you happen to know of any such API? Thanks again, |
Happy New Year, @TheRamSan ! Windows-1255 has only few characters defined, so I mapped the codes to Unicode manually. (I'm Japanese and I usually use a crazy amount of characters...)
|
Hi @mozq Thanks for the code, I will give it a got. |
@TheRamSan Wow, ありがとうございます!どういたしまして! 0xA0: '\u{A0}' If you have any questions, please let me know. P.S.
|
Thank you again for your help. |
Hi again @mozq I finally got around to release the DenCode plugin for PowerToys Run: The |
Hi @hlaueriksson I've added a link to your project page in DenCode's README. |
I'm glad that you like the plugin. Thank you for an awesome site! I got the encoding methods from the old If I parse all the I have a test that generates the encoding method data for the plugin. It's included in the binaries. |
I'm also glad you like dark mode😀
Yes, you can parse the definitions from the .java files. However, definitions such as “useOe” are used for web UI, so you do not need to get them. Please note that the key such as “label.encStrBin=” will be changed to “string.bin.encStrBin=”, but I'm too lazy to do it yet :P Once the key changes, it becomes more easier to parse. |
I’ve changed key name of dencoder functions in messages.properties as below.
If dencoder methods or functions are added, renamed, or deleted in the future, please parse this file and synchronize it. |
Thanks! I will take a look at |
Hi @hlaueriksson using System.Text.Json;
using System.Text.RegularExpressions;
Regex keyRegex = new("^(?<method>[^\\.]+\\.[^\\.]+)\\.(?<subkey>method|title|desc|toltip|func)(?:\\.(?<function>.+))?");
Dictionary<string, Dictionary<string, string>> methods = [];
Dictionary<string, Dictionary<string, string>> methodFunctions = [];
string messages = await new HttpClient().GetStringAsync("https://raw.githubusercontent.com/mozq/dencode-web/master/src/main/resources/messages.properties");
StringReader reader = new(messages);
string? line;
while ((line = reader.ReadLine()) != null)
{
int idx = line.IndexOf('=');
if (idx == -1)
{
continue;
}
string key = line[..idx];
string label = line[(idx + 1)..].Replace("\\\\", "\\");
Match m = keyRegex.Match(key);
if (!m.Success)
{
continue;
}
string method = m.Groups["method"].Value;
string subkey = m.Groups["subkey"].Value;
string function = m.Groups["function"].Value;
if (subkey == "method")
{
methods[method] = [];
methods[method]["key"] = method;
methods[method][subkey] = label;
methodFunctions[method] = [];
}
else if (subkey == "func")
{
methodFunctions[method][function] = label;
//methodFunctions[method[..method.IndexOf('.')] + ".all"][function] = label;
//methodFunctions["all.all"][function] = label;
}
else
{
methods[method][subkey] = label;
}
}
Console.WriteLine(JsonSerializer.Serialize(methods));
Console.WriteLine(JsonSerializer.Serialize(methodFunctions)); |
Thanks for the sample code @mozq I continued with my naive approach without regex: |
Thank you for implementing it. |
Hi!
This is a great project! ❤️
I would like to write and publish a PowerToys Run plugin that use your API.
Can I
POST
tohttps://dencode.com/dencode
from the plugin?Would that be fair use of the API?
Would you prefer that I set a specific user agent for those requests?
Thanks!
/ Henrik
The text was updated successfully, but these errors were encountered: