Skip to content

lightship-core/lightship-rfc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

Lightship RFC

The RFC all implementations can follow to facilitate porting.

Summary

1. Root

This is the top-level content in the report. This is an array of Report.

Example:

[
  {
    "url": "https:\/\/example.com\/",
    "durationInSeconds": 0.48,
    "scores": {
      "seo": 100,
      "security": 50,
      "performance": 100,
      "accessibility": 61
    },
    "seo": [
      {
        "name": "titlePresent",
        "passes": true
      },
      {
        "name": "langPresent",
        "passes": true,
      }
    ],
    "security": [
      {
        "name": "serverHeaderHidden",
        "passes": false
      },
      {
        "name:" "xFrameOptionHeaderPresent",
        "passes": true
      }
    ],
    "performance": [
      {
        "name": "textCompressionEnabled",
        "passes": true
      },
      {
        "name": "fastResponseTime",
        "passes": true,
      }
    ],
    "accessibility": [
      {
        "name": "metaViewportPresent",
        "passes": true,
      },
      {
        "name:" "useLandmarkTags",
        "passes": true
      },
      {
        "name": "buttonsAndLinksHaveAccessibleName",
        "passes": false,
        "items": [
          {
            "identifier": "<button id=\"login\"></button>"
          },
          {
            "identifier": "<a class=\"fa fas-home\"></a>"
          }
        ]
      }
    ]
  }
]

1.1. Report

A report is the summary of the analysis for a single page.

interface Report {
  url: string,
  durationInSeconds: number,
  scores: Score,
  seo: RuleResult[],
  security: RuleResult[]
}

Example:

{
    "url": "https:\/\/example.com\/",
    "durationInSeconds": 0.48,
    "scores": {
      "seo": 100,
      "security": 50,
      "performance": 100,
      "accessibility": 61
    },
    "seo": [
      {
        "name": "titlePresent",
        "passes": true
      },
      {
        "name": "langPresent",
        "passes": true,
      }
    ],
    "security": [
      {
        "name": "serverHeaderHidden",
        "passes": false
      },
      {
        "name:" "xFrameOptionHeaderPresent",
        "passes": true
      }
    ],
    "performance": [
      {
        "name": "textCompressionEnabled",
        "passes": true
      },
      {
        "name": "fastResponseTime",
        "passes": true,
      }
    ],
    "accessibility": [
      {
        "name": "metaViewportPresent",
        "passes": true,
      },
      {
        "name:" "useLandmarkTags",
        "passes": true
      },
      {
        "name": "buttonsAndLinksHaveAccessibleName",
        "passes": false,
        "items": [
          {
            "identifier": "<button id=\"login\"></button>"
          },
          {
            "identifier": "<a class=\"fa fas-home\"></a>"
          }
        ]
      }
    ]
  }

1.2. Score

Represents all the audits scores.

interface Score {
  seo: number,
  security: number,
  performance: number,
  accessibility: number
}

Example:

{
  "seo": 100,
  "security": 75,
  "performance": 100,
  "accessibility": 61
}

1.3. RuleResult

Represents a rule and its result.

interface RuleResult {
  name: string,
  passes: boolean,
  items?: Item[]
}

1.4. Item

Represents an item that failed to pass a rule.

interface Item {
  identifier: string,
  error?: string
}

Example:

{
  "identifier": "<div id=\"item-12\"></div>",
  "error": "Duplicated with <div id=\"item-12\" class=\"bg-warning d-none\"></div>"
}

2. Configuration file

Lightship implementations should be able to parse a configuration file to run the web crawler as an alternative to a code-driven execution.

The default name cli-tools can seek for should be "lightship.json".

interface Configuration {
  domains: Domain[],
  routes: Route[]
}

Example:

{
  "domains": [
    {
      "base": "https://example.com",
      "routes": [
        {
          "path": "/"
        },
        {
          "path": "/register"
        }
      ]
    }
  ],
  "routes": [
    {
      "path": "https://news.google.com/topstories"
    }
  ]
}

2.1. Domain

Represent a base path to easily specify all the routes that share the same domain.

interface Domain {
  base: string,
  routes: Route[]
}

Example:

{
  "base": "https://example.com",
  "routes": [
    {
      "path": "/",
    },
    {
      "path": "/register",
      "queries": [
        {
          "key": "utm-source",
          "value": "mailing"
        }
      ]
    }
  ]
}

2.2. Route

The route represents either a relative path to a domain, or an absolute path (with the base).

interface Route {
  path: string,
  queries?: Query[]
}

Example:

{
  "path": "/account",
  "queries": [
    {
      "key": "theme",
      "value": "dark"
    }
  ]
}

2.3. Query

Represent a query string.

interface Query {
  key: string,
  value: string
}

Example:

{
  "key": "lang",
  "value": "en"
}

3. Rules

The list of rules classified by category.

3.1. Seo

3.1.1. Title present

Passes if the HTML title tag is present and filled.

Value: 25

3.1.2. Lang present

Passes if the lang attribute on the HTML html tag is present and filled.

Value: 25

3.1.3. Links define href

Passes if all "a" tags define a "href" attribute.

Value: 25

3.1.4. Meta description present

Passes if a <meta name="description" /> tag is present.

Value: 25

3.2. Security

3.2.1. Server header hidden

Passes if the "Server" header is not present or empty.

Value: 25

3.2.2. Strict-Transport-Security header present

Passes if the "Strict-Transport-Security" header is present and have a valid value.

Value: 25

3.2.3. X-Frame-Options header present

Passes if the "X-Frame-Options" header is present and have a valid value.

Value: 25

3.2.4. X-Powered-By header hidden

Passes if the "X-Powered-By" header is not present or empty.

Value: 25

3.3. Performance

3.3.1. Text compression enabled

Passes if the "content-encoding" header is present and defines one of "br", "gzip" or "deflate" decompressions.

Value: 25

3.3.2. Fast response time

Passes if the response time is under a second.

Value: 25

3.3.3. No redirects

Passes if the response was not hidden behind a redirection.

Value: 25

3.3.4. Uses HTTP/2

Passes if the response was served through HTTP/2.

Value: 25

3.4. Accessibility

3.4.1. Meta viewport present

Passes if the <meta name="viewport" /> is present and has a valid value (either "width" or "initial-scale").

Value: 14

3.4.2 Use landmark tags

Passes if the response contains either "main", "header", "nav", or "footer" tag elements.

Value: 14

3.4.3. Buttons and links use an accessible name

Passes if all buttons and "a" tags have a text or define an "aria-label" attribute.

Value: 15

3.4.4. Ids are unique

Passes if no duplicate "id" attribute is found.

Value: 15

3.4.5. Images have alt attributes

Passes if all images have an "alt" attribute.

Value: 14

3.4.6. doctype html present

Passes if the "<!DOCTYPE html>" declaration is present.

Value: 14

3.4.7. Meta theme color present

Passes if the content contains a <meta name="theme-color" />.

Value: 14

About

All the RFC for the Lightship protocol.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published