forked from p15670423/monkey
Island: Use Version object in Version endpoint
This commit is contained in:
parent
fb12c777a6
commit
6feb261254
|
@ -1,8 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from common.version import get_version
|
|
||||||
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
from monkey_island.cc.resources.AbstractResource import AbstractResource
|
||||||
from monkey_island.cc.services.version_update import VersionUpdateService
|
from monkey_island.cc.version import Version
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -10,14 +9,14 @@ logger = logging.getLogger(__name__)
|
||||||
class Version(AbstractResource):
|
class Version(AbstractResource):
|
||||||
urls = ["/api/island/version"]
|
urls = ["/api/island/version"]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, version: Version):
|
||||||
super(Version, self).__init__()
|
self._version = version
|
||||||
|
|
||||||
# We don't secure this since it doesn't give out any private info and we want UI to know version
|
# We don't secure this since it doesn't give out any private info and we want UI to know version
|
||||||
# even when not authenticated
|
# even when not authenticated
|
||||||
def get(self):
|
def get(self):
|
||||||
return {
|
return {
|
||||||
"current_version": get_version(),
|
"current_version": self._version.version_number,
|
||||||
"newer_version": VersionUpdateService.get_newer_version(),
|
"newer_version": self._version.latest_version,
|
||||||
"download_link": VersionUpdateService.get_download_link(),
|
"download_link": self._version.download_url,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue