Esempio n. 1
0
class App(App):
    name = 'Alumni図鑑'
    description = ''
    router = Router([
        view("/static/<path:path>", static_files()),
        view("/create", ProfileController, 'start_create'),
        view("/create/first", ProfileController, 'first_create'),
        view("/create/second", ProfileController, 'second_create'),
        view("/create/third", ProfileController, 'third_create'),
        view("/create/fin", ProfileController, 'fin_create'),
        Router([
            view("/", ProfileController),
            view("/register", ProfileController, 'register'),
            view("/search", ProfileController, 'search'),
            view("/<id>", ProfileController, 'retrieve'),
        ],
               middlewares=[SessionMiddleware]),
    ],
                    middlewares=[CsrfMiddleware])

    @property
    def view(self):
        view = super().view
        view.globals["CONTACT_OPTION_TYPES"] = CONTACT_OPTION_TYPES
        view.globals["CAREER_TYPES"] = CAREER_TYPES
        view.globals["CAREER_TYPES_FLAT"] = CAREER_TYPES_FLAT
        return view
Esempio n. 2
0
class App(App):
    # name = 'MyApp'
    # description = 'This is my App.'
    router = Router([
        view("/", WelcomeController),
        view("/static/<path:path>", static_files()),
    ])
Esempio n. 3
0
 def router(self):
     return Router(
         [
             view("/static/<path:path>", static_files()),
             view("/favicon.ico", mitama_favicon()),
             view("/sw.js", mitama_service_worker()),
             view("/manifest.json", mitama_manifest()),
             Router(
                 [
                     view("/setup", RegisterController, "setup"),
                     view("/signup", RegisterController, "signup"),
                     view("/login", SessionController, "login"),
                     Router(
                         [
                             view("/", HomeController),
                             view("/settings", HomeController, "settings"),
                             view("/logout", SessionController, "logout"),
                             view("/users", UsersController, "list"),
                             view("/users/invite", UsersController, "create"),
                             view("/users/invite/<id>/delete", UsersController, "cancel"),
                             view("/users/<id>", UsersController, "retrieve"),
                             view("/users/<id>/settings", UsersController, "update_profile"),
                             view("/users/<id>/settings/profile", UsersController, "update_profile"),
                             view("/users/<id>/settings/password", UsersController, "update_password"),
                             view("/users/<id>/settings/notification", UsersController, "update_notification"),
                             view("/users/<id>/delete", UsersController, "delete"),
                             view("/groups", GroupsController, "list"),
                             view("/groups/create", GroupsController, "create"),
                             view("/groups/<id>", GroupsController, "retrieve"),
                             post("/groups/<id>/append", GroupsController, "append"),
                             view("/groups/<id>/groups/<gid>/remove", GroupsController, "remove_group"),
                             view("/groups/<id>/users/<uid>/remove", GroupsController, "remove_user"),
                             view(
                                 "/groups/<id>/users/<uid>/accept",
                                 GroupsController,
                                 "accept",
                             ),
                             view(
                                 "/groups/<id>/users/<uid>/forbit",
                                 GroupsController,
                                 "forbit",
                             ),
                             view("/groups/<id>/settings", GroupsController, "update"),
                             view("/groups/<id>/delete", GroupsController, "delete"),
                             view("/apps", AppsController, "list"),
                             view("/apps/settings", AppsController, "update"),
                             view("/acs/post<hoge:re:.*>", ACSController, "post"),
                             view("/acs/redirect<hoge:re:.*>", ACSController, "redirect"),
                             view("/slo/post<hoge:re:.*>", SLOController, "post"),
                             view("/slo/redirect<hoge:re:.*>", SLOController, "redirect"),
                         ],
                         middlewares=[InitializeMiddleware, SessionMiddleware],
                     ),
                 ],
                 middlewares=[CsrfMiddleware]
             )
         ]
     )
Esempio n. 4
0
    def router(self):
        """アプリの情報に基づいてルーティングエンジンを生成します"""

        from mitama.app.method import view
        from mitama.utils.controllers import static_files
        if self._router is None:
            app_mod_dir = Path(os.path.dirname(__file__))
            router = Router([
                view("/_mitama/<path:path>",
                     static_files(app_mod_dir / "static"))
            ],
                            middlewares=[_session_middleware()])
            for app in self:
                router.add_route(group(app.path, app))
            self._router = router
        return self._router
Esempio n. 5
0
class App(App):
    name = 'Izanami'
    description = 'Git server for Mitama.'
    models = [Repo, Merge, InnerPermission]
    router = Router([
        view("/static/<path:path>", static_files()),
        Router([
            view("/<repo:re:(.*)\.git>/<path:path>", ProxyController),
        ],
               middlewares=[BasicMiddleware]),
        Router([
            view("/", RepoController),
            view("/create", RepoController, 'create'),
            view("/settings", SettingController),
            view("/<repo>", RepoController, 'retrieve'),
            view("/<repo>/update", RepoController, 'update'),
            view("/<repo>/delete", RepoController, 'delete'),
            view("/<repo>/tree/<head>", RepoController, 'retrieve'),
            view("/<repo>/blob/<head>/<object:path>", RepoController, 'blob'),
            view("/<repo>/commit/<commit>", RepoController, 'commit'),
            view("/<repo>/log", RepoController, 'log'),
            view("/<repo>/log/<head>", RepoController, 'log'),
            view("/<repo>/merge", MergeController),
            view("/<repo>/merge/create", MergeController, 'create'),
            view("/<repo>/merge/<merge>", MergeController, 'retrieve'),
            view("/<repo>/hook", HookController),
            view("/<repo>/hook/create", HookController, 'create'),
            view("/<repo>/hook/<hook>", HookController, 'retrieve'),
            view("/<repo>/hook/<hook>/edit", HookController, 'update'),
            view("/<repo>/hook/<hook>/delete", HookController, 'delete'),
        ],
               middlewares=[SessionMiddleware, CsrfMiddleware])
    ])

    def init_app(self):
        Repo.project_dir = self.project_dir

    @property
    def view(self):
        view = super().view
        view.globals.update(
            isblob=isblob,
            permission=InnerPermission.is_accepted,
        )
        return view
Esempio n. 6
0
class App(App):
    name = 'QOOL Board'
    description = '情報の整理とスムーズな議論を両立するチャットシステム'
    router = Router([
        group('/api', Router([
            post('/boards', BoardController, 'create'),
            get('/boards', BoardController, 'list'),
            get('/boards/<id>', BoardController, 'retrieve'),
            put('/boards/<id>', BoardController, 'update'),
            delete('/boards/<id>', BoardController, 'delete'),
            post('/boards/<id>', PostController, 'create'),
            delete('/boards/<id>/<pid>', PostController, 'delete'),
            put('/boards/<id>/<pid>', PostController, 'update'),
            retrieve_api_router(),
            get('/groups/<id>/boards', BoardController, 'group'),
            get('/users/<id>/boards', BoardController, 'user'),
        ])),
        view('/static/<path:path>', static_files()),
        view('/<path:re:(.*)>', HomeController),
    ], middlewares = [SessionMiddleware])
Esempio n. 7
0
class App(App):
    name = 'Alumni図鑑'
    description = ''
    router = Router(
        [
            view("/static/<path:path>", static_files()),
            view("/create", ProfileController, 'create'),
            Router([
                view("/", ProfileController),
                view("/register", ProfileController, 'register'),
                view("/search", ProfileController, 'search'),
                view("/<id>", ProfileController, 'retrieve'),
            ], middlewares = [SessionMiddleware]),
        ],
        middlewares = [CsrfMiddleware]
    )
    @property
    def view(self):
        view = super().view
        return view
Esempio n. 8
0
class App(App):
    name = 'MyApp'
    description = 'This is my App.'
    router = Router([
        view("<path:path>", static_files()),
    ])