{% block body %}
+{% if allow_edit %}
<form action="/{{page_names.file}}/{{file.digest.b64}}" method="POST" />
<input type="hidden" name="redir_target" value="{{redir_target}}" />
+{% endif %}
<table>
+
<tr>
<th>path:</th>
<td class="top_field">{{file.rel_path}}</td>
</tr>
+
<tr>
<th>present:</th>
<td>{% if file.present %}<a href="/{{page_names.download}}/{{file.yt_id}}">yes</a>{% else %}no{% endif %}</td>
</tr>
+
<tr>
<th>YouTube ID:</th>
<td><a href="/{{page_names.yt_result}}/{{file.yt_id}}">{{file.yt_id}}</a>
</tr>
+
<tr>
<th>tags</th>
<td>
<table>
{% for tag in file.tags %}
<tr>
-<td class="tag_checkboxes"><input type="checkbox" name="tags" value="{{tag}}" checked /></td>
+<td class="tag_checkboxes"><input type="checkbox" name="tags" value="{{tag}}" checked{% if not allow_edit %} disabled{% endif %}/></td>
<td>{{tag}}</td>
</tr>
{% endfor %}
+{% if allow_edit %}
<tr>
<td class="tag_checkboxes">add:</td>
<td>
</datalist>
</td>
</tr>
+{% endif %}
+</table>
+</td>
+</tr>
+
<tr>
<th>flags:</th>
<td class="flags">
{% for flag_name in flag_names %}
-{{ flag_name }}: <input type="checkbox" name="flags" value="{{flag_name}}" {% if file.is_flag_set(flag_name) %}checked {% endif %} /><br />
+{{ flag_name }}: <input type="checkbox" name="flags" value="{{flag_name}}" {% if file.is_flag_set(flag_name) %}checked{% endif %}{% if not allow_edit %} disabled{% endif %}/><br />
{% endfor %}
</td>
</tr>
+
</table>
+{% if allow_edit %}
<input type="submit" />
</form>
+{% endif %}
{% endblock %}
self._redirect(Path(postvars.first_for('redir_target')))
def _receive_file_data(self, digest: Hash, postvars: _ReqMap) -> None:
+ if not self.server.config.allow_file_edit:
+ self._send_http('no way', code=403)
+ return
with DbConn() as conn:
file = VideoFile.get_one(conn, digest)
file.set_flags({FILE_FLAGS[FlagName(name)]
self._send_rendered_template(
_NAME_TEMPLATE_FILE_DATA,
{'file': file,
+ 'allow_edit': self.server.config.allow_file_edit,
'flag_names': list(FILE_FLAGS),
'unused_tags': unused_tags})
'port_remote': 8090,
'background_color': '#ffffff',
'queries_cutoff': '',
- 'tags_prefilter_str': ''
+ 'tags_prefilter_str': '',
+ 'allow_file_edit': True
}
# type definitions for mypy
background_color: str
queries_cutoff: str
tags_prefilter_str: str
+ allow_file_edit: bool
def __init__(self):
def set_attrs_from_dict(d):