gradle module and build

This commit is contained in:
Christian Basler 2015-10-03 09:05:53 +02:00
parent fe563e32ee
commit 1fc29e9916
49 changed files with 771 additions and 262 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
# Created by https://www.gitignore.io
*list.conf
*.log

201
LICENSE Normal file
View File

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -1,21 +1,22 @@
buildscript {
ext {
springBootVersion = '1.2.6.RELEASE'
springBootVersion = '1.3.0.M5'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("io.spring.gradle:dependency-management-plugin:0.5.2.RELEASE")
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'war'
@ -29,6 +30,8 @@ targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
}
@ -49,17 +52,24 @@ dependencies {
compile 'com.h2database:h2:1.4.187'
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
task(copyWebapp, type: Copy, dependsOn: ":webapp:build") {
from(file('webapp/dist'))
into(file(buildDir.canonicalPath + '/resources/main/static'))
}
build.dependsOn copyWebapp
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}

1
settings.gradle Normal file
View File

@ -0,0 +1 @@
include 'webapp'

View File

@ -1,7 +1,24 @@
/*
* Copyright 2015 Christian Basler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.dissem.bitmessage.server;
import ch.dissem.bitmessage.BitmessageContext;
import ch.dissem.bitmessage.entity.BitmessageAddress;
import ch.dissem.bitmessage.entity.Plaintext;
import ch.dissem.bitmessage.networking.DefaultNetworkHandler;
import ch.dissem.bitmessage.ports.MemoryNodeRegistry;
import ch.dissem.bitmessage.repository.JdbcAddressRepository;
@ -10,15 +27,26 @@ import ch.dissem.bitmessage.repository.JdbcInventory;
import ch.dissem.bitmessage.repository.JdbcMessageRepository;
import ch.dissem.bitmessage.security.bc.BouncySecurity;
import ch.dissem.bitmessage.server.entities.Broadcasts;
import ch.dissem.bitmessage.server.entities.Message;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@CrossOrigin
@RestController
@EnableAutoConfiguration
public class JabitServerApplication {
private static final int SHORTLIST_SIZE = 5;
private final Set<String> whitelist;
private final Set<String> shortlist;
private final Set<String> blacklist;
private BitmessageContext ctx;
@RequestMapping("status")
@ -32,13 +60,48 @@ public class JabitServerApplication {
if (broadcaster == null) {
broadcaster = new BitmessageAddress(broadcastAddress);
}
if (!whitelist.isEmpty() && !whitelist.contains(broadcaster.getAddress())) {
return new Broadcasts(broadcaster, new Message("Not Whitelisted", "Messages for " + broadcaster +
" can't be shown, as the sender isn't on the whitelist."));
}
if (blacklist.contains(broadcaster.getAddress())) {
return new Broadcasts(broadcaster, new Message("Blacklisted", "Unfortunately, " + broadcaster +
" is on the blacklist, so it's messages can't be shown."));
}
if (!broadcaster.isSubscribed()) {
ctx.addSubscribtion(broadcaster);
}
return new Broadcasts(broadcaster, ctx.messages().findMessages(broadcaster));
List<Plaintext> messages = ctx.messages().findMessages(broadcaster);
if (shortlist.contains(broadcaster.getAddress())) {
while (messages.size() > SHORTLIST_SIZE) {
ctx.messages().remove(messages.get(messages.size() - 1));
messages.remove(messages.size() - 1);
}
}
return new Broadcasts(broadcaster, messages);
}
public JabitServerApplication() {
whitelist = Utils.readOrCreateList(
"whitelist.conf",
"# If there are any Bitmessage addresses in the whitelist, only those will be shown.\n" +
"# blacklist.conf will be ignored, but shortlist.conf will be applied to whitelisted addresses.\n"
);
shortlist = Utils.readOrCreateList(
"shortlist.conf",
"# Broadcasts of these addresses will be restricted to the last " + SHORTLIST_SIZE + " entries.\n\n" +
"# Time Service:\n" +
"BM-BcbRqcFFSQUUmXFKsPJgVQPSiFA3Xash\n\n" +
"# Q's Aktivlist:\n" +
"BM-GtT7NLCCAu3HrT7dNTUTY9iDns92Z2ND\n"
);
blacklist = Utils.readOrCreateList(
"blacklist.conf",
"# Bitmessage addresses in this file are being ignored and their broadcasts won't be returned.\n"
);
JdbcConfig config = new JdbcConfig();
ctx = new BitmessageContext.Builder()
.addressRepo(new JdbcAddressRepository(config))

View File

@ -1,3 +1,19 @@
/*
* Copyright 2015 Christian Basler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.dissem.bitmessage.server;
import org.springframework.boot.builder.SpringApplicationBuilder;

View File

@ -0,0 +1,41 @@
package ch.dissem.bitmessage.server;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
public class Utils {
public static Set<String> readOrCreateList(String filename, String content) {
try {
File file = new File(filename);
if (!file.exists()) {
if (file.createNewFile()) {
try (FileWriter fw = new FileWriter(file)) {
fw.write(content);
}
}
}
return readList(file);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static Set<String> readList(File file) {
Set<String> result = new HashSet<>();
try {
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
if (line.startsWith("BM-")) {
result.add(line);
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return result;
}
}

View File

@ -1,3 +1,19 @@
/*
* Copyright 2015 Christian Basler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.dissem.bitmessage.server.entities;
import ch.dissem.bitmessage.entity.BitmessageAddress;
@ -18,9 +34,15 @@ public class Broadcasts {
int i = 0;
for (Plaintext msg : messages) {
this.messages[i] = new Message(msg);
i++;
}
}
public Broadcasts(BitmessageAddress sender, Message... messages) {
this.sender = new Sender(sender);
this.messages = messages;
}
public Sender getSender() {
return sender;
}

View File

@ -1,43 +1,66 @@
/*
* Copyright 2015 Christian Basler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.dissem.bitmessage.server.entities;
import ch.dissem.bitmessage.entity.Plaintext;
import ch.dissem.bitmessage.utils.UnixTime;
import java.time.Instant;
import java.time.ZonedDateTime;
/**
* Created by chrigu on 30.09.15.
*/
public class Message {
private Object id;
private Long received;
private String subject;
private String body;
public Message(){}
public Message(Plaintext plaintext) {
this.id = plaintext.getId();
this.subject = plaintext.getSubject();
this.body = plaintext.getText();
public Message() {
}
public void setId(Object id) {
this.id = id;
public Message(String subject, String body) {
this.id = 0;
this.received = UnixTime.now();
this.subject = subject;
this.body = body;
}
public Message(Plaintext plaintext) {
this.id = plaintext.getId();
this.received = plaintext.getReceived();
this.subject = plaintext.getSubject();
this.body = plaintext.getText();
}
public Object getId() {
return id;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getSubject() {
return subject;
}
public void setBody(String body) {
this.body = body;
}
public String getBody() {
return body;
}
public Long getReceived() {
return received;
}
}

View File

@ -1,3 +1,19 @@
/*
* Copyright 2015 Christian Basler
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ch.dissem.bitmessage.server.entities;
import ch.dissem.bitmessage.entity.BitmessageAddress;

View File

@ -13,6 +13,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<link rel="import" href="../bower_components/iron-icons/iron-icons.html">
<link rel="import" href="../bower_components/iron-pages/iron-pages.html">
<link rel="import" href="../bower_components/iron-selector/iron-selector.html">
<link rel="import" href="../bower_components/iron-localstorage/iron-localstorage.html">
<!-- Paper elements -->
<link rel="import" href="../bower_components/paper-drawer-panel/paper-drawer-panel.html">
@ -37,5 +38,4 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<!-- Add your elements here -->
<link rel="import" href="../styles/app-theme.html">
<link rel="import" href="../styles/shared-styles.html">
<link rel="import" href="my-greeting/my-greeting.html">
<link rel="import" href="my-list/my-list.html">
<link rel="import" href="message-list/message-list.html">

View File

@ -0,0 +1,78 @@
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/paper-material/paper-material.html">
<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
<dom-module id="message-list">
<template>
<link rel="import" href="../../styles/app-theme.html">
<style include="shared-styles"></style>
<style>
.received {
float: right;
font-size: 60%;
}
.paper-font-body2 {
white-space: pre-wrap;
}
</style>
<iron-ajax
auto
url="{{getUrl(server, address)}}"
handle-as="json"
last-response="{{broadcasts}}"
debounce-duration="300"></iron-ajax>
<template is="dom-repeat" items="{{broadcasts.messages}}">
<paper-material elevation="1">
<h1>{{item.subject}}<span class="received">{{toDate(item.received)}}</span></h1>
<p class="paper-font-body2">{{item.body}}</p>
</paper-material>
</template>
</template>
<script>
(function() {
'use strict';
Polymer({
is: 'message-list',
properties: {
address: {
type: String,
value: 'BM-2D9QKN4teYRvoq2fyzpiftPh9WP9qggtzh',
notify: true
},
broadcasts: {
type: Object,
notify: true
},
server: {
type: String,
value: 'http://localhost:8080',
notify: true
}
},
toDate: function(timestamp) {
return new Date(timestamp * 1000).toLocaleString();
},
getUrl: function(server, address) {
return server + '/read/' + address;
}
});
})();
</script>
</dom-module>

View File

@ -27,19 +27,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
app.route = 'home';
});
page('/users', scrollToTop, function() {
app.route = 'users';
page('/read', scrollToTop, function() {
app.route = 'home';
});
page('/users/:name', scrollToTop, function(data) {
app.route = 'user-info';
page('/read/:address', scrollToTop, function(data) {
app.route = 'message-list';
app.params = data.params;
});
page('/contact', scrollToTop, function() {
app.route = 'contact';
});
// add #! before urls
page({
hashbang: true

View File

Before

Width:  |  Height:  |  Size: 611 B

After

Width:  |  Height:  |  Size: 611 B

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

145
webapp/app/index.html Normal file
View File

@ -0,0 +1,145 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html lang="">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Polymer Starter Kit" />
<title>Bitmessage Broadcasts</title>
<!-- Place favicon.ico in the `app/` directory -->
<!-- Chrome for Android theme color -->
<meta name="theme-color" content="#2E3AA1">
<!-- Web Application Manifest -->
<link rel="manifest" href="manifest.json">
<!-- Tile color for Win8 -->
<meta name="msapplication-TileColor" content="#3372DF">
<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="application-name" content="PSK">
<link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png">
<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Polymer Starter Kit">
<link rel="apple-touch-icon" href="images/touch/apple-touch-icon.png">
<!-- Tile icon for Win8 (144x144) -->
<meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild-->
<!-- build:js bower_components/webcomponentsjs/webcomponents-lite.min.js -->
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<!-- endbuild -->
<!-- will be replaced with elements/elements.vulcanized.html -->
<link rel="import" href="elements/elements.html">
<!-- endreplace-->
<!-- For shared styles, shared-styles.html import in elements.html -->
<style is="custom-style" include="shared-styles"></style>
</head>
<body unresolved class="fullbleed layout vertical">
<span id="browser-sync-binding"></span>
<template is="dom-bind" id="app">
<paper-drawer-panel id="paperDrawerPanel">
<!-- Drawer Scroll Header Panel -->
<paper-scroll-header-panel drawer fixed>
<!-- Drawer Toolbar -->
<paper-toolbar id="drawerToolbar">
<span class="paper-font-title">Menu</span>
</paper-toolbar>
<!-- Drawer Content -->
<paper-menu class="list" attr-for-selected="data-route" selected="[[route]]">
<a data-route="home" href="/" on-click="onDataRouteClick">
<iron-icon icon="home"></iron-icon>
<span>Home</span>
</a>
<iron-localstorage name="my-broadcasts"
value="{{broadcasts}}"
on-iron-localstorage-load-empty="initializeExamples"></iron-localstorage>
<template is="dom-repeat" items="{{broadcasts}}">
<a data-route="{{join('message-list/',index)}}" href="{{join('/read/',item.address)}}" on-click="onDataRouteClick">
<iron-icon icon="mail"></iron-icon>
<span>{{item.alias}}</span>
</a>
</template>
</paper-menu>
</paper-scroll-header-panel>
<!-- Main Area -->
<paper-scroll-header-panel main condenses keep-condensed-header>
<!-- Main Toolbar -->
<paper-toolbar id="mainToolbar" class="tall">
<paper-icon-button id="paperToggle" icon="menu" paper-drawer-toggle></paper-icon-button>
<span class="flex"></span>
<!-- Toolbar icons -->
<paper-icon-button icon="refresh"></paper-icon-button>
<paper-icon-button icon="search"></paper-icon-button>
<!-- Application name -->
<div class="middle middle-container center horizontal layout">
<div class="app-name">Bitmessage Broadcasts</div>
</div>
<!-- Application sub title -->
<div class="bottom bottom-container center horizontal layout">
<div class="bottom-title paper-font-subhead">Please don't abuse.</div>
</div>
</paper-toolbar>
<!-- Main Content -->
<div class="content">
<iron-pages attr-for-selected="data-route" selected="{{route}}">
<section data-route="home">
<paper-material elevation="1">
<h1>Welcome.</h1>
</paper-material>
</section>
<section data-route="message-list">
<message-list address="{{params.address}}"></message-list>
</section>
</iron-pages>
</div>
</paper-scroll-header-panel>
</paper-drawer-panel>
</template>
<!-- build:js scripts/app.js -->
<script src="scripts/app.js"></script>
<!-- endbuild-->
</body>
</html>

View File

@ -15,6 +15,15 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// Learn more about auto-binding templates at http://goo.gl/Dx1u2g
var app = document.querySelector('#app');
app.join = function() {
var index = 0;
var result = '';
for (index = 0; index < arguments.length; index++) {
result += arguments[index];
}
return result;
};
app.displayInstalledToast = function() {
// Check to make sure caching is actually enabled—it won't be in the dev environment.
if (!document.querySelector('platinum-sw-cache').disabled) {
@ -71,4 +80,26 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
document.getElementById('mainContainer').scrollTop = 0;
};
app.initializeExamples = function() {
this.value = [
{
alias: 'General',
address: 'BM-2cToDNkgW4KN92vuEjgnT1To3WEyt4r3DK'
},
{
alias: 'DevTalk',
address: 'BM-2D9QKN4teYRvoq2fyzpiftPh9WP9qggtzh'
},
{
alias: 'Timeservice',
address: 'BM-BcbRqcFFSQUUmXFKsPJgVQPSiFA3Xash'
},
{
alias: 'Q\'s Aktivlist',
address: 'BM-GtT7NLCCAu3HrT7dNTUTY9iDns92Z2ND'
}
];
console.log(this.value);
};
})(document);

View File

@ -65,15 +65,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
height: 100%;
}
paper-material {
border-radius: 2px;
height: 100%;
padding: 16px 0 16px 0;
width: calc(98.66% - 16px);
margin: 16px auto;
background: white;
}
paper-menu iron-icon {
margin-right: 33px;
opacity: 0.54;
@ -135,65 +126,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
height: 900px;
}
/* Breakpoints */
/* Small */
@media (max-width: 600px) {
paper-material {
--menu-container-display: none;
width: calc(97.33% - 32px);
padding-left: 16px;
padding-right: 16px;
}
paper-toolbar.tall .app-name {
font-size: 24px;
font-weight: 400;
}
#drawer .paper-toolbar {
margin-left: 16px;
}
#overlay {
min-width: 360px;
}
.bg {
background: white;
}
}
/* Tablet+ */
@media (min-width: 601px) {
paper-material {
width: calc(98% - 46px);
margin-bottom: 32px;
padding-left: 30px;
padding-right: 30px;
}
#drawer.paper-drawer-panel > [drawer] {
border-right: 1px solid rgba(0, 0, 0, 0.14);
}
iron-pages {
padding: 48px 62px;
}
}
/* Material Design Adaptive Breakpoints */
/*
Below you'll find CSS media queries based on the breakpoint guidance
published by the Material Design team. You can choose to use, customise
or remove these breakpoints based on your needs.
Below you'll find CSS media queries based on the breakpoint guidance
published by the Material Design team. You can choose to use, customise
or remove these breakpoints based on your needs.
http://www.google.com/design/spec/layout/adaptive-ui.html#adaptive-ui-breakpoints
*/
http://www.google.com/design/spec/layout/adaptive-ui.html#adaptive-ui-breakpoints
*/
/* mobile-small */
@media all and (min-width: 0) and (max-width: 360px) and (orientation: portrait) { }

View File

@ -0,0 +1,76 @@
<!-- shared styles for all elements and index.html -->
<dom-module id="shared-styles">
<template>
<style>
.page-title {
@apply(--paper-font-display2);
}
@media (max-width: 600px) {
.page-title {
font-size: 24px!important;
}
}
paper-material {
border-radius: 2px;
height: 100%;
padding: 16px 0 16px 0;
width: calc(98.66% - 16px);
margin: 16px auto;
background: white;
}
/* Breakpoints */
/* Small */
@media (max-width: 600px) {
paper-material {
--menu-container-display: none;
width: calc(97.33% - 32px);
padding-left: 16px;
padding-right: 16px;
}
paper-toolbar.tall .app-name {
font-size: 24px;
font-weight: 400;
}
#drawer .paper-toolbar {
margin-left: 16px;
}
#overlay {
min-width: 360px;
}
.bg {
background: white;
}
}
/* Tablet+ */
@media (min-width: 601px) {
paper-material {
width: calc(98% - 46px);
margin-bottom: 32px;
padding-left: 30px;
padding-right: 30px;
}
#drawer.paper-drawer-panel > [drawer] {
border-right: 1px solid rgba(0, 0, 0, 0.14);
}
iron-pages {
padding: 48px 62px;
}
}
</style>
</template>
</dom-module>

12
webapp/build.gradle Normal file
View File

@ -0,0 +1,12 @@
plugins {
id "com.moowork.gulp" version "0.11"
}
// makes sure on each build that gulp is installed
gulp_default.dependsOn 'installGulp'
// processes your package.json before running gulp build
gulp_default.dependsOn 'npmInstall'
// runs "gulp build" as part of your gradle build
task (build, dependsOn: gulp_default) {}

View File

@ -1,147 +0,0 @@
<!doctype html>
<!--
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html lang="">
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="Polymer Starter Kit" />
<title>Polymer Starter Kit</title>
<!-- Place favicon.ico in the `app/` directory -->
<!-- Chrome for Android theme color -->
<meta name="theme-color" content="#2E3AA1">
<!-- Web Application Manifest -->
<link rel="manifest" href="manifest.json">
<!-- Tile color for Win8 -->
<meta name="msapplication-TileColor" content="#3372DF">
<!-- Add to homescreen for Chrome on Android -->
<meta name="mobile-web-app-capable" content="yes">
<meta name="application-name" content="PSK">
<link rel="icon" sizes="192x192" href="images/touch/chrome-touch-icon-192x192.png">
<!-- Add to homescreen for Safari on iOS -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Polymer Starter Kit">
<link rel="apple-touch-icon" href="images/touch/apple-touch-icon.png">
<!-- Tile icon for Win8 (144x144) -->
<meta name="msapplication-TileImage" content="images/touch/ms-touch-icon-144x144-precomposed.png">
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild-->
<!-- build:js bower_components/webcomponentsjs/webcomponents-lite.min.js -->
<script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<!-- endbuild -->
<!-- will be replaced with elements/elements.vulcanized.html -->
<link rel="import" href="elements/elements.html">
<!-- endreplace-->
<!-- For shared styles, shared-styles.html import in elements.html -->
<style is="custom-style" include="shared-styles"></style>
</head>
<body unresolved class="fullbleed layout vertical">
<span id="browser-sync-binding"></span>
<template is="dom-bind" id="app">
<!-- Main Area -->
<paper-scroll-header-panel main condenses keep-condensed-header>
<!-- Main Toolbar -->
<paper-toolbar id="mainToolbar" class="tall">
<span class="flex"></span>
<!-- Toolbar icons -->
<paper-icon-button icon="refresh"></paper-icon-button>
<paper-icon-button icon="search"></paper-icon-button>
<!-- Application name -->
<div class="middle middle-container center horizontal layout">
<div class="app-name">Bitmessage Broadcasts</div>
</div>
<!-- Application sub title -->
<div class="bottom bottom-container center horizontal layout">
<div class="bottom-title paper-font-subhead">Please don't abuse</div>
</div>
</paper-toolbar>
<!-- Main Content -->
<div class="content">
<iron-pages attr-for-selected="data-route" selected="{{route}}">
<section data-route="home">
<iron-ajax
auto
url="http://localhost:8080/read/BM-GuRLKDhQA5hAhE6PDQpkcvbtt1AuXAdQ"
handle-as="json"
last-response="{{messages}}"
debounce-duration="300"></iron-ajax>
<template is="dom-repeat" items="{{messages}}">
<paper-material elevation="1">
<h1>{{item.received}}</h1>
{{item.subject}}
<p>{{item.text}}</p>
</paper-material>
</template>
<paper-material elevation="1">
<my-greeting></my-greeting>
<p class="paper-font-subhead">You now have:</p>
<my-list></my-list>
<p class="paper-font-body2">Looking for more Web App layouts? Check out our <a href="https://github.com/PolymerElements/app-layout-templates">layouts</a> collection. You can also <a href="http://polymerelements.github.io/app-layout-templates/">preview</a> them live.</p>
</paper-material>
</section>
</iron-pages>
</div>
</paper-scroll-header-panel>
<!-- Uncomment next block to enable Service Worker support (1/2) -->
<!--
<paper-toast id="caching-complete"
duration="6000"
text="Caching complete! This app will work offline.">
</paper-toast>
<platinum-sw-register auto-register
clients-claim
skip-waiting
on-service-worker-installed="displayInstalledToast">
<platinum-sw-cache default-cache-strategy="fastest"
cache-config-file="cache-config.json">
</platinum-sw-cache>
</platinum-sw-register>
-->
</template>
<!-- build:js scripts/app.js -->
<script src="scripts/app.js"></script>
<!-- endbuild-->
</body>
</html>

View File

@ -1,16 +0,0 @@
<!-- shared styles for all elements and index.html -->
<dom-module id="shared-styles">
<template>
<style>
.page-title {
@apply(--paper-font-display2);
}
@media (max-width: 600px) {
.page-title {
font-size: 24px!important;
}
}
</style>
</template>
</dom-module>