mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-18 14:28:08 +00:00
Merge branch 'master' into 2.2
This commit is contained in:
commit
dfba40fee2
@ -23,7 +23,6 @@ import urllib.parse
|
|||||||
from gns3server.web.route import Route
|
from gns3server.web.route import Route
|
||||||
from gns3server.controller import Controller
|
from gns3server.controller import Controller
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -44,6 +43,24 @@ class SymbolHandler:
|
|||||||
controller = Controller.instance()
|
controller = Controller.instance()
|
||||||
response.json(controller.symbols.list())
|
response.json(controller.symbols.list())
|
||||||
|
|
||||||
|
@Route.get(
|
||||||
|
r"/symbols/{symbol_id:.+}/dimensions",
|
||||||
|
description="Get the symbol dimensions",
|
||||||
|
status_codes={
|
||||||
|
200: "Symbol dimensions returned"
|
||||||
|
})
|
||||||
|
async def get_dimensions(request, response):
|
||||||
|
|
||||||
|
controller = Controller.instance()
|
||||||
|
symbol_id = urllib.parse.unquote(request.match_info["symbol_id"])
|
||||||
|
try:
|
||||||
|
width, height, _ = controller.symbols.get_size(symbol_id)
|
||||||
|
symbol_dimensions = {'width': width, 'height': height}
|
||||||
|
response.json(symbol_dimensions)
|
||||||
|
except (KeyError, OSError, ValueError) as e:
|
||||||
|
log.warning("Could not get symbol dimensions: {}".format(e))
|
||||||
|
response.set_status(404)
|
||||||
|
|
||||||
@Route.get(
|
@Route.get(
|
||||||
r"/symbols/{symbol_id:.+}/raw",
|
r"/symbols/{symbol_id:.+}/raw",
|
||||||
description="Get the symbol file",
|
description="Get the symbol file",
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
// Github Pages redirection
|
// Github Pages redirection
|
||||||
(function() {
|
(function () {
|
||||||
var redirect = sessionStorage.redirect;
|
var redirect = sessionStorage.redirect;
|
||||||
delete sessionStorage.redirect;
|
delete sessionStorage.redirect;
|
||||||
if (redirect && redirect != location.href) {
|
if (redirect && redirect != location.href) {
|
||||||
@ -33,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<link rel="stylesheet" href="styles.9eb8c986af611de926ea.css"></head>
|
<link rel="stylesheet" href="styles.333203d05669b9ad3942.css"></head>
|
||||||
<!-- <body class="mat-app-background" oncontextmenu="return false;"> -->
|
<!-- <body class="mat-app-background" oncontextmenu="return false;"> -->
|
||||||
<body class="mat-app-background" oncontextmenu="return false;">
|
<body class="mat-app-background" oncontextmenu="return false;">
|
||||||
<app-root></app-root>
|
<app-root></app-root>
|
||||||
@ -41,12 +41,12 @@
|
|||||||
<script async="" src="https://www.googletagmanager.com/gtag/js?id=G-5D6FZL9923"></script>
|
<script async="" src="https://www.googletagmanager.com/gtag/js?id=G-5D6FZL9923"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag()
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
{dataLayer.push(arguments);}
|
}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', 'G-5D6FZL9923');
|
gtag('config', 'G-5D6FZL9923');
|
||||||
</script>
|
</script>
|
||||||
<script src="runtime.7425f237727658da0a30.js" defer></script><script src="polyfills-es5.c354ceb948246ee3c02e.js" nomodule defer></script><script src="polyfills.c1fadfb88d7fb5b7f9ac.js" defer></script><script src="main.a3d9cbf7065d44d2dc40.js" defer></script></body>
|
<script src="runtime.7425f237727658da0a30.js" defer></script><script src="polyfills-es5.c354ceb948246ee3c02e.js" nomodule defer></script><script src="polyfills.c1fadfb88d7fb5b7f9ac.js" defer></script><script src="main.2f0314a517dded67879c.js" defer></script></body>
|
||||||
</html>
|
</html>
|
||||||
|
1
gns3server/static/web-ui/main.2f0314a517dded67879c.js
Normal file
1
gns3server/static/web-ui/main.2f0314a517dded67879c.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -92,7 +92,7 @@ def get_size(data, default_width=0, default_height=0):
|
|||||||
# End of https://github.com/shibukawa/imagesize_py
|
# End of https://github.com/shibukawa/imagesize_py
|
||||||
|
|
||||||
# handle SVG
|
# handle SVG
|
||||||
elif size >= 10 and data.startswith(b'<?xml'):
|
elif size >= 10 and (data.startswith(b'<?xml') or data.startswith(b'<svg')):
|
||||||
filetype = "svg"
|
filetype = "svg"
|
||||||
fhandle = io.BytesIO(data)
|
fhandle = io.BytesIO(data)
|
||||||
tree = ElementTree()
|
tree = ElementTree()
|
||||||
|
Loading…
Reference in New Issue
Block a user