Merge branch 'develop' into feature/table-view

This commit is contained in:
Nikita Gopienko 2021-07-22 16:56:48 +03:00
commit 9b47aa8d4a
59 changed files with 2315 additions and 2013 deletions

View File

@ -34,8 +34,6 @@ using ASC.Common.Caching;
using ASC.Common.Logging;
using ASC.ElasticSearch.Service;
using Autofac;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
@ -49,7 +47,6 @@ namespace ASC.ElasticSearch
private ICacheNotify<AscCacheItem> Notify { get; }
private ICacheNotify<IndexAction> IndexNotify { get; }
private IServiceProvider ServiceProvider { get; }
public ILifetimeScope Container { get; }
private bool IsStarted { get; set; }
private CancellationTokenSource CancellationTokenSource { get; set; }
private Timer Timer { get; set; }
@ -60,14 +57,12 @@ namespace ASC.ElasticSearch
ICacheNotify<AscCacheItem> notify,
ICacheNotify<IndexAction> indexNotify,
IServiceProvider serviceProvider,
ILifetimeScope container,
Settings settings)
{
Log = options.Get("ASC.Indexer");
Notify = notify;
IndexNotify = indexNotify;
ServiceProvider = serviceProvider;
Container = container;
CancellationTokenSource = new CancellationTokenSource();
Period = TimeSpan.FromMinutes(settings.Period.Value);
}
@ -137,13 +132,19 @@ namespace ASC.ElasticSearch
Timer.Change(Timeout.Infinite, Timeout.Infinite);
IsStarted = true;
using var scope = Container.BeginLifetimeScope();
var wrappers = scope.Resolve<IEnumerable<IFactoryIndexer>>();
Parallel.ForEach(wrappers, w =>
using (var scope = ServiceProvider.CreateScope())
{
IndexProduct(w, reindex);
});
var wrappers = scope.ServiceProvider.GetService<IEnumerable<IFactoryIndexer>>();
Parallel.ForEach(wrappers, wrapper =>
{
using (var scope = ServiceProvider.CreateScope())
{
var w = (IFactoryIndexer)scope.ServiceProvider.GetService(wrapper.GetType());
IndexProduct(w, reindex);
}
});
}
Timer.Change(Period, Period);
IndexNotify.Publish(new IndexAction() { Indexing = "", LastIndexed = DateTime.Now.Ticks }, CacheNotifyAction.Any);

View File

@ -64,18 +64,15 @@ namespace ASC.Feed.Aggregator
private ConfigurationExtension Configuration { get; }
private IServiceProvider ServiceProvider { get; }
public ILifetimeScope Container { get; }
public FeedAggregatorService(
ConfigurationExtension configuration,
IServiceProvider serviceProvider,
ILifetimeScope container,
IOptionsMonitor<ILog> optionsMonitor,
IOptionsSnapshot<SignalrServiceClient> optionsSnapshot)
{
Configuration = configuration;
ServiceProvider = serviceProvider;
Container = container;
Log = optionsMonitor.Get("ASC.Feed.Agregator");
SignalrServiceClient = optionsSnapshot.Get("counters");
}
@ -129,8 +126,7 @@ namespace ASC.Feed.Aggregator
Log.DebugFormat("Start of collecting feeds...");
var unreadUsers = new Dictionary<int, Dictionary<Guid, int>>();
using var autofacScope = Container.BeginLifetimeScope();
var modules = autofacScope.Resolve<IEnumerable<IFeedModule>>();
var modules = scope.ServiceProvider.GetService<IEnumerable<IFeedModule>>();
foreach (var module in modules)
{

View File

@ -76,7 +76,7 @@ server {
location / {
proxy_pass http://localhost:5001;
expires 365d;
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
location ~* /(manifest.json|sw.js|appIcon.png|bg-error.png) {
expires 365d;
root $public_root;
try_files /$basename /index.html =404;
@ -87,6 +87,12 @@ server {
root $public_root;
try_files /images/$basename /index.html =404;
}
location ~* /static/fonts/ {
expires 365d;
root $public_root;
try_files /fonts/$basename /index.html =404;
}
location ~* /static/offline/ {
expires 365d;

8
config/workbox-config.js Normal file
View File

@ -0,0 +1,8 @@
module.exports = {
globDirectory: 'build/deploy/',
globPatterns: [
'**/*.{ico,woff2,svg,html,json,js,png}'
],
swSrc: 'packages/asc-web-common/utils/sw-template.js',
swDest: 'build/deploy/public/sw.js'
};

View File

@ -0,0 +1,11 @@
module.exports = {
globDirectory: 'build/deploy/',
globPatterns: [
'**/*.{ico,woff2,svg,html,json,js,png}'
],
ignoreURLParametersMatching: [
/^utm_/,
/^fbclid$/
],
swDest: 'build/deploy/public/sw.js'
};

View File

@ -18,6 +18,19 @@
"scripts": {
"wipe": "rimraf node_modules yarn.lock web/**/node_modules products/**/node_modules",
"build": "concurrently \"wsrun --parallel build\"",
"sw-build": "workbox injectManifest config/workbox-config.js && yarn sw-modify && yarn sw-minimize",
"sw-calendar-replace": "replace-in-files --string='products/ASC.Calendar/client/' --replacement='products/calendar/' build/deploy/public/sw.js",
"sw-crm-replace": "replace-in-files --string='products/ASC.CRM/client/' --replacement='products/crm/' build/deploy/public/sw.js",
"sw-files-replace": "replace-in-files --string='products/ASC.Files/client/' --replacement='products/files/' build/deploy/public/sw.js",
"sw-files-editor-replace": "replace-in-files --string='products/ASC.Files/editor/' --replacement='products/files/doceditor/' build/deploy/public/sw.js",
"sw-mail-replace": "replace-in-files --string='products/ASC.Mail/client/' --replacement='products/mail/' build/deploy/public/sw.js",
"sw-people-replace": "replace-in-files --string='products/ASC.People/client/' --replacement='products/people/' build/deploy/public/sw.js",
"sw-projects-replace": "replace-in-files --string='products/ASC.Projects/client/' --replacement='products/projects/' build/deploy/public/sw.js",
"sw-studio-replace": "replace-in-files --string='studio/client/' --replacement='/' build/deploy/public/sw.js",
"sw-studio-login-replace": "replace-in-files --string='studio/login/' --replacement='login/' build/deploy/public/sw.js",
"sw-public-replace": "replace-in-files --string='public/' --replacement='static/' build/deploy/public/sw.js",
"sw-modify": "yarn sw-calendar-replace && yarn sw-crm-replace && yarn sw-crm-replace && yarn sw-files-replace && yarn sw-files-editor-replace && yarn sw-mail-replace && yarn sw-people-replace && yarn sw-projects-replace && yarn sw-studio-replace && yarn sw-studio-login-replace && yarn sw-public-replace",
"sw-minimize": "yarn terser --compress --mangle -- build/deploy/public/sw.js --output build/deploy/public/sw.js",
"start": "concurrently \"wsrun --parallel start\"",
"start-prod": "concurrently \"wsrun --parallel start-prod\"",
"serve": "concurrently \"wsrun --parallel serve\"",
@ -26,12 +39,15 @@
"storybook": "yarn workspace @appserver/components storybook",
"storybook-build": "yarn workspace @appserver/components run storybook-build",
"bump": "lerna version --no-push --no-git-tag-version",
"deploy": "rimraf build/deploy && concurrently \"wsrun --parallel deploy\""
"deploy": "rimraf build/deploy && concurrently \"wsrun --parallel deploy\" && cp -r public build/deploy && yarn sw-build"
},
"devDependencies": {
"lerna": "^3.22.1",
"concurrently": "^5.3.0",
"wsrun": "^5.2.4",
"rimraf": "^3.0.2"
"lerna": "^3.22.1",
"replace-in-files-cli": "^1.0.0",
"rimraf": "^3.0.2",
"terser": "^5.7.1",
"workbox-cli": "^6.1.5",
"wsrun": "^5.2.4"
}
}

View File

@ -5,76 +5,70 @@ $font-family-base: "Open Sans", sans-serif;
font-family: "Open Sans";
font-weight: 300;
font-style: normal;
src: url("../../public/fonts/light/open-sans-light.woff2") format("woff2");
src: url("/static/fonts/open-sans-light.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: 300;
font-style: italic;
src: url("../../public/fonts/light-italic/open-sans-light-italic.woff2")
format("woff2");
src: url("/static/fonts/open-sans-light-italic.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: normal;
font-style: normal;
src: url("../../public/fonts/regular/open-sans-regular.woff2") format("woff2");
src: url("/static/fonts/open-sans-regular.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: normal;
font-style: italic;
src: url("../../public/fonts/italic/open-sans-italic.woff2") format("woff2");
src: url("/static/fonts/open-sans-italic.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: 600;
font-style: normal;
src: url("../../public/fonts/semibold/open-sans-semibold.woff2")
format("woff2");
src: url("/static/fonts/open-sans-semibold.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: 600;
font-style: italic;
src: url("../../public/fonts/semibold-italic/open-sans-semibold-italic.woff2")
format("woff2");
src: url("/static/fonts/open-sans-semibold-italic.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: bold;
font-style: normal;
src: url("../../public/fonts/bold/open-sans-bold.woff2") format("woff2");
src: url("/static/fonts/open-sans-bold.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: bold;
font-style: italic;
src: url("../../public/fonts/bold-italic/open-sans-bold-italic.woff2")
format("woff2");
src: url("/static/fonts/open-sans-bold-italic.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: 800;
font-style: normal;
src: url("../../public/fonts/extra-bold/open-sans-extra-bold.woff2")
format("woff2");
src: url("/static/fonts/open-sans-extra-bold.woff2") format("woff2");
}
@font-face {
font-family: "Open Sans";
font-weight: 800;
font-style: italic;
src: url("../../public/fonts/extra-bold-italic/open-sans-extra-bold-italic.woff2")
format("woff2");
src: url("/static/fonts/open-sans-extra-bold-italic.woff2") format("woff2");
}
html,

View File

@ -18,6 +18,7 @@
},
"dependencies": {
"global": "^4.4.0",
"react-selecto": "^1.12.0"
"react-selecto": "^1.12.0",
"workbox-window": "^6.1.5"
}
}

View File

@ -1,8 +1,8 @@
import { Workbox } from "workbox-window";
export function registerSW(homepage) {
export function registerSW() {
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
const wb = new Workbox(`${homepage}/sw.js`);
const wb = new Workbox(`/sw.js`);
//TODO: watch https://developers.google.com/web/tools/workbox/guides/advanced-recipes and https://github.com/webmaxru/prog-web-news/blob/5ff94b45c9d317409c21c0fbb7d76e92f064471b/src/app/app-shell/app-shell.component.ts

View File

@ -1,48 +1,36 @@
import {
precacheAndRoute,
cleanupOutdatedCaches,
//createHandlerBoundToURL,
} from "workbox-precaching";
import { setCacheNameDetails } from "workbox-core";
import { clientsClaim } from "workbox-core";
import { /*NavigationRoute,*/ registerRoute } from "workbox-routing";
import { googleFontsCache, imageCache, offlineFallback } from "workbox-recipes";
import {
//CacheFirst,
//NetworkFirst,
StaleWhileRevalidate,
} from "workbox-strategies";
//import { ExpirationPlugin } from "workbox-expiration";
//import { BroadcastUpdatePlugin } from "workbox-broadcast-update";
importScripts(
"https://storage.googleapis.com/workbox-cdn/releases/6.1.5/workbox-sw.js"
);
workbox.setConfig({
debug: true,
});
// This will trigger the importScripts() for workbox.strategies and its dependencies:
const { precacheAndRoute, cleanupOutdatedCaches } = workbox.precaching;
const { setCacheNameDetails, clientsClaim } = workbox.core;
const { registerRoute } = workbox.routing;
const { googleFontsCache, imageCache, offlineFallback } = workbox.recipes;
const { StaleWhileRevalidate } = workbox.strategies;
// SETTINGS
// Claiming control to start runtime caching asap
clientsClaim();
// Use to update the app after user triggered refresh (without prompt)
//self.skipWaiting();
// PRECACHING
// Setting custom cache name
setCacheNameDetails({ precache: "wb6-precache", runtime: "wb6-runtime" });
// We inject manifest here using "workbox-build" in workbox-inject.js
precacheAndRoute(self.__WB_MANIFEST);
const precachRoutes = self.__WB_MANIFEST;
precacheAndRoute(precachRoutes);
// Remove cache from the previous WB versions
cleanupOutdatedCaches();
// NAVIGATION ROUTING
// This assumes /index.html has been precached.
// const navHandler = createHandlerBoundToURL("/index.html");
// const navigationRoute = new NavigationRoute(navHandler, {
// denylist: [new RegExp("/out-of-spa/")], // Also might be specified explicitly via allowlist
// });
// registerRoute(navigationRoute);
// STATIC RESOURCES
googleFontsCache({ cachePrefix: "wb6-gfonts" });
@ -77,24 +65,3 @@ offlineFallback({
imageFallback: "/static/offline/offline.svg",
fontFallback: false,
});
// ALL OTHER EVENTS
// Receive push and show a notification
// self.addEventListener("push", function (event) {
// console.log("[Service Worker]: Received push event", event);
// var notificationData = {};
// if (event.data.json()) {
// notificationData = event.data.json();
// } else {
// notificationData = {
// title: "Something Has Happened",
// message: "Something you might want to check out",
// icon: "/assets/img/pwa-logo.png",
// };
// }
// self.registration.showNotification(notificationData.title, notificationData);
// });

View File

@ -35,8 +35,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
@ -91,17 +90,6 @@ var config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -194,14 +182,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -136,11 +136,6 @@ namespace ASC.CRM.ApiModels
Data = "support@onlyoffice.com",
InfoType = ContactInfoType.Email
};
}
public void Mapping(Profile profile)
{
profile.CreateMap<ContactInfo, ContactInfoDto>();
}
}
}
}

View File

@ -390,7 +390,7 @@ namespace ASC.CRM.Core.Dao
if (result > 0)
{
_cache.Insert(cacheKey, result, TimeSpan.FromSeconds(30));
_cache.Insert(cacheKey, result.ToString(), TimeSpan.FromSeconds(30));
}
return result;

View File

@ -326,7 +326,7 @@ namespace ASC.CRM.Core.Dao
}
if (result > 0)
{
_cache.Insert(cacheKey, result, TimeSpan.FromMinutes(1));
_cache.Insert(cacheKey, result.ToString(), TimeSpan.FromMinutes(1));
}
return result;

View File

@ -544,7 +544,7 @@ namespace ASC.CRM.Core.Dao
}
if (result > 0)
{
_cache.Insert(cacheKey, result, TimeSpan.FromSeconds(30));
_cache.Insert(cacheKey, result.ToString(), TimeSpan.FromSeconds(30));
}
return result;

View File

@ -397,7 +397,7 @@ namespace ASC.CRM.Core.Dao
if (result > 0)
{
_cache.Insert(cacheKey, result, TimeSpan.FromSeconds(30));
_cache.Insert(cacheKey, result.ToString(), TimeSpan.FromSeconds(30));
}
return result;
}

View File

@ -232,7 +232,7 @@ namespace ASC.CRM.Core.Dao
if (result > 0)
{
_cache.Insert(cacheKey, result, TimeSpan.FromSeconds(30));
_cache.Insert(cacheKey, result.ToString(), TimeSpan.FromSeconds(30));
}
return result;
}

View File

@ -512,7 +512,7 @@ namespace ASC.CRM.Core.Dao
if (result > 0)
{
_cache.Insert(cacheKey, result, TimeSpan.FromMinutes(1));
_cache.Insert(cacheKey, result.ToString(), TimeSpan.FromMinutes(1));
}
return result;

View File

@ -27,10 +27,13 @@
using System;
using ASC.Common.Mapping;
using ASC.CRM.ApiModels;
using ASC.CRM.Classes;
using ASC.CRM.Core.EF;
using ASC.CRM.Core.Enums;
using AutoMapper;
namespace ASC.CRM.Core
{
public class ContactInfo : DomainObject, IMapFrom<DbContactInfo>
@ -78,5 +81,12 @@ namespace ASC.CRM.Core
return typeof(ContactInfoBaseCategory);
}
}
public void Mapping(Profile profile)
{
profile.CreateMap<DbContactInfo, ContactInfo>()
.ForMember(x => x.InfoType, opt => opt.MapFrom(x => x.Type));
}
}
}

View File

@ -35,8 +35,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
@ -91,17 +90,6 @@ var config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -194,14 +182,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -39,8 +39,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
@ -91,17 +90,6 @@ var config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -199,14 +187,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -165,7 +165,11 @@ namespace ASC.Web.Files.Core.Search
j = 0;
}
}
}
if(tasks.Any())
{
Task.WaitAll(tasks.ToArray());
}
}
catch (Exception e)

View File

@ -153,7 +153,11 @@ namespace ASC.Web.Files.Core.Search
j = 0;
}
}
}
if (tasks.Any())
{
Task.WaitAll(tasks.ToArray());
}
}
catch (Exception e)

View File

@ -35,8 +35,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
@ -91,17 +90,6 @@ var config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -194,14 +182,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -35,8 +35,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
@ -91,17 +90,6 @@ var config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -203,14 +191,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -35,8 +35,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import App from "./App";
import React from "react";
import ReactDOM from "react-dom";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
@ -91,17 +90,6 @@ var config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -194,14 +182,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -1,111 +0,0 @@
const precacheVersion = 1;
const precacheName = 'precache-v' + precacheVersion;
const precacheFiles = [
'/',
'/bg-error.png',
'/api/2.0/modules',
'/api/2.0/people/info.json',
'/api/2.0/people/@self.json',
'/api/2.0/settings.json',
];
self.addEventListener('install', (e) => {
self.skipWaiting();
e.waitUntil(
caches.open(precacheName).then((cache) => {
return cache.addAll(precacheFiles);
})
);
});
self.addEventListener('activate', (e) => {
e.waitUntil(
caches.keys().then((cacheNames) => {
return Promise.all(cacheNames.map((thisCacheName) => {
if (thisCacheName.includes("precache") && thisCacheName !== precacheName) {
console.log('[ServiceWorker] Removing cached files from old cache - ', thisCacheName);
return caches.delete(thisCacheName);
}
}));
})
);
});
self.addEventListener('fetch', (e) => {
e.respondWith(
fetch(e.request)
.then((fetchResponse) => {
e.waitUntil(
update(e.request).then(refresh)
);
return fetchResponse;
})
.catch((err) => {
return caches.match(e.request)
.then((cachesResponse) =>{
if(cachesResponse){
return cachesResponse;
}else{
return useFallback();
}
})
})
);
});
function update(request) {
return caches.open(precacheName).then((cache) =>
{
caches.match(request).then((cachesResponse) => {
if(cachesResponse){
fetch(request).then((response) =>
cache.put(request, response.clone()).then(() => response)
).catch((err) => console.log(`[ServiceWorker] ${err}`));
}
})
}
);
}
const fallback =
'<div style="cursor: default;background: url(/bg-error.png);width: 100%;height: 310px;padding: 315px 0 0;background-repeat: no-repeat;background-position: 50%;'+
'margin-top: -325px;'+
'position: absolute;'+
'left: 0;'+
'top: 50%;'+
'z-index: 1;">'+
'<div style="width: 310px;'+
'margin: 0 auto;'+
'padding-left: 38px;'+
'text-align: center;'+
'font: normal 24px/35px Tahoma;'+
'color: #275678;'+
'position: relative;">\n'+
'<p>No internet connection found.</p>\n'+
'</div>\n'+
'</div>';
function useFallback() {
return Promise.resolve(new Response(fallback, { headers: {
'Content-Type': 'text/html; charset=utf-8'
}}));
}
function refresh(response) {
//Send data update messages to all clients
/*return self.clients.matchAll().then((clients) => {
clients.forEach((client) => {
const message = {
type: 'refresh',
url: response.url,
eTag: response.headers.get('ETag')
};
client.postMessage(JSON.stringify(message));
});
});*/
}

View File

@ -34,8 +34,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
@ -89,17 +88,6 @@ const config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -215,15 +203,6 @@ module.exports = (env, argv) => {
}),
],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -34,8 +34,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.13.9",

View File

@ -1,9 +1,8 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const { proxyURL } = AppServerConfig;
@ -93,17 +92,6 @@ const config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -197,14 +185,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

View File

@ -35,8 +35,7 @@
"terser-webpack-plugin": "^5.1.1",
"webpack": "5.14.0",
"webpack-cli": "4.5.0",
"webpack-dev-server": "3.11.2",
"workbox-webpack-plugin": "^6.1.1"
"webpack-dev-server": "3.11.2"
},
"dependencies": {
"@babel/runtime": "^7.12.5",

View File

@ -1,9 +1,8 @@
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import config from "../package.json";
import { registerSW } from "@appserver/common/utils/sw-helper";
ReactDOM.render(<App />, document.getElementById("root"));
registerSW(config.homepage);
registerSW();

View File

@ -4,7 +4,6 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const ModuleFederationPlugin = require("webpack").container
.ModuleFederationPlugin;
const TerserPlugin = require("terser-webpack-plugin");
const { InjectManifest } = require("workbox-webpack-plugin");
const combineUrl = require("@appserver/common/utils/combineUrl");
const AppServerConfig = require("@appserver/common/constants/AppServerConfig");
const { proxyURL } = AppServerConfig;
@ -93,17 +92,6 @@ var config = {
],
},
{ test: /\.json$/, loader: "json-loader" },
{
test: /\.(woff(2)?)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[hash].[ext]",
},
},
],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
@ -196,14 +184,6 @@ module.exports = (env, argv) => {
minimize: true,
minimizer: [new TerserPlugin()],
};
config.plugins.push(
new InjectManifest({
mode: "production", //"development",
swSrc: "@appserver/common/utils/sw-template.js", // this is your sw template file
swDest: "sw.js", // this will be created in the build step
exclude: [/\.map$/, /manifest$/, /service-worker\.js$/],
})
);
} else {
config.devtool = "cheap-module-source-map";
}

3761
yarn.lock

File diff suppressed because it is too large Load Diff