mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-01 21:16:46 +00:00
remove signatur checking (we do not use included git anymore) (#5018)
This commit is contained in:
parent
9f56ee1023
commit
2f98ed7022
@ -1616,13 +1616,6 @@ class InvenTreeSetting(BaseInvenTreeSetting):
|
|||||||
'requires_restart': True,
|
'requires_restart': True,
|
||||||
},
|
},
|
||||||
|
|
||||||
'PLUGIN_CHECK_SIGNATURES': {
|
|
||||||
'name': _('Check plugin signatures'),
|
|
||||||
'description': _('Check and show signatures for plugins'),
|
|
||||||
'default': False,
|
|
||||||
'validator': bool,
|
|
||||||
},
|
|
||||||
|
|
||||||
# Settings for plugin mixin features
|
# Settings for plugin mixin features
|
||||||
'ENABLE_PLUGINS_URL': {
|
'ENABLE_PLUGINS_URL': {
|
||||||
'name': _('Enable URL integration'),
|
'name': _('Enable URL integration'),
|
||||||
|
@ -128,42 +128,14 @@ def get_git_log(path):
|
|||||||
commit.author.decode().split('<')[1][:-1],
|
commit.author.decode().split('<')[1][:-1],
|
||||||
datetime.datetime.fromtimestamp(commit.author_time, ).isoformat(),
|
datetime.datetime.fromtimestamp(commit.author_time, ).isoformat(),
|
||||||
commit.message.decode().split('\n')[0],
|
commit.message.decode().split('\n')[0],
|
||||||
'E',
|
|
||||||
None
|
|
||||||
]
|
]
|
||||||
except NotGitRepository:
|
except NotGitRepository:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not output:
|
if not output:
|
||||||
output = 7 * [''] # pragma: no cover
|
output = 5 * [''] # pragma: no cover
|
||||||
|
|
||||||
return {'hash': output[0], 'author': output[1], 'mail': output[2], 'date': output[3], 'message': output[4], 'verified': output[5], 'key': output[6]}
|
return {'hash': output[0], 'author': output[1], 'mail': output[2], 'date': output[3], 'message': output[4]}
|
||||||
|
|
||||||
|
|
||||||
class GitStatus:
|
|
||||||
"""Class for resolving git gpg singing state."""
|
|
||||||
|
|
||||||
class Definition:
|
|
||||||
"""Definition of a git gpg sing state."""
|
|
||||||
|
|
||||||
key: str = 'N'
|
|
||||||
status: int = 2
|
|
||||||
msg: str = ''
|
|
||||||
|
|
||||||
def __init__(self, key: str = 'N', status: int = 2, msg: str = '') -> None:
|
|
||||||
"""Define a git Status -> needed for lookup."""
|
|
||||||
self.key = key
|
|
||||||
self.status = status
|
|
||||||
self.msg = msg
|
|
||||||
|
|
||||||
N = Definition(key='N', status=2, msg='no signature',)
|
|
||||||
G = Definition(key='G', status=0, msg='valid signature',)
|
|
||||||
B = Definition(key='B', status=2, msg='bad signature',)
|
|
||||||
U = Definition(key='U', status=1, msg='good signature, unknown validity',)
|
|
||||||
X = Definition(key='X', status=1, msg='good signature, expired',)
|
|
||||||
Y = Definition(key='Y', status=1, msg='good signature, expired key',)
|
|
||||||
R = Definition(key='R', status=2, msg='good signature, revoked key',)
|
|
||||||
E = Definition(key='E', status=1, msg='cannot be checked',)
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ from django.urls.base import reverse
|
|||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from plugin.helpers import GitStatus, get_git_log
|
from plugin.helpers import get_git_log
|
||||||
|
|
||||||
logger = logging.getLogger("inventree")
|
logger = logging.getLogger("inventree")
|
||||||
|
|
||||||
@ -394,16 +394,6 @@ class InvenTreePlugin(VersionMixin, MixinBase, MetaBase):
|
|||||||
if package.get('date'):
|
if package.get('date'):
|
||||||
package['date'] = datetime.fromisoformat(package.get('date'))
|
package['date'] = datetime.fromisoformat(package.get('date'))
|
||||||
|
|
||||||
# process sign state
|
|
||||||
sign_state = getattr(GitStatus, str(package.get('verified')), GitStatus.N)
|
|
||||||
if sign_state.status == 0:
|
|
||||||
self.sign_color = 'success' # pragma: no cover
|
|
||||||
elif sign_state.status == 1:
|
|
||||||
self.sign_color = 'warning'
|
|
||||||
else:
|
|
||||||
self.sign_color = 'danger' # pragma: no cover
|
|
||||||
|
|
||||||
# set variables
|
# set variables
|
||||||
self.package = package
|
self.package = package
|
||||||
self.sign_state = sign_state
|
|
||||||
# endregion
|
# endregion
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_NAVIGATION" icon="fa-sitemap" %}
|
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_NAVIGATION" icon="fa-sitemap" %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_APP" icon="fa-rocket" %}
|
{% include "InvenTree/settings/setting.html" with key="ENABLE_PLUGINS_APP" icon="fa-rocket" %}
|
||||||
{% include "InvenTree/settings/setting.html" with key="PLUGIN_ON_STARTUP" %}
|
{% include "InvenTree/settings/setting.html" with key="PLUGIN_ON_STARTUP" %}
|
||||||
<tr><td colspan='5'></td></tr>
|
|
||||||
{% include "InvenTree/settings/setting.html" with key="PLUGIN_CHECK_SIGNATURES" %}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
@ -118,20 +118,6 @@
|
|||||||
<td>{% trans "Commit Message" %}</td><td>{{ plugin.package.message }}{% include "clip.html" %}</td>
|
<td>{% trans "Commit Message" %}</td><td>{{ plugin.package.message }}{% include "clip.html" %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% settings_value "PLUGIN_CHECK_SIGNATURES" as signatures %}
|
|
||||||
{% if signatures %}
|
|
||||||
<tr>
|
|
||||||
<td><span class='text-{{ plugin.sign_color }} fas fa-check'></span></td>
|
|
||||||
<td>{% trans "Sign Status" %}</td>
|
|
||||||
<td class="bg-{{ plugin.sign_color }}">{% if plugin.package.verified %}{{ plugin.package.verified }}: {% endif %}{{ plugin.sign_state.msg }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><span class='text-{{ plugin.sign_color }} fas fa-key'></span></td>
|
|
||||||
<td>{% trans "Sign Key" %}</td>
|
|
||||||
<td class="bg-{{ plugin.sign_color }}">{{ plugin.package.key }}{% include "clip.html" %}</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user