Git Product home page Git Product logo

clipshare's Introduction

ClipShare

A Blazor WebAssembly SPA app for sharing your clipboard across devices.

Build Status

Building

  • Clone the repo: git clone https://github.com/lucent-sea/ClipShare.
  • Build and run ClipShare.Server in Visual Studio 2019.
    • If using VS Code, open a terminal in the ClipShare.Server project folder.
    • Run dotnet build, then dotnet run.
  • Site can be accessed at https://localhost:5001.

Deploying

Here's an example appsettings.Production.json file that uses the site's TLS/SSL certificate:

{
    "Logging": {
        "LogLevel": {
            "Default": "Information",
            "Microsoft": "Warning",
            "Microsoft.Hosting.Lifetime": "Information"
        }
    },
    "IdentityServer": {
        "Key": {
            "Type": "Store",
            "StoreName": "WebHosting",
            "StoreLocation": "LocalMachine",
            "Name": "CN=clipshare.example.com"
        }
    }
}

Blazor Component Examples

I decided not to use any component libraries so I could learn how I might create them by hand. Here are some examples to look at in the projects.

Toasts

I created a singleton service for showing toast notifications. They are temporarily cached in the service and rendered by the component.

Files:

  • ClipShare.Client/Services/ToastService.cs
  • ClipShare.Client/Components/ToastHarness.cs
  • ClipShare.Client/Models/Toast.cs.

Modals

Modals are used directly as components. They have parameters for header, child content, and functions for when the modal is cancelled/okayed.

Files:

  • ClipShare.Client/Components/Modal.razor.

Database Logger

The built-in logging for ASP.NET Core via the ILogger interface has logging providers for Debug, Console, and Windows Event Log. To add file or database logging, you have to implement your own provider.

The Server project shows how to implement a logger that writes to an Entity Framework Core ApplicationDbContext.

Notice in the implemented DbLogger.Log method, IServiceProvider.CreateScope is used. This is necessary to consume the scoped IDataService (which depends on ApplicationDbContext) within a singleton service.

Files:

  • ClipShare.Server/Services/DbLogger.cs.
  • ClipShare.Server/Services.DbLoggerProvider.cs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.