{"id":23819818,"url":"https://github.com/kth/kth-node-cortina-block","last_synced_at":"2025-09-07T02:30:46.773Z","repository":{"id":55902632,"uuid":"67220896","full_name":"KTH/kth-node-cortina-block","owner":"KTH","description":"Node.js module for fetching Cortina blocks and optionally cache using Redis.","archived":false,"fork":false,"pushed_at":"2025-08-01T05:00:23.000Z","size":713,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-08-12T23:58:13.164Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KTH.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-09-02T12:31:07.000Z","updated_at":"2025-07-10T13:18:27.000Z","dependencies_parsed_at":"2024-01-17T11:49:20.362Z","dependency_job_id":"4bc076df-6291-4f0f-8d2e-cca4d3d05a71","html_url":"https://github.com/KTH/kth-node-cortina-block","commit_stats":{"total_commits":208,"total_committers":15,"mean_commits":"13.866666666666667","dds":0.7932692307692308,"last_synced_commit":"0eaa7fd8bbb70282ef7fd41ab377ceaea48258b2"},"previous_names":[],"tags_count":45,"template":false,"template_full_name":null,"purl":"pkg:github/KTH/kth-node-cortina-block","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-cortina-block","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-cortina-block/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-cortina-block/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-cortina-block/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KTH","download_url":"https://codeload.github.com/KTH/kth-node-cortina-block/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KTH%2Fkth-node-cortina-block/sbom","scorecard":{"id":76554,"data":{"date":"2025-08-11","repo":{"name":"github.com/KTH/kth-node-cortina-block","commit":"968013f00ca7dc273c322536a6d91fb0a9e843c8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: topLevel 'contents' permission set to 'write': .github/workflows/create-release.yaml:9","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":9,"reason":"11 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 1/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-15T04:59:24.664Z","repository_id":55902632,"created_at":"2025-08-15T04:59:24.665Z","updated_at":"2025-08-15T04:59:24.665Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273987273,"owners_count":25202842,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-02T07:15:50.808Z","updated_at":"2025-09-07T02:30:46.765Z","avatar_url":"https://github.com/KTH.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @kth/cortina-block\n\nThis package exposes an express middleware, that fetches som predefined blocks from Cortina CMS.  \nThe blocks are then stored in `res.locals.blocks`, for use in Handlebars or similar.  \nBlocks can optionaly be cached in Redis.\n\n## Installation\n\n```bash\nnpm install @kth/cortina-block\n```\n\n## Usage\n\n```typescript\nimport { cortinaMiddleware } from '@kth/cortina-block'\n```\n\napply middleware\n\n```typescript\nserver.use(\n  '',\n  cortinaMiddleware({\n    blockApiUrl,\n    blocksConfig,\n    redisConfig,\n  })\n)\n```\n\nDefault blocks that will be fetched can be found in config.ts. If you want to fetch other blocks or override the id of the default blocks, provide the optional `blocksConfig`.\n\n## Options\n\n- `blockApiUrl` is required. Should point to the Cortina block API endpoint.\n- `memoryCache` is optional. Defaults to \"true\" unless `redisConfig` is provided. Stores blocks in memory for 10 minutes.\n- `redisConfig` is optional. An object parsed from `kth-node-configuration`, containing `host` and `port`. If provided, blocks will be cached in redis.\n- `redisKey` is optional. Use unique keys of multiple apps share the same redis.\n- `supportedLanguages` is optional. If app only uses a subset of the supported languages. Default is `['sv', 'en']`.\n- `blocksConfig` is optional. It's a plain object containing Cortina block IDs. It can be used both to replace existing id's, and to add new blocks.\n  ```typescript\n  const blocksConfig = {\n    footer: '1.123456', // Replaces existing block\n    studentMegaMenu: '1.1066510', // Adds a new block\n  }\n  ```\n\n## Changes after style 10\n\nBlocks **title**, **image** and **secondaryMenu** are no longer used by the apps.  \nThat also means that a bunch of config is no longer needed.\n\n## Upgrade from @kth/cortina-block 6\n\n- Config **headers** is no longer used.\n- Config **localeText** is no longer used.\n- Config **resourceUrl** is no longer used.\n- Config **siteName** is no longer used.\n- Config **useStyle10** is no longer used.\n\n## Upgrade from wrapper in @kth/kth-node-web-common\n\n- Config **addBlocks** has been renamed to **blocksConfig**.\n- Config **blockUrl** has been renamed to **blockApiUrl**.\n- Config **blockVersion** is no longer used.\n- Config **globalLink** is no longer used.\n- Config **hostUrl** is no longer used.\n- Config **proxyPrefixPath** is no longer used.\n- Config **useStyle10** is no longer used.\n\n## Returned blocks\n\nAll fetched blocks will be avalible on `res.locals.blocks`.\n\n```typescript\n{\n  megaMenu: \"\\n\\n\\n\\n  \u003cnav class=\\\"b…\\n     \u003c/nav\u003e\\n\\n  \\n\\n\",\n  footer: \"\\n\\n\\n  \u003cdiv class=\\\"blo…  \u003c/div\u003e\\n  \u003c/div\u003e\\n\\n\\n\",\n  search: \"\\n\\n\\n  \u003cdiv class=\\\"blo…aded=!0);\u003c/script\u003e\\n\\n\\n\",\n  etc..\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkth-node-cortina-block","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkth%2Fkth-node-cortina-block","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkth%2Fkth-node-cortina-block/lists"}