npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@capytale/capytale-anti-triche

v0.2.1

Published

Capytale anti-cheat.

Downloads

101

Readme

Capytale anti-cheat

Capytale anti-cheat.

Test

npm install
npm run dev

Build

npm install
npm run build

How to use

Import

import {
  CapytaleAntiCheat,
  ContentHidingMethod,
  ExitDetectionMethod,
} from "@capytale/capytale-anti-cheat";

Use

<CapytaleAntiCheat
// props
>
  Content to protect
</CapytaleAntiCheat>

Mandatory props

Related to the activity

  • isDirty (boolean): When true, indicates that the activity has not been saved by the student: this shows a warning before the link allowing the student to leave the activity.
  • startLocked (boolean): Whether the activity should start locked. If set to true, the activity will have to be unlocked before the student is able to see the content. This is intended to be used when the activity has already been opened by the student before.

Related to the anti-cheat

  • enabled (boolean): Whether the anti-cheat is enabled. If set to false, the content will be rendered directly.
  • contentHidingMethod (enum ContentHidingMethod): The method used to hide the content. Possible values are ContentHidingMethod.REMOVE_FROM_DOM (0) and ContentHidingMethod.DISPLAY_NONE (1).
  • exitDetectionMethod (enum ExitDetectionMethod): The method used to detect exits. Possible values are ExitDetectionMethod.BLUR (0) and ExitDetectionMethod.VISIBILITY_CHANGE (1).
  • disableExitDetection (boolean): Whether to disable exit detection. If set to true, the user will be able to exit the activity without being flagged as cheating.
  • lockDelayMs (number): The delay (in milliseconds) before the activity is locked. This is intended to allow the program to disable the exit detection if the focus went to an iframe controlled by the activity, for example.
  • hashedPassword (string): The hashed password of the user (using the Bcrypt algorithm).

Related to the server

  • dbTouchFunction (() => Promise<any>): The function to call when the user is about to start the activity for the first time, intended to set a flag in the database to remember that the user has started the activity. This function must return a promise that resolves when the flag has been set. If the promise rejects, the activity will not be rendered.

Optional props

Related to the activity

  • activityTitle (string): The title of the activity.
  • studentName (string): The name of the student.
  • returnUrl (string): The URL to lead the student to when they exit the activity.

Related to the server

  • dbTouchTimeoutMs (number): The timeout (in milliseconds) for the promise returned when dbTouchFunction is called (default: 10000). If the promise does not resolve before the timeout, the promise will be considered rejected.

Related to styling

  • antiCheatClassName (string): The class name of the anti-cheat container.
  • contentClassName (string): The class name of the content container.

// Mandatory parameters activityTitle={activityTitle} contentHidingMethod={contentHidingMethod} dbTouchFunction={dbTouchFunction} disableExitDetection={disableExitDetection} enabled={true} exitDetectionMethod={exitDetectionMethod} hashedPassword={hashedPassword} isDirty={isDirty} lockDelayMs={lockDelayMs} startLocked={startLocked} studentName={studentName} // Optional parameters antiCheatClassName="anti-cheat" contentClassName="content" returnUrl={hasReturnUrl ? returnUrl : undefined}