mirror of
https://github.com/LibreTranslate/LibreTranslate.git
synced 2024-12-24 10:06:43 +02:00
Add LibreJS support
This commit is contained in:
parent
1945f5235c
commit
ae76d7efb4
@ -43,7 +43,7 @@ def get_routes_limits(default_req_limit, api_keys_db):
|
||||
req_limit = db_req_limit
|
||||
|
||||
return "%s per minute" % req_limit
|
||||
|
||||
|
||||
return [limits]
|
||||
|
||||
def create_app(args):
|
||||
@ -102,6 +102,11 @@ def create_app(args):
|
||||
def index():
|
||||
return render_template('index.html', gaId=args.ga_id, frontendTimeout=args.frontend_timeout, offline=args.offline, api_keys=args.api_keys, web_version=os.environ.get('LT_WEB') is not None)
|
||||
|
||||
@app.route("/javascript-licenses", methods=['GET'])
|
||||
@limiter.exempt
|
||||
def javascript_licenses():
|
||||
return render_template('javascript-licenses.html', offline=args.offline)
|
||||
|
||||
@app.route("/languages", methods=['GET', 'POST'])
|
||||
@limiter.exempt
|
||||
def langs():
|
||||
|
@ -229,7 +229,8 @@
|
||||
<p class="grey-text text-lighten-4">
|
||||
Made with ❤ by <a class="grey-text text-lighten-3" href="https://uav4geo.com">UAV4GEO</a> and powered by <a class="grey-text text-lighten-3" href="https://github.com/argosopentech/argos-translate/">Argos Translate</a>
|
||||
</p>
|
||||
<p><a class="grey-text text-lighten-4" href="https://www.gnu.org/licenses/agpl-3.0.en.html">License: AGPLv3</a></p>
|
||||
<p><a class="grey-text text-lighten-4" href="https://www.gnu.org/licenses/agpl-3.0.en.html">License: AGPLv3</a></p>
|
||||
<p><a class="grey-text text-lighten-4" href="/javascript-licenses" rel="jslicense">JavaScript license information</a></p>
|
||||
{% if web_version %}
|
||||
<p>
|
||||
The public API on libretranslate.com should be used for testing, personal or infrequent use. If you're going to run an application in production, please <a href="https://github.com/uav4geo/LibreTranslate" class="grey-text text-lighten-4" style="text-decoration: underline;">host your own server</a> or <a class="grey-text text-lighten-4" href="https://uav4geo.com/contact" style="text-decoration: underline;">get in touch</a> to obtain an API key.
|
||||
@ -255,13 +256,16 @@
|
||||
|
||||
<script src="{% if offline %}{{ url_for('static', filename='js/materialize.min.js') }}{% else %}https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js{% endif %}"></script>
|
||||
<script>
|
||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
||||
window.Prism = window.Prism || {};
|
||||
window.Prism.manual = true;
|
||||
// @license-end
|
||||
</script>
|
||||
|
||||
<script src="{% if offline %}{{ url_for('static', filename='js/prism.min.js') }}{% else %}https://cdnjs.cloudflare.com/ajax/libs/prism/1.22.0/prism.min.js{% endif %}"></script>
|
||||
|
||||
<script>
|
||||
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
|
||||
// API host/endpoint
|
||||
var BaseUrl = window.location.protocol + "//" + window.location.host;
|
||||
|
||||
@ -488,7 +492,7 @@ function setApiKey(){
|
||||
|
||||
localStorage.setItem("api_key", newKey);
|
||||
}
|
||||
|
||||
// @license-end
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
22
app/templates/javascript-licenses.html
Normal file
22
app/templates/javascript-licenses.html
Normal file
@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>jslicense-labels1 for LibreTranslate</title>
|
||||
</head>
|
||||
<body>
|
||||
<h3>Weblabels</h3>
|
||||
<table id="jslicense-labels1" border="1">
|
||||
<tr>
|
||||
<td><a href="{% if offline %}{{ url_for('static', filename='js/vue@2.js') }}{% else %}https://cdn.jsdelivr.net/npm/vue@2{% endif %}">Vue.js</a></td>
|
||||
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="{% if offline %}{{ url_for('static', filename='js/prism.min.js') }}{% else %}https://cdnjs.cloudflare.com/ajax/libs/prism/1.22.0/prism.min.js{% endif %}">prism.min.js</a></td>
|
||||
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="{% if offline %}{{ url_for('static', filename='js/materialize.min.js') }}{% else %}https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js{% endif %}">materialize.min.js</a></td>
|
||||
<td><a href="http://www.jclark.com/xml/copying.txt">Expat</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user