Can I Theme, or Change the Title or Appearance, of Mitmweb? - mitmproxy

I have a setup with two mitmproxy interfaces - one for incoming traffic, and one for outgoing. This is to wrap an applicatiomn server so I can debug what happened post-mortem, for example.
I just had an outage and almost made an incorrect conclusion, because the two interfaces look the same, and the requests coming in and going out are similar - my app server is communicating with the same third-party in most flows. The two are accessed from two different ports, and I can't remember which way round those teo are off the top of my head.
I'd therefore like to change the mitmweb interface to help me differentiate. Apply a theme or colour scheme, or add a clear header or title in the page that helps me see quickly which is incoming and which outgoing. Therefore, if an unexpected outage arises again in the future, it will help me with gathering evidence, when there's a lot of noise going on that I can easily get confused.
I don't see anything in the config options that will let me change the visual appearance of mitmweb. Does anyone know any config items I can change that might help me achieve something like this please?
Thanks
(For info: I am currently using the official container image, on the slightly old 6.0.2 version)

There are no theming options for mitmweb at the moment. What you could do is add custom CSS to https://github.com/mitmproxy/mitmproxy/blob/main/mitmproxy/tools/web/templates/index.html. Make sure that you select the base template for the right version. :)

Related

Missing captioned images feature in TinyMCE and Plone5

I'm missing the function to enable captioned images in TinyMCE/Plone5. It was possible to enable that in the control panel with Plone4 (https://plone.org/documentation/manual/plone-4-user-manual/using-tinymce-as-visual-editor/images).
Now I'm using the new Plone5rc3 with TinyMCE 1.4.3, but the properties of TinyMCE in the control panel don't have the needed checkbox.
Does anybody know how to get that?
Thanks a lot!
So here's an answer in parts: you need several things for the captions to work:
Your <img> tags need to have the class captioned. I still need to find a good way to do that. The image picker will remove all other classes everytime you open it, so I guess a good way would be to change the classes that are added by the inline/left/right selection, but I've not easily found where those are defined.
You need the output filter, but fortunately, that is still there. However, the filter wants to see an IImageCaptioningEnabler, which is essentially a flag to turn the captioning mechanism on, and the old editors used to have that and currently, nothing in standard Plone does provide such a beast. If you're comfortable with add-on development, the class you want is
from plone.outputfilters.filters.resolveuid_and_caption import IImageCaptioningEnabler
from zope.interface import implements
class CaptioningAlwaysEnabled(object):
implements(IImageCaptioningEnabler)
available = True
with corresponding configure.zcml stanza
<utility factory=".resolveuid_and_caption.CaptioningAlwaysEnabled"
name="plone5-captions-always-enabled"
zcml:condition="have plone-5" />
(you can tell I patched buildout-cache/plone.outputfilters-2.1-py2.7.egg/plone/outputfilters/filters/configure.zcml and resolveuid_and_caption.py to include that, but of course, you shouldn't do that.)
If you're not comfortable with add-on development, you could, bizarrely enough, see if another editor provides that global switch, you don't need to have it set as your editor or the default editor. (Products.kupu would, but it doesn't install in 5.0. collective.ckeditor might, I can't try that right now due to missing dependencies.)
So, summary: no, you can't easily turn it on; you can turn it on with a bit of hacking; and if you file it as a feature request, it's the kind of thing that takes about fifteen minutes to fix for somebody who knows their way around the code.

How can I auto-modify an image?

The question I am asking is a little bit abstract, so I will try to make it more clear. There are websites where you sign up and get a signature in the format of an image. It has a general format, say a few boxes that are empty, and a logo in the middle. Now, say you gain the "Overachiever" badge, which looks like a pen. You signature is then updated, automatically, to include that pen badge in one of the blank boxes. I am completely clueless as to how to do this, and in what language to do this is, so can anyone help? I have been thinking about PHP as an option, but I do not know if that would work. Any suggestions?
You can do this with PHP (imagecreate) and for the updates in your images you can use cronjobs.
Is this for a forum? Depending on the platform, I know some hosts already have "addon's" that provide similar functionality to what you're after. (Karma addons etc.)
Maybe one of these will help? phpBB has some stuff like that.
https://www.phpbb.com/community/viewtopic.php?t=2147118
http://www.concrete5.org/
If you can execute an external process, you can do this using Image Magick.

Form Analyzation and Suggestions

I was filling out a form on uSell.com to ship out an old phone and when I entered my address, a dialog box popped up telling me what I entered along with their suggestion of what to change it to. I thought this was cool and was wondering how I can replicate that in my forms.
Looks like you talking about some kind of auto-completer. This can be done in various ways, depending on the languages you are using. You can make a simple auto-completer using just html, javascript and css. More complicated auto-completers can make server side calls to search through a database etc.
Have a look at the link below, they explain a very simple auto-completer.
Related topic
Hope this helps, good luck :)

How to serve System.Web.UI.DataVisualization chart images from different domain?

I have a set of System.Web.UI.DataVisualization charts (ASP.NET 4.0) working great and saving the files to disk. No problems and works great.
The challenge is that I am serving all of my static image and assets from a cookieless domain -- and eventually maybe from a CDN -- and unfortunately, the chart's IMG SRC is always relative. I can't seem to find a way to override that so that I can specify the root domain of the static asset server.
Some possible workarounds I haven't tried yet are:
Progamatically generate the charts and manually add an image control to the page
URL rewrite any requests for images (extra server hit, may not work)
Search and replace the SRC manually before markup is sent to browser (ugh)
Are there any other possibilities I'm not aware/thinking of? Thanks!
To answer my own question, the first bullet of programatically generating the charts (vs having the control markup in the HTML) and adding a control to the page manually seems to work just fine.
It removes the ability to style things in the markup though, so any other ideas are welcome.
Edit: I decided to leave the styling markup and programatically hide the chart control and add in the image control separately. Works great!
Edit: There is one caveat to my solution of adding the image control separately -- if you used the tooltips for each datapoint, they will no longer work once you implement this change since they are generated by the control itself.

iPhone SDK: Ideas on how to implement a help facility for application

We we wondering what are some ways developers have added a help function to their apps. What are some techniques people have used?
One way we were thinking of is to us UIWebView to display a HTML file with help instructions.
Thoughts appreciated.
I'm using UIWebView right now which pretty much contains all the help in a single page, along with some JQuery things to display popups, etc. But I like the way iCab Mobile (et al.) are doing things which is a sectioned UITableView with each row a separate topic or section within their overall help information (complete with icons...) then in their bundle they have each section in its own html file, organized by localization.
Another thing in my queue for the next release is to provide a dynamic "News" view. The rough idea is as follows... I have on my server a file or CGI where I can place small bits of news I'd like to push out to users. On startup, my app checks for network availability and if present, start a thread to see if anything has changed on the server since last updating the News data. If changes present, post an alert letting user know, and asking if they'd like to read it now. At that point, the latest news is already downloaded and cached, so they can simply read it later if they want, and I won't post anymore alerts until the server file changes again. (And one could add a preference/setting to disable these alerts.)
I'm thinking this would be a good way to let people know that some nasty bug is known and fixed and an update is sitting in the queue, solicit beta testers, promote upcoming features or other apps, etc. I can see where constant alerts everytime I've got something new to promote would get annoying, so having a setting to disable them means the user never has to read them unless they want to. Although some kind of override to warn of recently discovered/fixed bugs seems sensible.
FWIW, the author of Mover+/Mover has just started doing a similar thing, though I think Emanuele is perhaps only showing one Notelet at a time, whereas I envision a bit more of a history (shown in UIWebView) until I decide to age stuff off the bottom of the stack.
I'm using a scroll/page view to show several images containing small notes. Each image then tells the user about the more advanced functions on a specific part of the app.
In my opinion the help should only contain information that isn't a 100% relevant for the use of the application. It should be things the advanced user should use to make more use of the app. It should contain gold for the power users. The "basics" should be so obvious that no help would ever be needed. If that's not the case, I think, you've failed as a developer on the iPhone platform.
(Here's a screen shot from my demo app)
I'm currently creating a fairly complicated app. I'm thinking of doing help as a semi-transparent overlay - help in text form is hard to swallow for users; it's much more helpful to just point at stuff and say "this does that".