Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cake-bot
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Oleksandr Barabash
cake-bot
Commits
e1e10718
Commit
e1e10718
authored
Oct 20, 2022
by
Oleksandr Barabash
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teams app zip generator fixed
parent
3940f573
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
7 deletions
+17
-7
app.py
app.py
+4
-2
config.py
config.py
+2
-1
azure_key_vault_client.py
utils/azure_key_vault_client.py
+2
-2
teams_app_generator.py
utils/teams_app_generator.py
+9
-2
No files found.
app.py
View file @
e1e10718
...
...
@@ -23,6 +23,7 @@ from entities.json.notification import Notification
from
utils.cosmos_client
import
ItemNotFound
from
utils.json_func
import
json_loads
from
utils.log
import
Log
from
utils.teams_app_generator
import
TeamsAppGenerator
app_config
=
AppConfig
()
...
...
@@ -174,9 +175,10 @@ async def v1_health_check(_request: Request) -> Response:
raise
async
def
get_app_zip
(
request
:
Request
)
->
FileResponse
:
async
def
get_app_zip
(
_
request
:
Request
)
->
FileResponse
:
""" Get zip file """
Log
.
i
(
TAG
,
"v1_health_check::ok"
)
await
TeamsAppGenerator
.
generate_zip
()
return
FileResponse
(
path
=
TeamsAppConfig
.
zip_file
)
...
...
@@ -203,7 +205,7 @@ APP.router.add_get("/api/v1/notification/{notification_id}",
v1_get_notification
)
APP
.
router
.
add_get
(
"/api/v1/initiations/{notification_id}"
,
v1_get_initiations
)
APP
.
router
.
add_get
(
"/api/v1/health-check"
,
v1_health_check
)
APP
.
router
.
add_get
(
"/
app.zip"
,
get_app_zip
)
APP
.
router
.
add_get
(
"/
{}"
.
format
(
TeamsAppConfig
.
zip_name
)
,
get_app_zip
)
BOT
.
add_web_app
(
APP
)
...
...
config.py
View file @
e1e10718
...
...
@@ -18,7 +18,8 @@ class TeamsAppConfig:
manifest
=
os
.
path
.
join
(
teams_app_items
,
"manifest,json"
)
image_192x192
=
os
.
path
.
join
(
teams_app_items
,
"color_192x192.png"
)
image_32x32
=
os
.
path
.
join
(
teams_app_items
,
"outline_32x32.png"
)
zip_file
=
os
.
path
.
join
(
teams_app_items
,
"app.zip"
)
zip_name
=
"app.zip"
zip_file
=
os
.
path
.
join
(
teams_app_items
,
zip_name
)
class
TaskModuleConfig
:
...
...
utils/azure_key_vault_client.py
View file @
e1e10718
...
...
@@ -31,9 +31,9 @@ class AzureKeyVaultClient:
self
.
secret_client
=
SecretClient
(
vault_url
=
self
.
key_vault_uri
,
credential
=
self
.
credential
)
async
def
execute_blocking
(
self
,
bl
,
*
args
):
def
execute_blocking
(
self
,
bl
,
*
args
):
""" Execute blocking code """
return
await
self
.
io_loop
.
run_in_executor
(
self
.
executor
,
bl
,
*
args
)
return
self
.
io_loop
.
run_in_executor
(
self
.
executor
,
bl
,
*
args
)
def
set_secret
(
self
,
name
:
str
,
value
:
str
)
->
Awaitable
[
"KeyVaultSecret"
]:
""" Async set secret """
...
...
utils/teams_app_generator.py
View file @
e1e10718
""" Teams App Generator """
import
asyncio
import
json
import
os
from
zipfile
import
ZipFile
,
ZIP_DEFLATED
...
...
@@ -87,8 +88,8 @@ class TeamsAppGenerator:
return
TeamsAppConfig
.
manifest
@staticmethod
def
ge
t_zip
():
""" Generate
the app
"""
def
ge
nerate_zip_bl
():
""" Generate
zip blocking
"""
TeamsAppGenerator
.
gen_manifest
()
with
ZipFile
(
TeamsAppConfig
.
zip_file
,
"w"
,
ZIP_DEFLATED
)
as
zip_file
:
for
file
in
[
TeamsAppConfig
.
manifest
,
...
...
@@ -96,3 +97,9 @@ class TeamsAppGenerator:
TeamsAppConfig
.
image_192x192
]:
file_name
=
os
.
path
.
basename
(
file
)
zip_file
.
write
(
file
,
arcname
=
file_name
)
@staticmethod
async
def
generate_zip
():
""" Generate the app """
io_loop
=
asyncio
.
get_event_loop
()
await
io_loop
.
run_in_executor
(
None
,
TeamsAppGenerator
.
generate_zip_bl
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment