How to not reveal a third party secret api key in MediaWiki - mediawiki

I've got an API key from themoviedb.org and I want to use it with the MediaWiki extension External Data. But if I put it as plain wikitext it will be in plain sight.
Is there a simple way to add it as a custom variable in LocalSettings.php and then call this variable as a magic word or something in wikitext? And if so, will the key be secure that way?

There is no built in function in MediaWiki for “placeholders” in wikitext like the ones you are describing. Extensions with that need tend to use their own, custom solutions.
For Extension:External Data, you can add a variable called $edgStringReplacements to LocalSettings.php, see the documentation.

Related

Get GitLab "my projects" tab as JSON or XML?

Is it possible to get serialized output of some sort from the /dashboard/projects screen in GitLab?
(I want to track differences and alert myself when someone assigns me a new project. One option is of course to build a script that iterates through the HTML pages, but if there's a way to get all projects at once -- preferably in a machine-friendly format -- that's even better.)
I think that usually this kind of alert are not strictly needed, because usually the assignment workflow is about issue/MR assignment (which usually end up in a email in you inbox), anyway..
You should take a look at GitLab API or, even better, use an already existing project like Python GitLab
It is a Python client implementation of GitLab API and also have an handy gitlab command line tool that can give you the required data in a human/machine readable format

Asterisk as a SIP client dynamic configuration

I am moving from asterisk 1.x to 13.6.In current implementation to dynamically register/unregister asterisk as different sip clients I use following trick: In sip.conf file I include my custom conf file which I update(add/remove) with "register =>..." and then "sip reload".
Do we have better way to do this in new asterisk version?
As variant I would like to include in sip.conf not single file but several from specific folder. Is it possible in asterisk config files?
Thank you in advance!
Asides from using realtime (https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration) and sorcery (https://wiki.asterisk.org/wiki/display/AST/Sorcery+Caching), you can use "exec".
I'm not sure this is the desired way to do this, but you can take advantage of the "exec" include, see: https://wiki.asterisk.org/wiki/display/AST/Using+The+include,+tryinclude+and+exec+Constructs
So Asterisk would execute a script of yours (shell, php, ruby, etc) that will output everything you need, and there's no need to add multiple "include" statements.
For this to work you should have in your asterisk.conf:
execincludes = yes
Not performant, not pretty, might have some security issues if you are not careful, but could do the job if you don't want to use any realtime or sorcery configuration.

Difference between name.html.erb vs name.erb

What is the difference between name.html.erb vs name.erb?
In particular, are there any reasons why name.erb could be bad to use?
I understand that name.html.erb is the convention - this indicates a HTML template and ERB Engine. But I can't find information if are there any reasons not to use name.html.erb, but name.erb instead.
My new workplace asks me to use name.erb, so I want to know: might there be any problems with this?
In short, no, there won't be any problems. Erb files simply output text. In many cases the file extension is ignored by the reading app as the reading app reads/interprets the containing text and its syntax validity. As #taglia suggests, the file extensions are mostly a 'hint' for you and may also be used by the OS to select a default app to open the file with. See here for a more thorough explanation: Output Type for an ERB File
Rails convention dictates template files to include the extension of the output type and the name of the file should end with the .erb extension. As you mentioned, name.html.erb indicates an HTML template and ERB extension that allows any instance variables in your controller's index action to get passed into the template and used. Similarly, name.js.erb indicates a JavaScript template. See here under 'Conventions or Template Files': An Introduction to ERB Templating
ERB is just a templating language, it is not limited to HTML (you could have name.txt.erb, or name.js.erb). Removing html from the name is just going to make your life more difficult (assuming it works), because you won't be able to know what file you are dealing with unless you open it.

Rename Taxonomy label in editor bolt-cms

I would like to rename the default tab value of Taxonomy in the backend page editor. I didn't find anything in the twig or yml files that would address this. Any ideas?
I checked with bolt developers and there is no way currently to do this. One potential option was to use the messages file but it was not recommended.
As you can imagine, since this isn't supported via the public configs, this will need a bit more advanced plugging together.
Here is a way to add an additional resource to the stack of translations.
https://gist.github.com/rossriley/c74fdee4fec3eaffb12f
This is a technique to add your own messages onto the translation stack without touching the underlying core files.
After creating this, you'll need to add your new service provider to the app, which you normally will bootstrap either in your index.php or a custom bootstrap file.

Using external reference list in MediaWiki

I am making extensive use of the Cite extension in my own wiki. I have a lot of references per page, most of which will be also used in other pages.
What I am doing at the moment is defining the list of references at the end of the wiki page:
<references>
<ref name="ref1">Ref. 1</ref>
<ref name="ref2">Ref. 2</ref>
<references />
Then, whenever I need to refer to one of them I use them in the following way:
It has been previously shown by Group of Authors 1<ref name="ref1" /> that bla bla bla...
This works fine. However, defining the list of references is extremely tedious, and it is a waste of time needing to define the list for every page in the wiki when some of the references are the same among pages.
It would be very helpful if I could define a "master copy" of the reference list that could be accessed from each wiki page by just giving the reference's name. This is much in the same way that bibtex works, where you have a bibliography.bib file and you can just use the cite package in latex and include the reference in any of your documents by using \cite{ref1} and specifying the master file's location with \bibliography{bibliography}.
As a matter of fact, I would ideally prefer to use a solution in which references in mediawiki can be accessed directly from an external bibtex file, rather than with the Cite extension.
Any ideas?
References work even when they are put in templates, so that would allow you to have a “master list” of references.
If you want to be able to view all your references in BibTex format, Semantic MediaWiki has a function for that, using the Semantic Result Formats extension. That would also allow you to do more advanced processing of your references, though admittedly the threshold for starting to use SMW is a bit high.