TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Creating a TP-Link Router Backup Editor for the Web

27 pointsby ignitionmonkeyabout 3 years ago

1 comment

cxrabout 3 years ago
There&#x27;s a lot of great, thoughtful decisionmaking that went into this tool—staying away from NPM ecosystem&#x27;s tooling; keeping reliance on dependencies low; facing reality and compromising to use CryptoJS, anyway, but vendoring it in your own source tree. Some thoughts:<p>Before I even finished the post I was wondering how you&#x27;d choose to distribute tp-link-config-editor and whether you realized that, since this runs in the browser, you could use a bookmarklet to augment the TP-Link admin interface and integrate it directly with your tool. A bookmarklet might be overkill for something as seldomly used as a router configuration editor, however. I was happy to see, though, the remark that in the end tp-link-config-editor is just &quot;a simple web page with two &lt;button&gt; elements and a &lt;textarea&gt;&quot;. On the other hand, I recommend distributing it as a single file. Hosted stuff is (or should be) suspect for things as security-sensitive as router configuration, even if it&#x27;s a hosted utility. Better if you <i>give</i> people a copy, the way that you can give someone a copy of foo.exe for them run from disk. It makes sense to target the browser, because it&#x27;s the most accessible platform, but being a utility written for the browser doesn&#x27;t necessarily mean it has to be an editor for the Web. The ability of browsers to act as a runtime for offline apps is underappreciated. On that note, directories of files work, but they&#x27;re a bit more fragile than a single file that you can move around (and email, etc...) on a whim. For comparison: &lt;<a href="https:&#x2F;&#x2F;crussell.ichi.city&#x2F;lines.app.htm" rel="nofollow">https:&#x2F;&#x2F;crussell.ichi.city&#x2F;lines.app.htm</a>&gt;<p>&gt; It avoids using the web&#x27;s ArrayBuffer and NodeJS&#x27;s Buffer<p>There&#x27;s actually nothing &quot;web&quot; about ArrayBuffer (unlike TextDecoder, for comparison). ArrayBuffer is part of JS-the-language (as defined by the ECMAScript standard), and not a Web platform API.<p>&gt; The only odd thing is the setTimeout but it&#x27;s needed as createObjectURL will hold onto the blob forever and cause a memory leak. So revokeObjectURL releases it. There&#x27;s no API to hook into the download&#x27;s progress so a generous timeout is the best we can do.<p>It&#x27;s up to the browser maker, but from what I understand most browsers expire the URI when the original context disappears (e.g. you close the tab&#x2F;window containing the app that created it), thus releasing the blob that it&#x27;s associated with. Also, strictly speaking, the new tab&#x2F;window created with `window.open` isn&#x27;t necessary. The `a` element supports a `download` property, which additionally lets you suggest a name for the file. See &lt;<a href="https:&#x2F;&#x2F;codeberg.org&#x2F;triplescripts&#x2F;trplkt&#x2F;src&#x2F;commit&#x2F;380411d46235ee3d93f3a868cff0830cfd423827&#x2F;src&#x2F;SystemB.src#L87" rel="nofollow">https:&#x2F;&#x2F;codeberg.org&#x2F;triplescripts&#x2F;trplkt&#x2F;src&#x2F;commit&#x2F;380411d...</a>&gt;
评论 #31036912 未加载
评论 #31030364 未加载