mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 22:12:03 +00:00
Initial backend hosting implementation
This commit is contained in:
@@ -93,6 +93,7 @@ class PluginManager:
|
|||||||
for route in list(self.web_app.router.routes()):
|
for route in list(self.web_app.router.routes()):
|
||||||
self.cors.add(route)
|
self.cors.add(route)
|
||||||
self.web_app.add_routes([static("/static", path.join(path.dirname(__file__), 'static'))])
|
self.web_app.add_routes([static("/static", path.join(path.dirname(__file__), 'static'))])
|
||||||
|
self.web_app.add_routes([static("/locales", path.join(path.dirname(__file__), 'locales'))])
|
||||||
self.web_app.add_routes([static("/legacy", path.join(path.dirname(__file__), 'legacy'))])
|
self.web_app.add_routes([static("/legacy", path.join(path.dirname(__file__), 'legacy'))])
|
||||||
|
|
||||||
def exception_handler(self, loop, context):
|
def exception_handler(self, loop, context):
|
||||||
@@ -101,6 +102,7 @@ class PluginManager:
|
|||||||
loop.default_exception_handler(context)
|
loop.default_exception_handler(context)
|
||||||
|
|
||||||
async def get_auth_token(self, request):
|
async def get_auth_token(self, request):
|
||||||
|
|
||||||
return Response(text=get_csrf_token())
|
return Response(text=get_csrf_token())
|
||||||
|
|
||||||
async def load_plugins(self):
|
async def load_plugins(self):
|
||||||
|
|||||||
@@ -6,6 +6,33 @@ i18next
|
|||||||
.use(Backend)
|
.use(Backend)
|
||||||
.use(initReactI18next)
|
.use(initReactI18next)
|
||||||
.init({
|
.init({
|
||||||
|
backend:{
|
||||||
|
// path where resources get loaded from, or a function
|
||||||
|
// returning a path:
|
||||||
|
// function(lngs, namespaces) { return customPath; }
|
||||||
|
// the returned path will interpolate lng, ns if provided like giving a static path
|
||||||
|
// the function might return a promise
|
||||||
|
// returning falsy will abort the download
|
||||||
|
//
|
||||||
|
// If allowMultiLoading is false, lngs and namespaces will have only one element each,
|
||||||
|
// If allowMultiLoading is true, lngs and namespaces can have multiple elements
|
||||||
|
loadPath: 'http://127.0.0.1:1337/locales/{{lng}}/{{ns}}.json',
|
||||||
|
|
||||||
|
// your backend server supports multiloading
|
||||||
|
// /locales/resources.json?lng=de+en&ns=ns1+ns2
|
||||||
|
// Adapter is needed to enable MultiLoading https://github.com/i18next/i18next-multiload-backend-adapter
|
||||||
|
// Returned JSON structure in this case is
|
||||||
|
// {
|
||||||
|
// lang : {
|
||||||
|
// namespaceA: {},
|
||||||
|
// namespaceB: {},
|
||||||
|
// ...etc
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
allowMultiLoading: false, // set loadPath: '/locales/resources.json?lng={{lng}}&ns={{ns}}' to adapt to multiLoading
|
||||||
|
|
||||||
|
reloadInterval: false // can be used to reload resources in a specific interval (useful in server environments)
|
||||||
|
},
|
||||||
debug: true,
|
debug: true,
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
fallbackNS: 'Common',
|
fallbackNS: 'Common',
|
||||||
@@ -13,6 +40,7 @@ i18next
|
|||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false,
|
escapeValue: false,
|
||||||
},
|
},
|
||||||
|
load: 'languageOnly'
|
||||||
});
|
});
|
||||||
|
|
||||||
export default i18next;
|
export default i18next;
|
||||||
|
|||||||
Reference in New Issue
Block a user