195 changed files with 50559 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||||||
|
/bin/* |
||||||
|
/pkg/* |
||||||
|
/src/code.google.com |
||||||
|
/src/github.com |
||||||
|
/src/golang.struktur.de |
||||||
|
/*.pprof |
||||||
|
/server.conf |
||||||
|
/*.log |
||||||
|
/changelog*.txt |
||||||
|
/src/styles/.sass-cache |
||||||
|
/static/css/main.min.css |
||||||
|
/static/js/main.min.js |
||||||
|
/tokens.txt |
||||||
|
/dist |
||||||
|
*~ |
||||||
|
debian/*.debhelper |
||||||
|
debian/*.substvars |
||||||
|
debian/spreed-webcaller |
||||||
|
debian/files |
||||||
|
debian/tmp |
||||||
|
vendor/* |
||||||
|
/dist_* |
||||||
|
/build/out/ |
||||||
|
/.sass-cache |
||||||
@ -0,0 +1,661 @@ |
|||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE |
||||||
|
Version 3, 19 November 2007 |
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
||||||
|
Everyone is permitted to copy and distribute verbatim copies |
||||||
|
of this license document, but changing it is not allowed. |
||||||
|
|
||||||
|
Preamble |
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for |
||||||
|
software and other kinds of works, specifically designed to ensure |
||||||
|
cooperation with the community in the case of network server software. |
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed |
||||||
|
to take away your freedom to share and change the works. By contrast, |
||||||
|
our General Public Licenses are intended to guarantee your freedom to |
||||||
|
share and change all versions of a program--to make sure it remains free |
||||||
|
software for all its users. |
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not |
||||||
|
price. Our General Public Licenses are designed to make sure that you |
||||||
|
have the freedom to distribute copies of free software (and charge for |
||||||
|
them if you wish), that you receive source code or can get it if you |
||||||
|
want it, that you can change the software or use pieces of it in new |
||||||
|
free programs, and that you know you can do these things. |
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights |
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer |
||||||
|
you this License which gives you legal permission to copy, distribute |
||||||
|
and/or modify the software. |
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that |
||||||
|
improvements made in alternate versions of the program, if they |
||||||
|
receive widespread use, become available for other developers to |
||||||
|
incorporate. Many developers of free software are heartened and |
||||||
|
encouraged by the resulting cooperation. However, in the case of |
||||||
|
software used on network servers, this result may fail to come about. |
||||||
|
The GNU General Public License permits making a modified version and |
||||||
|
letting the public access it on a server without ever releasing its |
||||||
|
source code to the public. |
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to |
||||||
|
ensure that, in such cases, the modified source code becomes available |
||||||
|
to the community. It requires the operator of a network server to |
||||||
|
provide the source code of the modified version running there to the |
||||||
|
users of that server. Therefore, public use of a modified version, on |
||||||
|
a publicly accessible server, gives the public access to the source |
||||||
|
code of the modified version. |
||||||
|
|
||||||
|
An older license, called the Affero General Public License and |
||||||
|
published by Affero, was designed to accomplish similar goals. This is |
||||||
|
a different license, not a version of the Affero GPL, but Affero has |
||||||
|
released a new version of the Affero GPL which permits relicensing under |
||||||
|
this license. |
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and |
||||||
|
modification follow. |
||||||
|
|
||||||
|
TERMS AND CONDITIONS |
||||||
|
|
||||||
|
0. Definitions. |
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License. |
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of |
||||||
|
works, such as semiconductor masks. |
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this |
||||||
|
License. Each licensee is addressed as "you". "Licensees" and |
||||||
|
"recipients" may be individuals or organizations. |
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work |
||||||
|
in a fashion requiring copyright permission, other than the making of an |
||||||
|
exact copy. The resulting work is called a "modified version" of the |
||||||
|
earlier work or a work "based on" the earlier work. |
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based |
||||||
|
on the Program. |
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without |
||||||
|
permission, would make you directly or secondarily liable for |
||||||
|
infringement under applicable copyright law, except executing it on a |
||||||
|
computer or modifying a private copy. Propagation includes copying, |
||||||
|
distribution (with or without modification), making available to the |
||||||
|
public, and in some countries other activities as well. |
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other |
||||||
|
parties to make or receive copies. Mere interaction with a user through |
||||||
|
a computer network, with no transfer of a copy, is not conveying. |
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices" |
||||||
|
to the extent that it includes a convenient and prominently visible |
||||||
|
feature that (1) displays an appropriate copyright notice, and (2) |
||||||
|
tells the user that there is no warranty for the work (except to the |
||||||
|
extent that warranties are provided), that licensees may convey the |
||||||
|
work under this License, and how to view a copy of this License. If |
||||||
|
the interface presents a list of user commands or options, such as a |
||||||
|
menu, a prominent item in the list meets this criterion. |
||||||
|
|
||||||
|
1. Source Code. |
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work |
||||||
|
for making modifications to it. "Object code" means any non-source |
||||||
|
form of a work. |
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official |
||||||
|
standard defined by a recognized standards body, or, in the case of |
||||||
|
interfaces specified for a particular programming language, one that |
||||||
|
is widely used among developers working in that language. |
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other |
||||||
|
than the work as a whole, that (a) is included in the normal form of |
||||||
|
packaging a Major Component, but which is not part of that Major |
||||||
|
Component, and (b) serves only to enable use of the work with that |
||||||
|
Major Component, or to implement a Standard Interface for which an |
||||||
|
implementation is available to the public in source code form. A |
||||||
|
"Major Component", in this context, means a major essential component |
||||||
|
(kernel, window system, and so on) of the specific operating system |
||||||
|
(if any) on which the executable work runs, or a compiler used to |
||||||
|
produce the work, or an object code interpreter used to run it. |
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all |
||||||
|
the source code needed to generate, install, and (for an executable |
||||||
|
work) run the object code and to modify the work, including scripts to |
||||||
|
control those activities. However, it does not include the work's |
||||||
|
System Libraries, or general-purpose tools or generally available free |
||||||
|
programs which are used unmodified in performing those activities but |
||||||
|
which are not part of the work. For example, Corresponding Source |
||||||
|
includes interface definition files associated with source files for |
||||||
|
the work, and the source code for shared libraries and dynamically |
||||||
|
linked subprograms that the work is specifically designed to require, |
||||||
|
such as by intimate data communication or control flow between those |
||||||
|
subprograms and other parts of the work. |
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users |
||||||
|
can regenerate automatically from other parts of the Corresponding |
||||||
|
Source. |
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that |
||||||
|
same work. |
||||||
|
|
||||||
|
2. Basic Permissions. |
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of |
||||||
|
copyright on the Program, and are irrevocable provided the stated |
||||||
|
conditions are met. This License explicitly affirms your unlimited |
||||||
|
permission to run the unmodified Program. The output from running a |
||||||
|
covered work is covered by this License only if the output, given its |
||||||
|
content, constitutes a covered work. This License acknowledges your |
||||||
|
rights of fair use or other equivalent, as provided by copyright law. |
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not |
||||||
|
convey, without conditions so long as your license otherwise remains |
||||||
|
in force. You may convey covered works to others for the sole purpose |
||||||
|
of having them make modifications exclusively for you, or provide you |
||||||
|
with facilities for running those works, provided that you comply with |
||||||
|
the terms of this License in conveying all material for which you do |
||||||
|
not control copyright. Those thus making or running the covered works |
||||||
|
for you must do so exclusively on your behalf, under your direction |
||||||
|
and control, on terms that prohibit them from making any copies of |
||||||
|
your copyrighted material outside their relationship with you. |
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under |
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10 |
||||||
|
makes it unnecessary. |
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law. |
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological |
||||||
|
measure under any applicable law fulfilling obligations under article |
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or |
||||||
|
similar laws prohibiting or restricting circumvention of such |
||||||
|
measures. |
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid |
||||||
|
circumvention of technological measures to the extent such circumvention |
||||||
|
is effected by exercising rights under this License with respect to |
||||||
|
the covered work, and you disclaim any intention to limit operation or |
||||||
|
modification of the work as a means of enforcing, against the work's |
||||||
|
users, your or third parties' legal rights to forbid circumvention of |
||||||
|
technological measures. |
||||||
|
|
||||||
|
4. Conveying Verbatim Copies. |
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you |
||||||
|
receive it, in any medium, provided that you conspicuously and |
||||||
|
appropriately publish on each copy an appropriate copyright notice; |
||||||
|
keep intact all notices stating that this License and any |
||||||
|
non-permissive terms added in accord with section 7 apply to the code; |
||||||
|
keep intact all notices of the absence of any warranty; and give all |
||||||
|
recipients a copy of this License along with the Program. |
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey, |
||||||
|
and you may offer support or warranty protection for a fee. |
||||||
|
|
||||||
|
5. Conveying Modified Source Versions. |
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to |
||||||
|
produce it from the Program, in the form of source code under the |
||||||
|
terms of section 4, provided that you also meet all of these conditions: |
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified |
||||||
|
it, and giving a relevant date. |
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is |
||||||
|
released under this License and any conditions added under section |
||||||
|
7. This requirement modifies the requirement in section 4 to |
||||||
|
"keep intact all notices". |
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this |
||||||
|
License to anyone who comes into possession of a copy. This |
||||||
|
License will therefore apply, along with any applicable section 7 |
||||||
|
additional terms, to the whole of the work, and all its parts, |
||||||
|
regardless of how they are packaged. This License gives no |
||||||
|
permission to license the work in any other way, but it does not |
||||||
|
invalidate such permission if you have separately received it. |
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display |
||||||
|
Appropriate Legal Notices; however, if the Program has interactive |
||||||
|
interfaces that do not display Appropriate Legal Notices, your |
||||||
|
work need not make them do so. |
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent |
||||||
|
works, which are not by their nature extensions of the covered work, |
||||||
|
and which are not combined with it such as to form a larger program, |
||||||
|
in or on a volume of a storage or distribution medium, is called an |
||||||
|
"aggregate" if the compilation and its resulting copyright are not |
||||||
|
used to limit the access or legal rights of the compilation's users |
||||||
|
beyond what the individual works permit. Inclusion of a covered work |
||||||
|
in an aggregate does not cause this License to apply to the other |
||||||
|
parts of the aggregate. |
||||||
|
|
||||||
|
6. Conveying Non-Source Forms. |
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms |
||||||
|
of sections 4 and 5, provided that you also convey the |
||||||
|
machine-readable Corresponding Source under the terms of this License, |
||||||
|
in one of these ways: |
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product |
||||||
|
(including a physical distribution medium), accompanied by the |
||||||
|
Corresponding Source fixed on a durable physical medium |
||||||
|
customarily used for software interchange. |
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product |
||||||
|
(including a physical distribution medium), accompanied by a |
||||||
|
written offer, valid for at least three years and valid for as |
||||||
|
long as you offer spare parts or customer support for that product |
||||||
|
model, to give anyone who possesses the object code either (1) a |
||||||
|
copy of the Corresponding Source for all the software in the |
||||||
|
product that is covered by this License, on a durable physical |
||||||
|
medium customarily used for software interchange, for a price no |
||||||
|
more than your reasonable cost of physically performing this |
||||||
|
conveying of source, or (2) access to copy the |
||||||
|
Corresponding Source from a network server at no charge. |
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the |
||||||
|
written offer to provide the Corresponding Source. This |
||||||
|
alternative is allowed only occasionally and noncommercially, and |
||||||
|
only if you received the object code with such an offer, in accord |
||||||
|
with subsection 6b. |
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated |
||||||
|
place (gratis or for a charge), and offer equivalent access to the |
||||||
|
Corresponding Source in the same way through the same place at no |
||||||
|
further charge. You need not require recipients to copy the |
||||||
|
Corresponding Source along with the object code. If the place to |
||||||
|
copy the object code is a network server, the Corresponding Source |
||||||
|
may be on a different server (operated by you or a third party) |
||||||
|
that supports equivalent copying facilities, provided you maintain |
||||||
|
clear directions next to the object code saying where to find the |
||||||
|
Corresponding Source. Regardless of what server hosts the |
||||||
|
Corresponding Source, you remain obligated to ensure that it is |
||||||
|
available for as long as needed to satisfy these requirements. |
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided |
||||||
|
you inform other peers where the object code and Corresponding |
||||||
|
Source of the work are being offered to the general public at no |
||||||
|
charge under subsection 6d. |
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded |
||||||
|
from the Corresponding Source as a System Library, need not be |
||||||
|
included in conveying the object code work. |
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any |
||||||
|
tangible personal property which is normally used for personal, family, |
||||||
|
or household purposes, or (2) anything designed or sold for incorporation |
||||||
|
into a dwelling. In determining whether a product is a consumer product, |
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular |
||||||
|
product received by a particular user, "normally used" refers to a |
||||||
|
typical or common use of that class of product, regardless of the status |
||||||
|
of the particular user or of the way in which the particular user |
||||||
|
actually uses, or expects or is expected to use, the product. A product |
||||||
|
is a consumer product regardless of whether the product has substantial |
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent |
||||||
|
the only significant mode of use of the product. |
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods, |
||||||
|
procedures, authorization keys, or other information required to install |
||||||
|
and execute modified versions of a covered work in that User Product from |
||||||
|
a modified version of its Corresponding Source. The information must |
||||||
|
suffice to ensure that the continued functioning of the modified object |
||||||
|
code is in no case prevented or interfered with solely because |
||||||
|
modification has been made. |
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or |
||||||
|
specifically for use in, a User Product, and the conveying occurs as |
||||||
|
part of a transaction in which the right of possession and use of the |
||||||
|
User Product is transferred to the recipient in perpetuity or for a |
||||||
|
fixed term (regardless of how the transaction is characterized), the |
||||||
|
Corresponding Source conveyed under this section must be accompanied |
||||||
|
by the Installation Information. But this requirement does not apply |
||||||
|
if neither you nor any third party retains the ability to install |
||||||
|
modified object code on the User Product (for example, the work has |
||||||
|
been installed in ROM). |
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a |
||||||
|
requirement to continue to provide support service, warranty, or updates |
||||||
|
for a work that has been modified or installed by the recipient, or for |
||||||
|
the User Product in which it has been modified or installed. Access to a |
||||||
|
network may be denied when the modification itself materially and |
||||||
|
adversely affects the operation of the network or violates the rules and |
||||||
|
protocols for communication across the network. |
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided, |
||||||
|
in accord with this section must be in a format that is publicly |
||||||
|
documented (and with an implementation available to the public in |
||||||
|
source code form), and must require no special password or key for |
||||||
|
unpacking, reading or copying. |
||||||
|
|
||||||
|
7. Additional Terms. |
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this |
||||||
|
License by making exceptions from one or more of its conditions. |
||||||
|
Additional permissions that are applicable to the entire Program shall |
||||||
|
be treated as though they were included in this License, to the extent |
||||||
|
that they are valid under applicable law. If additional permissions |
||||||
|
apply only to part of the Program, that part may be used separately |
||||||
|
under those permissions, but the entire Program remains governed by |
||||||
|
this License without regard to the additional permissions. |
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option |
||||||
|
remove any additional permissions from that copy, or from any part of |
||||||
|
it. (Additional permissions may be written to require their own |
||||||
|
removal in certain cases when you modify the work.) You may place |
||||||
|
additional permissions on material, added by you to a covered work, |
||||||
|
for which you have or can give appropriate copyright permission. |
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you |
||||||
|
add to a covered work, you may (if authorized by the copyright holders of |
||||||
|
that material) supplement the terms of this License with terms: |
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the |
||||||
|
terms of sections 15 and 16 of this License; or |
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or |
||||||
|
author attributions in that material or in the Appropriate Legal |
||||||
|
Notices displayed by works containing it; or |
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or |
||||||
|
requiring that modified versions of such material be marked in |
||||||
|
reasonable ways as different from the original version; or |
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or |
||||||
|
authors of the material; or |
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some |
||||||
|
trade names, trademarks, or service marks; or |
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that |
||||||
|
material by anyone who conveys the material (or modified versions of |
||||||
|
it) with contractual assumptions of liability to the recipient, for |
||||||
|
any liability that these contractual assumptions directly impose on |
||||||
|
those licensors and authors. |
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further |
||||||
|
restrictions" within the meaning of section 10. If the Program as you |
||||||
|
received it, or any part of it, contains a notice stating that it is |
||||||
|
governed by this License along with a term that is a further |
||||||
|
restriction, you may remove that term. If a license document contains |
||||||
|
a further restriction but permits relicensing or conveying under this |
||||||
|
License, you may add to a covered work material governed by the terms |
||||||
|
of that license document, provided that the further restriction does |
||||||
|
not survive such relicensing or conveying. |
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you |
||||||
|
must place, in the relevant source files, a statement of the |
||||||
|
additional terms that apply to those files, or a notice indicating |
||||||
|
where to find the applicable terms. |
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the |
||||||
|
form of a separately written license, or stated as exceptions; |
||||||
|
the above requirements apply either way. |
||||||
|
|
||||||
|
8. Termination. |
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly |
||||||
|
provided under this License. Any attempt otherwise to propagate or |
||||||
|
modify it is void, and will automatically terminate your rights under |
||||||
|
this License (including any patent licenses granted under the third |
||||||
|
paragraph of section 11). |
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your |
||||||
|
license from a particular copyright holder is reinstated (a) |
||||||
|
provisionally, unless and until the copyright holder explicitly and |
||||||
|
finally terminates your license, and (b) permanently, if the copyright |
||||||
|
holder fails to notify you of the violation by some reasonable means |
||||||
|
prior to 60 days after the cessation. |
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is |
||||||
|
reinstated permanently if the copyright holder notifies you of the |
||||||
|
violation by some reasonable means, this is the first time you have |
||||||
|
received notice of violation of this License (for any work) from that |
||||||
|
copyright holder, and you cure the violation prior to 30 days after |
||||||
|
your receipt of the notice. |
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the |
||||||
|
licenses of parties who have received copies or rights from you under |
||||||
|
this License. If your rights have been terminated and not permanently |
||||||
|
reinstated, you do not qualify to receive new licenses for the same |
||||||
|
material under section 10. |
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies. |
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or |
||||||
|
run a copy of the Program. Ancillary propagation of a covered work |
||||||
|
occurring solely as a consequence of using peer-to-peer transmission |
||||||
|
to receive a copy likewise does not require acceptance. However, |
||||||
|
nothing other than this License grants you permission to propagate or |
||||||
|
modify any covered work. These actions infringe copyright if you do |
||||||
|
not accept this License. Therefore, by modifying or propagating a |
||||||
|
covered work, you indicate your acceptance of this License to do so. |
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients. |
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically |
||||||
|
receives a license from the original licensors, to run, modify and |
||||||
|
propagate that work, subject to this License. You are not responsible |
||||||
|
for enforcing compliance by third parties with this License. |
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an |
||||||
|
organization, or substantially all assets of one, or subdividing an |
||||||
|
organization, or merging organizations. If propagation of a covered |
||||||
|
work results from an entity transaction, each party to that |
||||||
|
transaction who receives a copy of the work also receives whatever |
||||||
|
licenses to the work the party's predecessor in interest had or could |
||||||
|
give under the previous paragraph, plus a right to possession of the |
||||||
|
Corresponding Source of the work from the predecessor in interest, if |
||||||
|
the predecessor has it or can get it with reasonable efforts. |
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the |
||||||
|
rights granted or affirmed under this License. For example, you may |
||||||
|
not impose a license fee, royalty, or other charge for exercise of |
||||||
|
rights granted under this License, and you may not initiate litigation |
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that |
||||||
|
any patent claim is infringed by making, using, selling, offering for |
||||||
|
sale, or importing the Program or any portion of it. |
||||||
|
|
||||||
|
11. Patents. |
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this |
||||||
|
License of the Program or a work on which the Program is based. The |
||||||
|
work thus licensed is called the contributor's "contributor version". |
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims |
||||||
|
owned or controlled by the contributor, whether already acquired or |
||||||
|
hereafter acquired, that would be infringed by some manner, permitted |
||||||
|
by this License, of making, using, or selling its contributor version, |
||||||
|
but do not include claims that would be infringed only as a |
||||||
|
consequence of further modification of the contributor version. For |
||||||
|
purposes of this definition, "control" includes the right to grant |
||||||
|
patent sublicenses in a manner consistent with the requirements of |
||||||
|
this License. |
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free |
||||||
|
patent license under the contributor's essential patent claims, to |
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and |
||||||
|
propagate the contents of its contributor version. |
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express |
||||||
|
agreement or commitment, however denominated, not to enforce a patent |
||||||
|
(such as an express permission to practice a patent or covenant not to |
||||||
|
sue for patent infringement). To "grant" such a patent license to a |
||||||
|
party means to make such an agreement or commitment not to enforce a |
||||||
|
patent against the party. |
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license, |
||||||
|
and the Corresponding Source of the work is not available for anyone |
||||||
|
to copy, free of charge and under the terms of this License, through a |
||||||
|
publicly available network server or other readily accessible means, |
||||||
|
then you must either (1) cause the Corresponding Source to be so |
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the |
||||||
|
patent license for this particular work, or (3) arrange, in a manner |
||||||
|
consistent with the requirements of this License, to extend the patent |
||||||
|
license to downstream recipients. "Knowingly relying" means you have |
||||||
|
actual knowledge that, but for the patent license, your conveying the |
||||||
|
covered work in a country, or your recipient's use of the covered work |
||||||
|
in a country, would infringe one or more identifiable patents in that |
||||||
|
country that you have reason to believe are valid. |
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or |
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a |
||||||
|
covered work, and grant a patent license to some of the parties |
||||||
|
receiving the covered work authorizing them to use, propagate, modify |
||||||
|
or convey a specific copy of the covered work, then the patent license |
||||||
|
you grant is automatically extended to all recipients of the covered |
||||||
|
work and works based on it. |
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within |
||||||
|
the scope of its coverage, prohibits the exercise of, or is |
||||||
|
conditioned on the non-exercise of one or more of the rights that are |
||||||
|
specifically granted under this License. You may not convey a covered |
||||||
|
work if you are a party to an arrangement with a third party that is |
||||||
|
in the business of distributing software, under which you make payment |
||||||
|
to the third party based on the extent of your activity of conveying |
||||||
|
the work, and under which the third party grants, to any of the |
||||||
|
parties who would receive the covered work from you, a discriminatory |
||||||
|
patent license (a) in connection with copies of the covered work |
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily |
||||||
|
for and in connection with specific products or compilations that |
||||||
|
contain the covered work, unless you entered into that arrangement, |
||||||
|
or that patent license was granted, prior to 28 March 2007. |
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting |
||||||
|
any implied license or other defenses to infringement that may |
||||||
|
otherwise be available to you under applicable patent law. |
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom. |
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or |
||||||
|
otherwise) that contradict the conditions of this License, they do not |
||||||
|
excuse you from the conditions of this License. If you cannot convey a |
||||||
|
covered work so as to satisfy simultaneously your obligations under this |
||||||
|
License and any other pertinent obligations, then as a consequence you may |
||||||
|
not convey it at all. For example, if you agree to terms that obligate you |
||||||
|
to collect a royalty for further conveying from those to whom you convey |
||||||
|
the Program, the only way you could satisfy both those terms and this |
||||||
|
License would be to refrain entirely from conveying the Program. |
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License. |
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the |
||||||
|
Program, your modified version must prominently offer all users |
||||||
|
interacting with it remotely through a computer network (if your version |
||||||
|
supports such interaction) an opportunity to receive the Corresponding |
||||||
|
Source of your version by providing access to the Corresponding Source |
||||||
|
from a network server at no charge, through some standard or customary |
||||||
|
means of facilitating copying of software. This Corresponding Source |
||||||
|
shall include the Corresponding Source for any work covered by version 3 |
||||||
|
of the GNU General Public License that is incorporated pursuant to the |
||||||
|
following paragraph. |
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have |
||||||
|
permission to link or combine any covered work with a work licensed |
||||||
|
under version 3 of the GNU General Public License into a single |
||||||
|
combined work, and to convey the resulting work. The terms of this |
||||||
|
License will continue to apply to the part which is the covered work, |
||||||
|
but the work with which it is combined will remain governed by version |
||||||
|
3 of the GNU General Public License. |
||||||
|
|
||||||
|
14. Revised Versions of this License. |
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of |
||||||
|
the GNU Affero General Public License from time to time. Such new versions |
||||||
|
will be similar in spirit to the present version, but may differ in detail to |
||||||
|
address new problems or concerns. |
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the |
||||||
|
Program specifies that a certain numbered version of the GNU Affero General |
||||||
|
Public License "or any later version" applies to it, you have the |
||||||
|
option of following the terms and conditions either of that numbered |
||||||
|
version or of any later version published by the Free Software |
||||||
|
Foundation. If the Program does not specify a version number of the |
||||||
|
GNU Affero General Public License, you may choose any version ever published |
||||||
|
by the Free Software Foundation. |
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future |
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's |
||||||
|
public statement of acceptance of a version permanently authorizes you |
||||||
|
to choose that version for the Program. |
||||||
|
|
||||||
|
Later license versions may give you additional or different |
||||||
|
permissions. However, no additional obligations are imposed on any |
||||||
|
author or copyright holder as a result of your choosing to follow a |
||||||
|
later version. |
||||||
|
|
||||||
|
15. Disclaimer of Warranty. |
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY |
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT |
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY |
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, |
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM |
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF |
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
||||||
|
|
||||||
|
16. Limitation of Liability. |
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS |
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY |
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE |
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF |
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD |
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), |
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF |
||||||
|
SUCH DAMAGES. |
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16. |
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided |
||||||
|
above cannot be given local legal effect according to their terms, |
||||||
|
reviewing courts shall apply local law that most closely approximates |
||||||
|
an absolute waiver of all civil liability in connection with the |
||||||
|
Program, unless a warranty or assumption of liability accompanies a |
||||||
|
copy of the Program in return for a fee. |
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS |
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs |
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest |
||||||
|
possible use to the public, the best way to achieve this is to make it |
||||||
|
free software which everyone can redistribute and change under these terms. |
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest |
||||||
|
to attach them to the start of each source file to most effectively |
||||||
|
state the exclusion of warranty; and each file should have at least |
||||||
|
the "copyright" line and a pointer to where the full notice is found. |
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.> |
||||||
|
Copyright (C) <year> <name of author> |
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU Affero General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU Affero General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License |
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail. |
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer |
||||||
|
network, you should also make sure that it provides a way for users to |
||||||
|
get its source. For example, if your program is a web application, its |
||||||
|
interface could display a "Source" link that leads users to an archive |
||||||
|
of the code. There are many ways you could offer source, and different |
||||||
|
solutions will be better for different programs; see section 13 for the |
||||||
|
specific requirements. |
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school, |
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary. |
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see |
||||||
|
<http://www.gnu.org/licenses/>. |
||||||
@ -0,0 +1,134 @@ |
|||||||
|
#
|
||||||
|
# Spreed Speak Freely.
|
||||||
|
# Copyright (C) 2013-2014 struktur AG
|
||||||
|
#
|
||||||
|
# This file is part of Spreed Speak Freely.
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
PKG := app/spreed-speakfreely-server |
||||||
|
EXENAME := spreed-speakfreely-server |
||||||
|
CONFIG_FILE := spreed-speakfreely-server.conf |
||||||
|
CONFIG_PATH := /etc |
||||||
|
|
||||||
|
GOPATH = "$(CURDIR)/vendor:$(CURDIR)" |
||||||
|
SYSTEM_GOPATH := /usr/share/gocode/src/ |
||||||
|
OUTPUT := $(CURDIR)/bin |
||||||
|
OUTPUT_JS := $(CURDIR)/build/out |
||||||
|
|
||||||
|
DESTDIR ?= / |
||||||
|
BIN := $(DESTDIR)/usr/sbin |
||||||
|
CONF := $(DESTDIR)/$(CONFIG_PATH) |
||||||
|
SHARE := $(DESTDIR)/usr/share/spreed-speakfreely-server |
||||||
|
|
||||||
|
BUILD_ARCH := $(shell go env GOARCH) |
||||||
|
DIST := $(CURDIR)/dist_$(BUILD_ARCH) |
||||||
|
DIST_SRC := $(DIST)/src |
||||||
|
DIST_BIN := $(DIST)/bin |
||||||
|
|
||||||
|
build: get binary styles javascript |
||||||
|
|
||||||
|
gopath: |
||||||
|
@echo GOPATH=$(GOPATH) |
||||||
|
|
||||||
|
get: |
||||||
|
GOPATH=$(GOPATH) go get $(PKG) |
||||||
|
|
||||||
|
binary: |
||||||
|
GOPATH=$(GOPATH) go build -o $(OUTPUT)/$(EXENAME) -ldflags '$(LDFLAGS)' $(PKG) |
||||||
|
|
||||||
|
binaryrace: |
||||||
|
GOPATH=$(GOPATH) go build -race -o $(OUTPUT)/$(EXENAME) -ldflags '$(LDFLAGS)' $(PKG) |
||||||
|
|
||||||
|
fmt: |
||||||
|
GOPATH=$(GOPATH) go fmt app/... |
||||||
|
|
||||||
|
test: TESTDEPS = $(shell GOPATH=$(GOPATH) go list -f '{{.ImportPath}}{{"\n"}}{{join .Deps "\n"}}' $(PKG) |grep $(PKG)) |
||||||
|
test: get |
||||||
|
GOPATH=$(GOPATH) go test -i $(TESTDEPS) |
||||||
|
GOPATH=$(GOPATH) go test -v $(TESTDEPS) |
||||||
|
|
||||||
|
styles: |
||||||
|
(cd $(CURDIR)/src/styles && sass --compass --scss --style=compressed main.scss:$(CURDIR)/static/css/main.min.css) |
||||||
|
|
||||||
|
javascript: |
||||||
|
mkdir -p $(OUTPUT_JS) |
||||||
|
nodejs $(CURDIR)/build/r.js -o $(CURDIR)/build/build.js dir=$(OUTPUT_JS) baseUrl=$(CURDIR)/static/js mainConfigFile=$(CURDIR)/static/js/main.js |
||||||
|
|
||||||
|
release: GOPATH = "$(DIST):$(CURDIR)" |
||||||
|
release: LDFLAGS = -X main.version $(VERSION) -X main.defaultConfig $(CONFIG_PATH)/$(CONFIG_FILE) |
||||||
|
release: OUTPUT = $(DIST_BIN) |
||||||
|
release: dist_gopath $(DIST_BIN) binary styles javascript |
||||||
|
|
||||||
|
releasetest: GOPATH = "$(DIST):$(CURDIR)" |
||||||
|
releasetest: dist_gopath test |
||||||
|
|
||||||
|
install: |
||||||
|
echo $(BIN) |
||||||
|
echo $(SHARE) |
||||||
|
install -d $(BIN) $(CONF) |
||||||
|
install -d $(SHARE)/www/html |
||||||
|
install -d $(SHARE)/www/static |
||||||
|
install -d $(SHARE)/www/static/img |
||||||
|
install -d $(SHARE)/www/static/sounds |
||||||
|
install -d $(SHARE)/www/static/fonts |
||||||
|
install -d $(SHARE)/www/static/translation |
||||||
|
install -d $(SHARE)/www/static/css |
||||||
|
install $(DIST_BIN)/* $(BIN) |
||||||
|
install -m 644 server.conf.in $(CONF)/$(CONFIG_FILE) |
||||||
|
install html/* $(SHARE)/www/html |
||||||
|
install static/img/* $(SHARE)/www/static/img |
||||||
|
install static/sounds/* $(SHARE)/www/static/sounds |
||||||
|
install static/fonts/* $(SHARE)/www/static/fonts |
||||||
|
install static/translation/* $(SHARE)/www/static/translation |
||||||
|
install static/css/* $(SHARE)/www/static/css |
||||||
|
install -D static/js/libs/require/require.js $(SHARE)/www/static/js/libs/require/require.js |
||||||
|
install $(OUTPUT_JS)/*.js $(SHARE)/www/static/js |
||||||
|
|
||||||
|
clean: |
||||||
|
GOPATH=$(GOPATH) go clean -i $(PKG) |
||||||
|
rm -rf $(CURDIR)/pkg |
||||||
|
rm -f $(CURDIR)/static/css/main.min.css |
||||||
|
rm -rf $(CURDIR)/build/out |
||||||
|
|
||||||
|
distclean: clean |
||||||
|
rm -rf $(DIST) |
||||||
|
|
||||||
|
pristine: distclean |
||||||
|
rm -f server.conf |
||||||
|
rm -rf vendor/* |
||||||
|
|
||||||
|
$(DIST_SRC): |
||||||
|
mkdir -p $@ |
||||||
|
|
||||||
|
$(DIST_BIN): |
||||||
|
mkdir -p $@ |
||||||
|
|
||||||
|
dist_gopath: $(DIST_SRC) |
||||||
|
find $(SYSTEM_GOPATH) -mindepth 1 -maxdepth 1 -type d \
|
||||||
|
-exec ln -sf {} $(DIST_SRC) \; |
||||||
|
|
||||||
|
tarball: VERSION = $(shell dpkg-parsechangelog | sed -n 's/^Version: //p') |
||||||
|
tarball: PACKAGE_NAME = $(EXENAME)-$(VERSION) |
||||||
|
tarball: TARPATH = $(DIST)/$(PACKAGE_NAME) |
||||||
|
tarball: BIN = $(TARPATH)/loader |
||||||
|
tarball: CONF = $(TARPATH)/loader |
||||||
|
tarball: DOCS = $(CONF)/docs |
||||||
|
tarball: SHARE = $(TARPATH)/ |
||||||
|
tarball: distclean release install |
||||||
|
echo -n $(VERSION) > $(TARPATH)/version.txt |
||||||
|
tar czf $(DIST)/$(PACKAGE_NAME).tar.gz -C $(DIST) $(PACKAGE_NAME) |
||||||
|
|
||||||
|
.PHONY: clean distclean pristine get build styles javascript release releasetest dist_gopath install gopath binary tarball |
||||||
@ -0,0 +1,100 @@ |
|||||||
|
Spreed Speak Freely |
||||||
|
=================== |
||||||
|
|
||||||
|
The latest version of Spreed Speak Freely can be found on GitHub: |
||||||
|
|
||||||
|
https://github.com/strukturag/spreed-speakfreely |
||||||
|
|
||||||
|
|
||||||
|
## Build prerequisites |
||||||
|
|
||||||
|
- [Go](http://golang.org) >= 1.1.0 |
||||||
|
- [NodeJS](http://nodejs.org/) |
||||||
|
- [Sass](http://sass-lang.com/) |
||||||
|
- [Compass](http://compass-style.org/) |
||||||
|
- [Babel](http://babel.pocoo.org/) |
||||||
|
- [po2json](https://github.com/mikeedwards/po2json) |
||||||
|
- make |
||||||
|
|
||||||
|
|
||||||
|
## Building |
||||||
|
|
||||||
|
Go, Sass and NodeJS need to be in your $PATH. |
||||||
|
|
||||||
|
```bash |
||||||
|
$ make |
||||||
|
``` |
||||||
|
|
||||||
|
|
||||||
|
## Build seperately |
||||||
|
|
||||||
|
Get Go external dependencies first with ``make get``. |
||||||
|
|
||||||
|
```bash |
||||||
|
$ make styles |
||||||
|
$ make javascript |
||||||
|
$ make binary |
||||||
|
``` |
||||||
|
|
||||||
|
|
||||||
|
## Server startup |
||||||
|
|
||||||
|
```bash |
||||||
|
spreed-speakfreely-server [OPTIONS] |
||||||
|
``` |
||||||
|
|
||||||
|
Options |
||||||
|
|
||||||
|
-c="./server.conf": Configuration file. |
||||||
|
-cpuprofile="": Write cpu profile to file. |
||||||
|
-h=false: Show this usage information and exit. |
||||||
|
-l="": Log file, defaults to stderr. |
||||||
|
-memprofile="": Write memory profile to this file. |
||||||
|
-v=false: Display version number and exit. |
||||||
|
|
||||||
|
An example configuration file can be found in server.conf.in. |
||||||
|
|
||||||
|
|
||||||
|
## Usage |
||||||
|
|
||||||
|
Connect to the server URL and port with a web browser and the |
||||||
|
web client will launch. |
||||||
|
|
||||||
|
|
||||||
|
## In place start for development |
||||||
|
|
||||||
|
Copy the server.conf.in to server.conf. |
||||||
|
|
||||||
|
Build styles, javascript and binary using make. Then run |
||||||
|
``./spreed-speakfreely-server`` |
||||||
|
|
||||||
|
The server runs on http://localhost:8080/ per default. |
||||||
|
|
||||||
|
HTML changes and Go rebuilds need a server restart. Javascript |
||||||
|
and CSS reload directly. |
||||||
|
|
||||||
|
|
||||||
|
## Production use |
||||||
|
|
||||||
|
Spreed Speak Freely should be run through a SSL frontend proxy with |
||||||
|
support for Websockets. Example configuration for Nginx can be |
||||||
|
found in `doc/NGINX.txt`. |
||||||
|
|
||||||
|
In addion for real work use one also needs a STUN/TURN server |
||||||
|
configured with shared secret support. |
||||||
|
|
||||||
|
See https://code.google.com/p/rfc5766-turn-server/ for a free |
||||||
|
open source TURN server implementation. |
||||||
|
|
||||||
|
|
||||||
|
## Contributing |
||||||
|
|
||||||
|
1. "Fork". |
||||||
|
2. Make a feature branch. |
||||||
|
3. Make changes. |
||||||
|
4. Do your commits (run ``make fmt`` before commit). |
||||||
|
5. Send "pull request". |
||||||
|
|
||||||
|
## License |
||||||
|
|
||||||
|
`Spreed Speak Freely` uses the AGPL license, see our `LICENSE` file. |
||||||
@ -0,0 +1,62 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
({ |
||||||
|
baseUrl: '../static/js', |
||||||
|
mainConfigFile: '../static/js/main.js', |
||||||
|
optimize: 'uglify2', |
||||||
|
uglify2: { |
||||||
|
output: { |
||||||
|
beautify: false |
||||||
|
}, |
||||||
|
compress: { |
||||||
|
sequences: true, |
||||||
|
global_defs: { |
||||||
|
DEBUG: false |
||||||
|
} |
||||||
|
}, |
||||||
|
warnings: true, |
||||||
|
mangle: true |
||||||
|
}, |
||||||
|
wrap: false, |
||||||
|
useStrict: true, |
||||||
|
dir: './out', |
||||||
|
skipDirOptimize: true, |
||||||
|
removeCombined: true, |
||||||
|
modules: [ |
||||||
|
{ |
||||||
|
name: 'main', |
||||||
|
exclude: [ |
||||||
|
'base' |
||||||
|
] |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: 'base', |
||||||
|
}, |
||||||
|
{ |
||||||
|
name: 'app', |
||||||
|
exclude: [ |
||||||
|
'main', |
||||||
|
'base' |
||||||
|
], |
||||||
|
inlineText: true, |
||||||
|
} |
||||||
|
] |
||||||
|
}) |
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,6 @@ |
|||||||
|
spreed-speakfreely-server (0.15.0) precise; urgency=low |
||||||
|
|
||||||
|
* Initial public release. |
||||||
|
|
||||||
|
-- Simon Eisenmann <simon@struktur.de> Thu, 13 Feb 2014 16:14:05 +0100 |
||||||
|
|
||||||
@ -0,0 +1,699 @@ |
|||||||
|
|
||||||
|
Spreed Speak Freely Channeling API v1.1.4 |
||||||
|
================================================= |
||||||
|
(c)2014 struktur AG |
||||||
|
|
||||||
|
The server provides a Websocket connection end point as channeling API to |
||||||
|
share peer information for peer to peer connectivity. |
||||||
|
|
||||||
|
|
||||||
|
Quick signaling overview |
||||||
|
|
||||||
|
1. Establish websocket connection to /ws path of the |
||||||
|
channeling server. Optionally, add a token as request paramete |
||||||
|
t to reclaim an existing session (Example /ws?t=my-secret-token). |
||||||
|
|
||||||
|
2. Server sends Self document after connection was established. |
||||||
|
|
||||||
|
3. Send Hello document to the server. |
||||||
|
|
||||||
|
-- Channeling API is now established -- |
||||||
|
|
||||||
|
4. Wait for incoming Offer and Candidate documents |
||||||
|
|
||||||
|
4.a. Process incoming Offer and Candidate documents Sdp data by |
||||||
|
submitting it to the peer connection implementation. |
||||||
|
|
||||||
|
4.b. If received an Offer, send Answer document with your own peer |
||||||
|
connection Sdp data as payload. |
||||||
|
|
||||||
|
4.c. Send out Candidates if not already sent in the Offer Sdp data. |
||||||
|
|
||||||
|
5. To initiate a call, get your peer connection Sdp data and send it |
||||||
|
and Offer document with Sdp payload. |
||||||
|
|
||||||
|
5.a. Send Offer. |
||||||
|
|
||||||
|
5.b. Send Candidates if not already sent in the Offer Sdp data. |
||||||
|
|
||||||
|
5.c. Wait for Answer and Candidates. When received put the Sdp data |
||||||
|
into your peer connection implementation. |
||||||
|
|
||||||
|
6. To close a call, send a Bye document. |
||||||
|
|
||||||
|
|
||||||
|
In general all documents are JSON documents. |
||||||
|
|
||||||
|
|
||||||
|
Sending vs receiving document data encapsulation |
||||||
|
|
||||||
|
All documents sent to the channeling server need to be wrapped in their |
||||||
|
own type once more for security reasons. |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Whatever", |
||||||
|
"Whatever": { /* your document */ } |
||||||
|
} |
||||||
|
|
||||||
|
So any document you sent, you have to specify a Type key pointing |
||||||
|
to the key where the real document is to be found. |
||||||
|
|
||||||
|
Received documents are wrapped by a special Document which provides |
||||||
|
additional information. |
||||||
|
|
||||||
|
{ |
||||||
|
"From": "4", |
||||||
|
"To": "5", |
||||||
|
"Data": {} |
||||||
|
} |
||||||
|
|
||||||
|
The Data key contains the real Document. |
||||||
|
|
||||||
|
Keys: |
||||||
|
|
||||||
|
From : The sending side Id as known to the server (uint64). Use this Id |
||||||
|
as To, to reply to things. |
||||||
|
To : The Id, the server send this Document to. Should be the same as |
||||||
|
your current Self Id. |
||||||
|
Data : Contains the payload. |
||||||
|
|
||||||
|
|
||||||
|
Special purpose documents for channling |
||||||
|
|
||||||
|
Self |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Self", |
||||||
|
"Id": "4", |
||||||
|
"Token": "some-very-long-string", |
||||||
|
"Version": "server-version-number", |
||||||
|
"Turn": { |
||||||
|
"username": "turn-username", |
||||||
|
"password": "turn-password", |
||||||
|
"ttl": 3600 |
||||||
|
"urls": { |
||||||
|
"turn:213.203.211.154:3478?transport=udp", |
||||||
|
"turn:213.203.211.154:3479?transport=tcp", |
||||||
|
"turns:213.203.211.154:443?transport=tcp" |
||||||
|
} |
||||||
|
}, |
||||||
|
"Stun": [ |
||||||
|
"stun:213.203.211.154:443" |
||||||
|
] |
||||||
|
} |
||||||
|
|
||||||
|
Self document is used by the server, to tell the client its own Id. |
||||||
|
|
||||||
|
Keys: |
||||||
|
|
||||||
|
Type : Self (string) |
||||||
|
Id : Channel id for this connection (string) |
||||||
|
Token : Security token (string), to restablish connection with the same |
||||||
|
session. Pass the value as URL query parameter t, to the websocket URL. |
||||||
|
Version: Server version number. Use this to detect server upgrades. |
||||||
|
Turn : Mapping (interface{}) to contain TURN server details, like |
||||||
|
urls, password and username. See |
||||||
|
http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00 |
||||||
|
and TURN REST API section in |
||||||
|
https://code.google.com/p/rfc5766-turn-server/wiki/turnserver |
||||||
|
for details. |
||||||
|
Stun : Array with STUN server URLs. |
||||||
|
|
||||||
|
You can also send an empty Self document to the server to make the server |
||||||
|
transmit a fresh Self document (eg. to refresh when ttl was reached). Please |
||||||
|
note that you need to refresh before the ttl was reached - so add a grace |
||||||
|
period like 10% to the refresh timeout. |
||||||
|
|
||||||
|
Hello |
||||||
|
|
||||||
|
{ |
||||||
|
Type: "Hello", |
||||||
|
Hello: { |
||||||
|
Version: "1.0.0", |
||||||
|
Ua: "Test client 1.0", |
||||||
|
Id: "" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Hello document is to be send by the client after connection was |
||||||
|
established. |
||||||
|
|
||||||
|
Keys under Hello: |
||||||
|
|
||||||
|
Version : Channel protocol version (string). |
||||||
|
Ua : User agent description (string). |
||||||
|
Id : Room id. The default Room has the empty string Id ("") (string). |
||||||
|
|
||||||
|
Peer connection documents |
||||||
|
|
||||||
|
Offer |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Offer", |
||||||
|
"Offer": { |
||||||
|
"To": "5", |
||||||
|
"Type": "Offer", |
||||||
|
"Offer": { |
||||||
|
"sdp": "v=0\r\no=- 8411189997130069027 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox\r\nm=audio 1 RTP/SAVPF 111 103 104 0 8 107 106 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:4gu7jur9CAGKfnEb\r\na=ice-pwd:0OrfIpPc9DIv8RXnY+c63AEE\r\na=ice-options:google-ice\r\na=fingerprint:sha-256 39:DB:AA:8E:0F:09:23:93:C3:D0:4A:4D:31:E3:4E:42:B6:6D:B3:19:8D:08:4B:3C:6E:D9:A4:CE:4D:12:E9:4A\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=sendrecv\r\na=mid:audio\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:Zq8e3w5J2hcobT3tDQa4FeypkNI3D5P8dBlbkX3k\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:107 CN/48000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=ssrc:1804041269 cname:VOdXM2lXvKaANDCI\r\na=ssrc:1804041269 msid:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxa0\r\na=ssrc:1804041269 mslabel:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox\r\na=ssrc:1804041269 label:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxa0\r\nm=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:4gu7jur9CAGKfnEb\r\na=ice-pwd:0OrfIpPc9DIv8RXnY+c63AEE\r\na=ice-options:google-ice\r\na=fingerprint:sha-256 39:DB:AA:8E:0F:09:23:93:C3:D0:4A:4D:31:E3:4E:42:B6:6D:B3:19:8D:08:4B:3C:6E:D9:A4:CE:4D:12:E9:4A\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=sendrecv\r\na=mid:video\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:Zq8e3w5J2hcobT3tDQa4FeypkNI3D5P8dBlbkX3k\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack \r\na=rtcp-fb:100 goog-remb \r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=ssrc:2344329267 cname:VOdXM2lXvKaANDCI\r\na=ssrc:2344329267 msid:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxv0\r\na=ssrc:2344329267 mslabel:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox\r\na=ssrc:2344329267 label:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxv0\r\n", |
||||||
|
"type": "offer" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Send an Sdp offer to establish a new peer connection. |
||||||
|
|
||||||
|
Keys und Offer: |
||||||
|
|
||||||
|
To : Id to send Offer to (string). |
||||||
|
Type : Offer (string) |
||||||
|
Offer : Sdp data mapping (keys sdp, type, |
||||||
|
_conference, _token, _id) (interface{}). |
||||||
|
|
||||||
|
When receiving an offer for a conference, the Offer Sdp data mapping contains |
||||||
|
the additional key _conference (string), containing the conference id. |
||||||
|
|
||||||
|
When receiving an offer for token based peer to peer communication like |
||||||
|
file sharing or screen sharing, the Offer Sdp data mapping contains |
||||||
|
the additional keys _token (string) and _id (string). |
||||||
|
|
||||||
|
Candidate |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Candidate", |
||||||
|
"Candidate": { |
||||||
|
"To": "5", |
||||||
|
"Type": "Candidate", |
||||||
|
"Candidate": { |
||||||
|
"type": "candidate", |
||||||
|
"sdpMLineIndex": 0, |
||||||
|
"sdpMid": "audio", |
||||||
|
"candidate": "a=candidate:3326824476 1 udp 2113937151 10.1.1.201 44687 typ host generation 0\r\n" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Add candidates to a peer connection. |
||||||
|
|
||||||
|
Keys under Candidate: |
||||||
|
|
||||||
|
To : Id to send Candidate to (string). Should be the same as |
||||||
|
where the Offer was sent or received from. |
||||||
|
Type : Candidate (string) |
||||||
|
Candidate : Candidate data mapping (keys, type, sdpMLineIndex, |
||||||
|
sdpMid, candidate) (interface{}) |
||||||
|
|
||||||
|
Answer |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Answer", |
||||||
|
"Answer": { |
||||||
|
"To": "4", |
||||||
|
"Type": "Answer", |
||||||
|
"Answer": { |
||||||
|
"sdp": "v=0\r\no=- 7479727536449706653 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7\r\nm=audio 1 RTP/SAVPF 111 103 104 0 8 107 106 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:0+u7n7SbYfRSHWMy\r\na=ice-pwd:FGH2sGhPde6h75i0Wplzppp4\r\na=fingerprint:sha-256 D9:AD:F3:33:3D:4E:34:FF:19:CE:29:80:67:F2:18:34:D3:78:44:92:ED:C6:B3:50:D7:D3:EC:25:0B:10:3F:99\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=sendrecv\r\na=mid:audio\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:107 CN/48000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=ssrc:4175414086 cname:2fDX0nTtSszSeGlx\r\na=ssrc:4175414086 msid:KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7 KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7a0\r\na=ssrc:4175414086 mslabel:KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7\r\na=ssrc:4175414086 label:KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7a0\r\nm=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:0+u7n7SbYfRSHWMy\r\na=ice-pwd:FGH2sGhPde6h75i0Wplzppp4\r\na=fingerprint:sha-256 D9:AD:F3:33:3D:4E:34:FF:19:CE:29:80:67:F2:18:34:D3:78:44:92:ED:C6:B3:50:D7:D3:EC:25:0B:10:3F:99\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=sendrecv\r\na=mid:video\r\na=rtcp-mux\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack \r\na=rtcp-fb:100 goog-remb \r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=ssrc:1783464334 cname:2fDX0nTtSszSeGlx\r\na=ssrc:1783464334 msid:KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7 KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7v0\r\na=ssrc:1783464334 mslabel:KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7\r\na=ssrc:1783464334 label:KglGoKOAKjSEL6mVTQ2vQvV1VKFbpPo3Z4a7v0\r\n", |
||||||
|
"type": "answer" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Sends own Sdp data as an answer to a received Offer. |
||||||
|
|
||||||
|
Keys under Answer: |
||||||
|
|
||||||
|
To : Id to send the Answer to (string). Should be the same as |
||||||
|
where the Offer was received from. |
||||||
|
Type : Answer (string). |
||||||
|
Answer : Sdp data mapping (keys sdp and type) (interface{}). |
||||||
|
|
||||||
|
Bye |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Bye", |
||||||
|
"Bye": { |
||||||
|
"To": "5", |
||||||
|
"Type": "Bye", |
||||||
|
"Bye": {} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Send hangup information. You do not need to wait for reply to close |
||||||
|
connectivity. |
||||||
|
|
||||||
|
Keys under Bye: |
||||||
|
|
||||||
|
To : Id to send the Bye to (string). Should be the same as |
||||||
|
the Id where the current connection is established to. |
||||||
|
Type : Bye (string). |
||||||
|
Bye : Bye JSON mapping (interface{}). |
||||||
|
|
||||||
|
Bye known keys: |
||||||
|
|
||||||
|
Reason : Reason for sending bye (busy, reject). (string). |
||||||
|
|
||||||
|
If you do not want to give a reason just send Bye as empty JSON mapping. |
||||||
|
|
||||||
|
|
||||||
|
Additional types for user listing and notifications |
||||||
|
|
||||||
|
Left |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Left", |
||||||
|
"Id": "5", |
||||||
|
"Ua": "", |
||||||
|
"Status": null |
||||||
|
} |
||||||
|
|
||||||
|
Joined |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Joined", |
||||||
|
"Id": "7", |
||||||
|
"Ua": "Chrome 28", |
||||||
|
"Status": null |
||||||
|
} |
||||||
|
|
||||||
|
Status |
||||||
|
|
||||||
|
{ |
||||||
|
|
||||||
|
"Type": "Status", |
||||||
|
"Status": { |
||||||
|
"displayName": "Some name", |
||||||
|
"buddyPicture": "data:image/jpeg;base64,/9j/4..." |
||||||
|
}, |
||||||
|
"Rev": 1 |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
Note: buddyPicture content needs to be in the format of HTML data urls'. |
||||||
|
|
||||||
|
Rev is the status update sequence for this status update entry. It |
||||||
|
is a positive integer. Higher numbers are later status updates. |
||||||
|
|
||||||
|
Users (Request uses empty data) |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Users", |
||||||
|
"Users": { |
||||||
|
"Type": "Users", |
||||||
|
"Users": {} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Users (Response with data) |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Users", |
||||||
|
"Users": [ |
||||||
|
{ |
||||||
|
"Type": "Online", |
||||||
|
"Id": "1", |
||||||
|
"Ua": "webrtc-publisher", |
||||||
|
"Status": null |
||||||
|
}, |
||||||
|
{ |
||||||
|
"Type": "Online", |
||||||
|
"Id": "3", |
||||||
|
"Ua": "Chrome 28", |
||||||
|
"Status": null |
||||||
|
}, |
||||||
|
{ |
||||||
|
"Type": "Online", |
||||||
|
"Id": "4", |
||||||
|
"Ua": "Chrome 28", |
||||||
|
"Status": null |
||||||
|
} |
||||||
|
], |
||||||
|
"Index": 0, |
||||||
|
"Batch": 0 |
||||||
|
} |
||||||
|
|
||||||
|
Alive |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Alive", |
||||||
|
"Alive": 1389190912092 |
||||||
|
} |
||||||
|
|
||||||
|
Send an Alive document to the channeling server if you want to check if |
||||||
|
the connection is functional. The channeling server will send back their |
||||||
|
exact same Alive document immediately. With that it can be easily tested |
||||||
|
if the connection is still functional. You should only use the Alive |
||||||
|
check if nothing else was received from the channeling server for a |
||||||
|
while. |
||||||
|
|
||||||
|
The Alive value is a timestamp integer in milliseconds (unix time). |
||||||
|
|
||||||
|
|
||||||
|
Chat messages and status information |
||||||
|
|
||||||
|
The chat is used to transfer simple messages ore more complex structures |
||||||
|
using the Status sub key. |
||||||
|
|
||||||
|
Chat (Send without time) |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Chat", |
||||||
|
"Chat": { |
||||||
|
"Message": "Some chat message" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Chat (Send without time and tell server not to loop send us our own mesasge) |
||||||
|
|
||||||
|
{ |
||||||
|
"Type":"Chat", |
||||||
|
"Chat":{ |
||||||
|
"Message":"hello", |
||||||
|
"NoEcho":true |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
The NoEcho boolean key indicates that the client can display its own |
||||||
|
messages directly without the need to receive it from the server. This |
||||||
|
is the preferred client mode. |
||||||
|
|
||||||
|
Chat (Received with time) |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Chat", |
||||||
|
"Chat": { |
||||||
|
"Message": "Some chat message", |
||||||
|
"Time": "2006-01-02T15:04:05Z", |
||||||
|
"Status": null |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Chat typing state |
||||||
|
|
||||||
|
{ |
||||||
|
"Message": "", |
||||||
|
"Time": "2013-11-20T16:31:34+01:00", |
||||||
|
"Status": { |
||||||
|
"Typing": "start" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
The typing state can either be "start" or "stop". |
||||||
|
|
||||||
|
Chat with file sharing information |
||||||
|
|
||||||
|
{ |
||||||
|
"Message": "File", |
||||||
|
"Time": "2013-11-20T16:28:42+01:00", |
||||||
|
"Status": { |
||||||
|
"FileInfo": { |
||||||
|
"chunks": 450, |
||||||
|
"id": "file_null_MTM4NDk2MTA1M3xFd3dBRUxGZ0NYZUxqdWtBS2xPUUpYYURVblE9fDpVXfnE3KNz-Eq_I0zmi8mCX_OzP1mPSas6lC2BjhCI_1", |
||||||
|
"name": "audio.wav", |
||||||
|
"size": 26959472, |
||||||
|
"type": "audio/wav" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
The id of the FileInfo struct is the token which can be used to create |
||||||
|
a token peer connection for file transfer. It is up to the UI if the |
||||||
|
message is shown or not. For file transfer information the message is |
||||||
|
always "File". |
||||||
|
|
||||||
|
Chat message deliver status extensions |
||||||
|
|
||||||
|
Send chat messages as normal, but add the "Mid" field which is a |
||||||
|
client generated unique id to identify this single message. All status |
||||||
|
messages for this message are sent back with this Mid. Whenever a Mid |
||||||
|
is present in the Chat document, the server will trigger Status messages |
||||||
|
automatically. Mid is completely optional. Only add it when the client |
||||||
|
can handle it. Whenever a Status message is sent which should not trigger |
||||||
|
another Status message, make sure to add the Mid below Status document |
||||||
|
and not directly below Chat. |
||||||
|
|
||||||
|
Generate the Mid from a secure random number generator to make it unique |
||||||
|
and sufficiently unguessable. |
||||||
|
|
||||||
|
Also make sure you have implemented the NoEcho client chat feature as |
||||||
|
specified above. |
||||||
|
|
||||||
|
Send message: |
||||||
|
|
||||||
|
{ |
||||||
|
"Type":"Chat", |
||||||
|
"Chat":{ |
||||||
|
"To":"MTM5MDEzMTEyMXxFd3dBRU1qeFJ1OW9jTllTdndjUjRnbzZ4dk09fFtAr3XSgyr9U9qo-xU-dOvcs5t-h2ANll7sqKKy-ov6", |
||||||
|
"Type":"Chat", |
||||||
|
"Chat":{ |
||||||
|
"Mid":"346c7d6e2989dca262be2c0a6a29eba2", |
||||||
|
"Message":"test", |
||||||
|
"NoEcho":true |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Receive sent status back (generated by channeling server). In peer to peer |
||||||
|
chat the client needs to trigger this itself. |
||||||
|
|
||||||
|
{ |
||||||
|
"Type":"Chat", |
||||||
|
"Chat":{ |
||||||
|
"Mid":"346c7d6e2989dca262be2c0a6a29eba2", |
||||||
|
"Status":{ |
||||||
|
"State":"sent" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Receive delivered status from receiving client. The Mid in receiving client |
||||||
|
generated Status messages is below the Status key, to avoid another round |
||||||
|
of Status messages triggered by the Server. This message needs to be |
||||||
|
triggered by the client whenever a message whith an Mid was received. |
||||||
|
|
||||||
|
{ |
||||||
|
"Type":"Chat", |
||||||
|
"Chat":{ |
||||||
|
"Time":"2014-01-19T22:31:00+01:00", |
||||||
|
"Status":{ |
||||||
|
"Mid":"346c7d6e2989dca262be2c0a6a29eba2", |
||||||
|
"State":"delivered" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Receive read status of messages by batch mode Mid list. This needs to be |
||||||
|
triggered by the client whenever a user has seen a particular message. As |
||||||
|
this usually becomes true for multiple Mid messages this is implemented as |
||||||
|
Mid list. Touch, mouse or text input qualify as indication of read status. |
||||||
|
|
||||||
|
{ |
||||||
|
"Type":"Chat", |
||||||
|
"Chat":{ |
||||||
|
"Time":"2014-01-19T22:29:05+01:00", |
||||||
|
"Status":{ |
||||||
|
"SeenMids":[ |
||||||
|
"346c7d6e2989dca262be2c0a6a29eba2" |
||||||
|
] |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
Request being called from audio mixer |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Chat", |
||||||
|
"Chat": { |
||||||
|
"Message": null, |
||||||
|
"Status": { |
||||||
|
"type": "conference", |
||||||
|
"id": "my-conference-room" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
This can be sent to any participant that has a "Status" containing the "isMixer" |
||||||
|
flag with a "true" value. The peer will then try to establish a peer connection |
||||||
|
to the caller which it needs to pick up to join an audio conference. |
||||||
|
|
||||||
|
|
||||||
|
Data channel only messages |
||||||
|
|
||||||
|
Each of the peer connections also create a data channel with the label |
||||||
|
"default". The party sending the offer also creates this data channel. |
||||||
|
The default data channel can be used to send all of the above messages |
||||||
|
directly to the peer, bypassing the channeling server. Additionally some |
||||||
|
message documents are only sent/received via a such data channel and are |
||||||
|
never sent through the channeling server. |
||||||
|
|
||||||
|
Talking (data channel only) |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Talking", |
||||||
|
"Talking": true |
||||||
|
} |
||||||
|
|
||||||
|
The talking state sent by a given user as boolean value in "Talking" |
||||||
|
key (true, false). |
||||||
|
|
||||||
|
Screenshare (data channel only) |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Screenshare", |
||||||
|
"Screenshare": { |
||||||
|
"id": "screenshare_token" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
The id is the token to be used to establish a token peer connection |
||||||
|
to the user which sent the Screenshare document. |
||||||
|
|
||||||
|
|
||||||
|
Conferences and how to use them |
||||||
|
|
||||||
|
There is a new data document "Conference" to share information about |
||||||
|
conference participants. It is to be sent to the server, containing an Id |
||||||
|
for this conference, and the user ids for the conference participants. |
||||||
|
|
||||||
|
Once a client recieves such a Conference document, it has to check state |
||||||
|
for all User ids in the Conference document Conference list like this: |
||||||
|
|
||||||
|
- If not in a call already -> ignore. |
||||||
|
- If in a call, and own Id is not in the Conference list -> ignore. |
||||||
|
- Loop through all Ids, string compare the Id with own Id, and if result |
||||||
|
is -1 (not 0 or 1), send Offer to this Id if not got a call with this |
||||||
|
Id already. |
||||||
|
|
||||||
|
Conference offers are the same as normal Offers, with one additional field |
||||||
|
"_conference" inside the Offer.Offer mapping for the Conference Id. |
||||||
|
|
||||||
|
Offer for a conference |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Offer", |
||||||
|
"Offer": { |
||||||
|
"To": "5", |
||||||
|
"Type": "Offer", |
||||||
|
"Offer": { |
||||||
|
"sdp": "v=0\r\no=- 8411189997130069027 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox\r\nm=audio 1 RTP/SAVPF 111 103 104 0 8 107 106 105 13 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:4gu7jur9CAGKfnEb\r\na=ice-pwd:0OrfIpPc9DIv8RXnY+c63AEE\r\na=ice-options:google-ice\r\na=fingerprint:sha-256 39:DB:AA:8E:0F:09:23:93:C3:D0:4A:4D:31:E3:4E:42:B6:6D:B3:19:8D:08:4B:3C:6E:D9:A4:CE:4D:12:E9:4A\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=sendrecv\r\na=mid:audio\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:Zq8e3w5J2hcobT3tDQa4FeypkNI3D5P8dBlbkX3k\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:107 CN/48000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\na=ssrc:1804041269 cname:VOdXM2lXvKaANDCI\r\na=ssrc:1804041269 msid:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxa0\r\na=ssrc:1804041269 mslabel:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox\r\na=ssrc:1804041269 label:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxa0\r\nm=video 1 RTP/SAVPF 100 116 117\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:4gu7jur9CAGKfnEb\r\na=ice-pwd:0OrfIpPc9DIv8RXnY+c63AEE\r\na=ice-options:google-ice\r\na=fingerprint:sha-256 39:DB:AA:8E:0F:09:23:93:C3:D0:4A:4D:31:E3:4E:42:B6:6D:B3:19:8D:08:4B:3C:6E:D9:A4:CE:4D:12:E9:4A\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=sendrecv\r\na=mid:video\r\na=rtcp-mux\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:Zq8e3w5J2hcobT3tDQa4FeypkNI3D5P8dBlbkX3k\r\na=rtpmap:100 VP8/90000\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack \r\na=rtcp-fb:100 goog-remb \r\na=rtpmap:116 red/90000\r\na=rtpmap:117 ulpfec/90000\r\na=ssrc:2344329267 cname:VOdXM2lXvKaANDCI\r\na=ssrc:2344329267 msid:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxv0\r\na=ssrc:2344329267 mslabel:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Oox\r\na=ssrc:2344329267 label:DbFDWhC7hZwBCS9z3npJJMoEXtzrMLcb5Ooxv0\r\n", |
||||||
|
"type": "offer", |
||||||
|
"_conference": "the-conference-id" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
This sends an Offer to Id "5" for conference "the-conference-id". |
||||||
|
|
||||||
|
Whenever an offer is received for a Conference id, and the client |
||||||
|
already is in a call with matching conference id, all subsequent Offers |
||||||
|
for this Conference Id should be accepted automatically. |
||||||
|
|
||||||
|
Conference information |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Conference", |
||||||
|
"Id": "the-conference-id", |
||||||
|
"Conference": [ |
||||||
|
"user-a-id", |
||||||
|
"user-b-id" |
||||||
|
] |
||||||
|
} |
||||||
|
|
||||||
|
Use Conference documents, to create a conference / add new users to a |
||||||
|
conference. |
||||||
|
|
||||||
|
The Id is to be generated by the client and needs to be unique. It |
||||||
|
should ne the Id of the client creating the conference (as received from |
||||||
|
Self document) plus some random string, and both hashed together. Create |
||||||
|
it as secure and unpredictable as possible. |
||||||
|
|
||||||
|
The Conference list inside the Conference document, does contain ids |
||||||
|
(string) to be added to the conference. You should always send all Ids |
||||||
|
including those already in the conference and the ones to be added to |
||||||
|
the conference. |
||||||
|
|
||||||
|
|
||||||
|
Additional token based peer connections |
||||||
|
|
||||||
|
In addition to the normal audio/video peer connections multiple other |
||||||
|
token trust peer connections can be estabished to any number of peers. A |
||||||
|
existing peer connection is not required. Offers for a token based peer |
||||||
|
connection can be always recevied. |
||||||
|
|
||||||
|
In general a token is shared through the channeling server or another |
||||||
|
peer connection first. Whoever has that exact token is trusted and can |
||||||
|
establish (== send an offer) to establish a peer connection for exactly |
||||||
|
this token to a peer which is expected also to know this token. The peer |
||||||
|
is then expected to answer the offer automatically and pass all the |
||||||
|
control of this token peer connection to the token registrant ui |
||||||
|
component (eg. for file sharing or screen sharing). |
||||||
|
|
||||||
|
In addition to each token which is present as key _token in the payload |
||||||
|
mapping there also needs to be an id as key _id, which identifies exactly |
||||||
|
this connection. The _id is required to match multiple connections |
||||||
|
between the same two peers. |
||||||
|
|
||||||
|
The additional keys _token and _id need to be added to all payload data |
||||||
|
keys for Offer, Answer and Candidate. |
||||||
|
|
||||||
|
Example token Offer |
||||||
|
|
||||||
|
{ |
||||||
|
"Type": "Offer", |
||||||
|
"To": "MTM4NDk1OTg4MnxFd3dBRUc0MDlfejFQMmVuSEN5WTB6M2hYRXM9fPz4UWUMxtikvfg7jJLxzAyJMXdLRFj3f6EswNhIDsvz", |
||||||
|
"Offer": { |
||||||
|
"_id": 3, |
||||||
|
"_token": "file_null_MTM4NDk1OTg4MnxFd3dBRUc0MDlfejFQMmVuSEN5WTB6M2hYRXM9fPz4UWUMxtikvfg7jJLxzAyJMXdLRFj3f6EswNhIDsvz_0", |
||||||
|
"sdp": "v=0\r\no=- 8028668300862525469 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio data\r\na=msid-semantic: WMS\r\nm=audio 1 RTP/SAVPF 111 103 104 0 8 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:1 IN IP4 0.0.0.0\r\na=ice-ufrag:6/L663BhUnNLzCFQ\r\na=ice-pwd:339CPlTYmUJQqvlDsmubbhcE\r\na=ice-options:google-ice\r\na=fingerprint:sha-1 C4:5A:E3:B1:48:A9:EE:E1:1A:47:E8:E6:98:DC:0F:37:5C:C7:A4:12\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=recvonly\r\na=rtcp-mux\r\na=crypto:0 AES_CM_128_HMAC_SHA1_32 inline:X+jVMuCkjfn2CeVTUUDBjlNhYa6p1kkNnbn0nQL/\r\na=crypto:1 AES_CM_128_HMAC_SHA1_80 inline:a0kTFRRu0QtXlSzTc1zcMZzxMLNXTTouW0R/+URx\r\na=rtpmap:111 opus/48000/2\r\na=fmtp:111 minptime=10\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:126 telephone-event/8000\r\na=maxptime:60\r\nm=application 1 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:6/L663BhUnNLzCFQ\r\na=ice-pwd:339CPlTYmUJQqvlDsmubbhcE\r\na=ice-options:google-ice\r\na=fingerprint:sha-1 C4:5A:E3:B1:48:A9:EE:E1:1A:47:E8:E6:98:DC:0F:37:5C:C7:A4:12\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n", |
||||||
|
"type": "offer" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Token peer connections als have a default data channel with label |
||||||
|
"default" which is used for feature wise communication like flow control |
||||||
|
in file sharing. |
||||||
|
|
||||||
|
|
||||||
|
File sharing data channel protocol |
||||||
|
|
||||||
|
File sharing uses a token peer connection for transferring the data |
||||||
|
through the default data channel with label default. |
||||||
|
|
||||||
|
There are the following two supported message types which are received |
||||||
|
for file sharing on such a data channel: |
||||||
|
|
||||||
|
ArrayBuffer |
||||||
|
|
||||||
|
Payload data in the following format (version 0): |
||||||
|
1 byte UInt8 : Version. |
||||||
|
3 byte : Reserved for future use. |
||||||
|
4 byte UInt32 : Chunk sequence number. |
||||||
|
4 byte UInt32 : Chunk Crc32 checksum. |
||||||
|
... bytes : Payload data. |
||||||
|
|
||||||
|
String |
||||||
|
|
||||||
|
JSON chunk request |
||||||
|
|
||||||
|
{ |
||||||
|
"m": "r", |
||||||
|
"i": 0 |
||||||
|
} |
||||||
|
|
||||||
|
m is the mode. Currently only "r" is known to request chunks. |
||||||
|
i is the chunk sequence number to request (integer). |
||||||
|
|
||||||
|
Whenever you want the peer to send a chunk, request it by sending a |
||||||
|
JSON chunk request over the data channel with the sequence which |
||||||
|
should be transmitted. The current web implementation requests chunks |
||||||
|
sequentially, and waiting for each chunk to be complete before |
||||||
|
sending the request for the next one. |
||||||
|
|
||||||
|
|
||||||
|
End of Channeling API. |
||||||
|
|
||||||
|
For latest version of Spreed Speak Freely check |
||||||
|
https://github.com/strukturag/spreed-speakfreely |
||||||
|
|
||||||
|
For questions, contact mailto:opensource@struktur.de. |
||||||
|
|
||||||
|
|
||||||
|
(c)2014 struktur AG |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
A few notes on Nginx configuration |
||||||
|
|
||||||
|
In general Nginx with websocket support is required |
||||||
|
(I am using Nginx 1.4). It should work with Nginx 1.3 too. |
||||||
|
|
||||||
|
Add the following to your Nginx server section: |
||||||
|
|
||||||
|
location / { |
||||||
|
proxy_pass http://localhost:8090; |
||||||
|
proxy_http_version 1.1; |
||||||
|
proxy_set_header Upgrade $http_upgrade; |
||||||
|
proxy_set_header Connection $connection_upgrade; |
||||||
|
proxy_set_header X-Forwarded-Proto $scheme; |
||||||
|
proxy_set_header Host $http_host; |
||||||
|
proxy_set_header X-Real-IP $remote_addr; |
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
||||||
|
} |
||||||
|
|
||||||
|
This is using a map to provide the Upgrade and Connection |
||||||
|
headers to the backend server. You need to add this map to |
||||||
|
the http section of your server: |
||||||
|
|
||||||
|
map $http_upgrade $connection_upgrade { |
||||||
|
default upgrade; |
||||||
|
'' close; |
||||||
|
} |
||||||
|
|
||||||
|
Also make sure that you have the general proxy configuration |
||||||
|
like this in place: |
||||||
|
|
||||||
|
proxy_buffering on; |
||||||
|
proxy_ignore_client_abort off; |
||||||
|
proxy_redirect off; |
||||||
|
proxy_connect_timeout 90; |
||||||
|
proxy_send_timeout 90; |
||||||
|
proxy_read_timeout 90; |
||||||
|
proxy_buffer_size 4k; |
||||||
|
proxy_buffers 4 32k; |
||||||
|
proxy_busy_buffers_size 64k; |
||||||
|
proxy_temp_file_write_size 64k; |
||||||
|
proxy_next_upstream error timeout invalid_header http_502 http_503 http_504; |
||||||
|
|
||||||
|
Thats it. |
||||||
|
|
||||||
|
-- |
||||||
|
(c)2013 struktur AG |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,9 @@ |
|||||||
|
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
||||||
|
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 |
||||||
|
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222 |
||||||
|
333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 |
||||||
|
444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 |
||||||
|
555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555 |
||||||
|
666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 |
||||||
|
777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777 |
||||||
|
888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888 |
||||||
@ -0,0 +1,54 @@ |
|||||||
|
<!doctype html> |
||||||
|
<html class="no-js" lang="<% index .Languages 0%>" itemscope="itemscope" itemtype="http://schema.org/WebPage"> |
||||||
|
<head> |
||||||
|
<title>Spreed Speak Freely</title> |
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"> |
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes"> |
||||||
|
<meta name="mobile-web-app-capable" content="yes"> |
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||||
|
<base href="/"> |
||||||
|
<link rel="stylesheet" type="text/css" href="<%.Cfg.S%>/css/bootstrap.min.css"> |
||||||
|
<link rel="stylesheet" type="text/css" href="<%.Cfg.S%>/css/font-awesome.min.css"> |
||||||
|
<link rel="stylesheet" type="text/css" href="<%.Cfg.S%>/css/main.min.css"> |
||||||
|
<script id="globalcontext" type="application/json"><%$%></script> |
||||||
|
</head> |
||||||
|
<body ng-controller="MediastreamController"> |
||||||
|
<div id="background"></div> |
||||||
|
<div id="loader"><div><i class="fa fa-spinner fa-spin"></i></div></div> |
||||||
|
<div class="ng-cloak" id="help"> |
||||||
|
<usability/> |
||||||
|
</div> |
||||||
|
<div id="bar"> |
||||||
|
<div class="left"> |
||||||
|
<a target="_blank" href="https://github.com/strukturag/spreed-speakfreely" class="logo" title="Spreed Speak Freely" style="background-image: url('<%.Cfg.S%>/img/logo-small.png')"><span>Speak Freely</span></a> |
||||||
|
</div> |
||||||
|
<status-message ng-controller="StatusmessageController"></status-message> |
||||||
|
<div class="ng-cloak right"> |
||||||
|
<button title="{{_('Share your screen')}}" class="btn aenablebtn" ng-show="master.settings.screensharingMedia && (status=='connected' || status=='conference' || enabledScreenshare)" ng-model="enableScreenshare" btn-checkbox><i class="fa fa-desktop"></i></button> |
||||||
|
<button title="{{_('Mute microphone')}}" class="btn amutebtn" ng-model="microphoneMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-microphone-slash"></i></button> |
||||||
|
<button title="{{_('Turn camera off')}}" class="btn amutebtn" ng-model="cameraMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-eye-slash"></i></button> |
||||||
|
<button title="{{_('Settings')}}" class="btn" ng-model="showSettings" btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0"><i class="fa fa-cog"></i></button> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div id="roombar" class="ng-cloak"> |
||||||
|
<room-bar/> |
||||||
|
</div> |
||||||
|
<div id="audiolevel" class="ng-cloak"> |
||||||
|
<div class="audio-level" title="{{_('Your audio level')}}"></div> |
||||||
|
</div> |
||||||
|
<div id="audiovideo" class="ng-cloak" ng-show="peer" ng-class="{'leftsided': mainview}"> |
||||||
|
<div id="container"> |
||||||
|
<audio-video/> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div id="screenshare" class="ng-cloak mainview" ng-show="mainview=='screenshare'"> |
||||||
|
<screenshare/> |
||||||
|
</div> |
||||||
|
<div class="ng-cloak" id="buddylist"><buddy-list/></div> |
||||||
|
<div class="ng-cloak" id="settings" ng-class="{show: showSettings}"><settings/></div> |
||||||
|
<div class="ng-cloak" id="chat"><chat/></div> |
||||||
|
<script data-main="<%.Cfg.S%>/js/<%.App%>" src="<%.Cfg.S%>/js/libs/require/require.js"></script> |
||||||
|
<div class="ng-cloak" id="details">{{id}}</div> |
||||||
|
<%extraHTML%> |
||||||
|
</body> |
||||||
|
</html> |
||||||
@ -0,0 +1,19 @@ |
|||||||
|
# Spreed Speak Freely server example configuration |
||||||
|
|
||||||
|
[http] |
||||||
|
listen = 127.0.0.1:8080 |
||||||
|
#root = /usr/share/spreed-speakfreely-server/www |
||||||
|
#readtimeout = 10 |
||||||
|
#writetimeout = 10 |
||||||
|
|
||||||
|
[app] |
||||||
|
#ver = 1234 # version string to use for static resource |
||||||
|
#stunURIs = stun.l.google.com:19302 |
||||||
|
#turnURIs = turn:turnserver:port?transport=udp turn:anotherturnserver:port?transport=tcp turns:turnserver:443?transport=tcp |
||||||
|
#turnSecret = the-default-turn-shared-secret-do-not-keep |
||||||
|
sessionSecret = the-default-secret-do-not-keep |
||||||
|
#tokenFile = tokens.txt # If set, everyone needs to give one of the tokens to launch the web client. One token per line in the file. |
||||||
|
#extraHTML = <div>Rendered directly before closing body tag.</div> |
||||||
|
|
||||||
|
[log] |
||||||
|
#logfile = /var/log/spreed-speakfreely-server.log |
||||||
@ -0,0 +1,2 @@ |
|||||||
|
#!/bin/bash |
||||||
|
GOMAXPROCS=8 exec ./bin/spreed-speakfreely-server $* |
||||||
@ -0,0 +1,50 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"app/spreed-speakfreely-server/sleepy" |
||||||
|
"github.com/gorilla/mux" |
||||||
|
"github.com/strukturag/httputils" |
||||||
|
) |
||||||
|
|
||||||
|
type ApiError struct { |
||||||
|
Id string `json:"code"` |
||||||
|
Message string `json:"message"` |
||||||
|
Success bool `json:"success"` |
||||||
|
} |
||||||
|
|
||||||
|
func NewApiError(id, message string) *ApiError { |
||||||
|
return &ApiError{id, message, false} |
||||||
|
} |
||||||
|
|
||||||
|
func makeApiHandler(r *mux.Router, tokenProvider TokenProvider) { |
||||||
|
|
||||||
|
a := r.PathPrefix("/api/v1/").Subrouter() |
||||||
|
api := sleepy.NewAPI(a) |
||||||
|
|
||||||
|
rooms := &Rooms{} |
||||||
|
api.AddResource(rooms, "/rooms") |
||||||
|
|
||||||
|
tokens := &Tokens{tokenProvider} |
||||||
|
api.AddResourceWithWrapper(tokens, httputils.MakeGzipHandler, "/tokens") |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
|
||||||
|
type Config struct { |
||||||
|
ver string // Version (not exported to Javascript)
|
||||||
|
S string // Static URL prefix with version
|
||||||
|
StunURIs []string // STUN server URIs
|
||||||
|
TurnURIs []string // TURN server URIs
|
||||||
|
Tokens bool // True when we got a tokens file
|
||||||
|
Version string // Server version number
|
||||||
|
} |
||||||
|
|
||||||
|
func NewConfig(ver, runtimeVersion string, stunURIs, turnURIs []string, tokens bool) *Config { |
||||||
|
sv := fmt.Sprintf("static/ver=%s", ver) |
||||||
|
return &Config{ver: ver, S: sv, StunURIs: stunURIs, TurnURIs: turnURIs, Tokens: tokens, Version: runtimeVersion} |
||||||
|
} |
||||||
@ -0,0 +1,264 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"github.com/gorilla/websocket" |
||||||
|
"io/ioutil" |
||||||
|
"log" |
||||||
|
"sync" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
|
||||||
|
// Time allowed to write a message to the client.
|
||||||
|
writeWait = 10 * time.Second |
||||||
|
|
||||||
|
// Time allowed to read the next pong message from the peer.
|
||||||
|
pongWait = 60 * time.Second |
||||||
|
|
||||||
|
// Send pings to client with this period. Must be less than readWait.
|
||||||
|
pingPeriod = (pongWait * 9) / 10 |
||||||
|
|
||||||
|
// Maximum message size allowed from client.
|
||||||
|
maxMessageSize = 1024 * 1024 |
||||||
|
|
||||||
|
// Size of send queue.
|
||||||
|
queueSize = 512 |
||||||
|
maxQueueSize = queueSize * 4 |
||||||
|
|
||||||
|
// Throttle.
|
||||||
|
maxRatePerSecond = 20 |
||||||
|
) |
||||||
|
|
||||||
|
type Connection struct { |
||||||
|
// References.
|
||||||
|
h *Hub |
||||||
|
ws *websocket.Conn |
||||||
|
|
||||||
|
// Data handling.
|
||||||
|
condition *sync.Cond |
||||||
|
queue [][]byte |
||||||
|
mutex sync.Mutex |
||||||
|
isClosed bool |
||||||
|
|
||||||
|
// Metadata.
|
||||||
|
Id string |
||||||
|
Roomid string |
||||||
|
Idx uint64 |
||||||
|
User *User |
||||||
|
IsRegistered bool |
||||||
|
Hello bool |
||||||
|
Version string |
||||||
|
RemoteAddr string |
||||||
|
} |
||||||
|
|
||||||
|
func NewConnection(h *Hub, ws *websocket.Conn, remoteAddr string) *Connection { |
||||||
|
|
||||||
|
c := &Connection{ |
||||||
|
h: h, |
||||||
|
ws: ws, |
||||||
|
RemoteAddr: remoteAddr, |
||||||
|
} |
||||||
|
c.condition = sync.NewCond(&c.mutex) |
||||||
|
c.queue = make([][]byte, 0, queueSize) |
||||||
|
|
||||||
|
return c |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (c *Connection) close() { |
||||||
|
|
||||||
|
if !c.isClosed { |
||||||
|
c.ws.Close() |
||||||
|
c.mutex.Lock() |
||||||
|
c.User = nil |
||||||
|
c.isClosed = true |
||||||
|
c.queue = c.queue[:0] |
||||||
|
c.condition.Signal() |
||||||
|
c.mutex.Unlock() |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (c *Connection) register() error { |
||||||
|
|
||||||
|
id, err := c.h.EncodeTicket("id", "") |
||||||
|
if err != nil { |
||||||
|
log.Println("Failed to create new Id while register", err) |
||||||
|
return err |
||||||
|
} |
||||||
|
c.Id = id |
||||||
|
//log.Println("Created new id", id)
|
||||||
|
c.h.registerHandler(c) |
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
func (c *Connection) reregister(token string) error { |
||||||
|
|
||||||
|
if id, err := c.h.DecodeTicket("token", token); err == nil { |
||||||
|
c.Id = id |
||||||
|
c.h.registerHandler(c) |
||||||
|
} else { |
||||||
|
log.Println("Error while decoding token", err) |
||||||
|
c.register() |
||||||
|
} |
||||||
|
return nil |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (c *Connection) unregister() { |
||||||
|
c.h.unregisterHandler(c) |
||||||
|
} |
||||||
|
|
||||||
|
// readPump pumps messages from the websocket connection to the hub.
|
||||||
|
func (c *Connection) readPump() { |
||||||
|
|
||||||
|
ticker := time.NewTicker(time.Second / maxRatePerSecond) |
||||||
|
defer func() { |
||||||
|
ticker.Stop() |
||||||
|
c.unregister() |
||||||
|
c.ws.Close() |
||||||
|
}() |
||||||
|
|
||||||
|
c.ws.SetReadLimit(maxMessageSize) |
||||||
|
c.ws.SetReadDeadline(time.Now().Add(pongWait)) |
||||||
|
c.ws.SetPongHandler(func(string) error { |
||||||
|
c.ws.SetReadDeadline(time.Now().Add(pongWait)) |
||||||
|
return nil |
||||||
|
}) |
||||||
|
for { |
||||||
|
//fmt.Println("readPump wait nextReader", c.Idx)
|
||||||
|
op, r, err := c.ws.NextReader() |
||||||
|
if err != nil { |
||||||
|
log.Println("Error while reading", c.Idx, err) |
||||||
|
break |
||||||
|
} |
||||||
|
switch op { |
||||||
|
case websocket.TextMessage: |
||||||
|
message, err := ioutil.ReadAll(r) |
||||||
|
if err != nil { |
||||||
|
break |
||||||
|
} |
||||||
|
<-ticker.C |
||||||
|
c.h.server.OnText(c, message) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Write message to outbound queue.
|
||||||
|
func (c *Connection) send(message []byte) { |
||||||
|
|
||||||
|
c.mutex.Lock() |
||||||
|
defer c.mutex.Unlock() |
||||||
|
if c.isClosed { |
||||||
|
return |
||||||
|
} |
||||||
|
//fmt.Println("Outbound queue size", c.Idx, len(c.queue))
|
||||||
|
if len(c.queue) >= maxQueueSize { |
||||||
|
log.Println("Outbound queue overflow", c.Idx, len(c.queue)) |
||||||
|
return |
||||||
|
} |
||||||
|
c.queue = append(c.queue, message) |
||||||
|
c.condition.Signal() |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// writePump pumps messages from the queue to the websocket connection.
|
||||||
|
func (c *Connection) writePump() { |
||||||
|
|
||||||
|
closer := make(chan bool) |
||||||
|
ticker := time.NewTicker(pingPeriod) |
||||||
|
ping := false |
||||||
|
|
||||||
|
defer func() { |
||||||
|
//fmt.Println("writePump done")
|
||||||
|
closer <- true |
||||||
|
ticker.Stop() |
||||||
|
c.ws.Close() |
||||||
|
}() |
||||||
|
|
||||||
|
// Spawn a new go routine to emit websocket pings.
|
||||||
|
go func() { |
||||||
|
for { |
||||||
|
select { |
||||||
|
case <-closer: |
||||||
|
return |
||||||
|
case <-ticker.C: |
||||||
|
c.mutex.Lock() |
||||||
|
if c.isClosed { |
||||||
|
c.mutex.Unlock() |
||||||
|
return |
||||||
|
} |
||||||
|
ping = true |
||||||
|
c.condition.Signal() |
||||||
|
c.mutex.Unlock() |
||||||
|
} |
||||||
|
} |
||||||
|
}() |
||||||
|
|
||||||
|
// Wait for actions.
|
||||||
|
for { |
||||||
|
|
||||||
|
c.mutex.Lock() |
||||||
|
// Wait until something todo.
|
||||||
|
for !ping && !c.isClosed && len(c.queue) == 0 { |
||||||
|
// Wait on signal (this also unlocks while waiting, and locks again when got the signal).
|
||||||
|
c.condition.Wait() |
||||||
|
} |
||||||
|
// Fast exit if in closed state.
|
||||||
|
if c.isClosed { |
||||||
|
c.mutex.Unlock() |
||||||
|
return |
||||||
|
} |
||||||
|
// Flush queue if something.
|
||||||
|
for len(c.queue) > 0 { |
||||||
|
message := c.queue[0] |
||||||
|
c.queue = c.queue[1:] |
||||||
|
c.mutex.Unlock() |
||||||
|
if err := c.write(websocket.TextMessage, message); err != nil { |
||||||
|
log.Println("Error while writing", c.Idx, err) |
||||||
|
return |
||||||
|
} |
||||||
|
c.mutex.Lock() |
||||||
|
} |
||||||
|
// Send pings.
|
||||||
|
if ping { |
||||||
|
ping = false |
||||||
|
c.mutex.Unlock() |
||||||
|
if err := c.write(websocket.PingMessage, []byte{}); err != nil { |
||||||
|
log.Println("Error while sending ping", c.Idx, err) |
||||||
|
return |
||||||
|
} |
||||||
|
} else { |
||||||
|
// Final unlock.
|
||||||
|
c.mutex.Unlock() |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Write writes a message with the given opCode and payload.
|
||||||
|
func (c *Connection) write(opCode int, payload []byte) error { |
||||||
|
c.ws.SetWriteDeadline(time.Now().Add(writeWait)) |
||||||
|
return c.ws.WriteMessage(opCode, payload) |
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
type Context struct { |
||||||
|
App string // Main client script
|
||||||
|
Cfg *Config |
||||||
|
Host string |
||||||
|
Ssl bool |
||||||
|
Languages []string |
||||||
|
} |
||||||
@ -0,0 +1,313 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"crypto/hmac" |
||||||
|
"crypto/sha1" |
||||||
|
"encoding/base64" |
||||||
|
"encoding/json" |
||||||
|
"fmt" |
||||||
|
"github.com/gorilla/securecookie" |
||||||
|
"log" |
||||||
|
"sync" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
globalRoomId = "global" |
||||||
|
turnTTL = 3600 // XXX(longsleep): Add to config file.
|
||||||
|
maxBroadcastPerSecond = 1000 |
||||||
|
maxUsersLength = 5000 |
||||||
|
) |
||||||
|
|
||||||
|
type MessageRequest struct { |
||||||
|
From string |
||||||
|
To string |
||||||
|
Message []byte |
||||||
|
Id string |
||||||
|
} |
||||||
|
|
||||||
|
type Hub struct { |
||||||
|
server *Server |
||||||
|
connectionTable map[string]*Connection |
||||||
|
userTable map[string]*User |
||||||
|
roomTable map[string]*RoomWorker |
||||||
|
version string |
||||||
|
config *Config |
||||||
|
sessionSecret []byte |
||||||
|
turnSecret []byte |
||||||
|
tickets *securecookie.SecureCookie |
||||||
|
count uint64 |
||||||
|
mutex sync.RWMutex |
||||||
|
} |
||||||
|
|
||||||
|
func NewHub(version string, config *Config, sessionSecret string, turnSecret string) *Hub { |
||||||
|
|
||||||
|
h := &Hub{ |
||||||
|
connectionTable: make(map[string]*Connection), |
||||||
|
userTable: make(map[string]*User), |
||||||
|
roomTable: make(map[string]*RoomWorker), |
||||||
|
version: version, |
||||||
|
config: config, |
||||||
|
sessionSecret: []byte(sessionSecret), |
||||||
|
turnSecret: []byte(turnSecret), |
||||||
|
} |
||||||
|
|
||||||
|
h.tickets = securecookie.New(h.sessionSecret, nil) |
||||||
|
return h |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) CreateTurnData(id string) *DataTurn { |
||||||
|
|
||||||
|
// Create turn data credentials for shared secret auth with TURN
|
||||||
|
// server. See http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00
|
||||||
|
// and https://code.google.com/p/rfc5766-turn-server/ REST API auth
|
||||||
|
// and set shared secret in TURN server with static-auth-secret.
|
||||||
|
if len(h.turnSecret) == 0 { |
||||||
|
return &DataTurn{} |
||||||
|
} |
||||||
|
foo := hmac.New(sha1.New, h.turnSecret) |
||||||
|
user := fmt.Sprintf("%s:%d", id, int32(time.Now().Unix())) |
||||||
|
foo.Write([]byte(user)) |
||||||
|
password := base64.StdEncoding.EncodeToString(foo.Sum(nil)) |
||||||
|
return &DataTurn{user, password, turnTTL, h.config.TurnURIs} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) EncodeTicket(key, value string) (string, error) { |
||||||
|
|
||||||
|
if value == "" { |
||||||
|
// Create new id.
|
||||||
|
value = fmt.Sprintf("%s", securecookie.GenerateRandomKey(16)) |
||||||
|
} |
||||||
|
return h.tickets.Encode(key, value) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) DecodeTicket(key, value string) (string, error) { |
||||||
|
|
||||||
|
result := "" |
||||||
|
err := h.tickets.Decode(key, value, &result) |
||||||
|
return result, err |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) GetRoom(id string) *RoomWorker { |
||||||
|
|
||||||
|
h.mutex.RLock() |
||||||
|
room, ok := h.roomTable[id] |
||||||
|
if !ok { |
||||||
|
h.mutex.RUnlock() |
||||||
|
h.mutex.Lock() |
||||||
|
room = NewRoomWorker(h, id) |
||||||
|
h.roomTable[id] = room |
||||||
|
h.mutex.Unlock() |
||||||
|
go func() { |
||||||
|
// Start room, this blocks until room expired.
|
||||||
|
room.Start() |
||||||
|
// Cleanup room when we are done.
|
||||||
|
h.mutex.Lock() |
||||||
|
defer h.mutex.Unlock() |
||||||
|
delete(h.roomTable, id) |
||||||
|
log.Printf("Cleaned up room '%s'\n", id) |
||||||
|
}() |
||||||
|
} else { |
||||||
|
h.mutex.RUnlock() |
||||||
|
} |
||||||
|
|
||||||
|
return room |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) registerHandler(c *Connection) { |
||||||
|
|
||||||
|
h.mutex.Lock() |
||||||
|
|
||||||
|
// Create new user instance.
|
||||||
|
h.count++ |
||||||
|
c.Idx = h.count |
||||||
|
u := &User{Id: c.Id} |
||||||
|
h.userTable[c.Id] = u |
||||||
|
c.User = u |
||||||
|
c.IsRegistered = true |
||||||
|
|
||||||
|
// Register connection or replace existing one.
|
||||||
|
if ec, ok := h.connectionTable[c.Id]; ok { |
||||||
|
delete(h.connectionTable, ec.Id) |
||||||
|
ec.IsRegistered = false |
||||||
|
ec.close() |
||||||
|
h.connectionTable[c.Id] = c |
||||||
|
h.mutex.Unlock() |
||||||
|
log.Printf("Register (%d) from %s: %s (existing)\n", c.Idx, c.RemoteAddr, c.Id) |
||||||
|
} else { |
||||||
|
h.connectionTable[c.Id] = c |
||||||
|
//fmt.Println("registered", c.Id)
|
||||||
|
h.mutex.Unlock() |
||||||
|
log.Printf("Register (%d) from %s: %s\n", c.Idx, c.RemoteAddr, c.Id) |
||||||
|
h.server.OnRegister(c) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) unregisterHandler(c *Connection) { |
||||||
|
|
||||||
|
h.mutex.Lock() |
||||||
|
if !c.IsRegistered { |
||||||
|
h.mutex.Unlock() |
||||||
|
return |
||||||
|
} |
||||||
|
c.close() |
||||||
|
delete(h.connectionTable, c.Id) |
||||||
|
delete(h.userTable, c.Id) |
||||||
|
h.mutex.Unlock() |
||||||
|
log.Printf("Unregister (%d) from %s: %s\n", c.Idx, c.RemoteAddr, c.Id) |
||||||
|
h.server.OnUnregister(c) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) broadcastHandler(m *MessageRequest) { |
||||||
|
|
||||||
|
h.mutex.RLock() |
||||||
|
|
||||||
|
//fmt.Println("in h.broadcast", h.userTable, h.connectionTable)
|
||||||
|
roomid := m.Id |
||||||
|
users := make([]string, len(h.userTable)) |
||||||
|
i := 0 |
||||||
|
for id, u := range h.userTable { |
||||||
|
if id == m.From || (u.Roomid != roomid && roomid != globalRoomId) { |
||||||
|
// Skip self and users not in the correct room.
|
||||||
|
continue |
||||||
|
} |
||||||
|
users[i] = id |
||||||
|
i++ |
||||||
|
} |
||||||
|
h.mutex.RUnlock() |
||||||
|
|
||||||
|
room := h.GetRoom(roomid) |
||||||
|
worker := func() { |
||||||
|
|
||||||
|
for _, id := range users { |
||||||
|
h.mutex.RLock() |
||||||
|
u, ok := h.userTable[id] |
||||||
|
if !ok { |
||||||
|
// User gone.
|
||||||
|
h.mutex.RUnlock() |
||||||
|
continue |
||||||
|
} |
||||||
|
ec, ok := h.connectionTable[id] |
||||||
|
if !ok { |
||||||
|
// Connection gone
|
||||||
|
h.mutex.RUnlock() |
||||||
|
continue |
||||||
|
} |
||||||
|
userRoomid := u.Roomid |
||||||
|
//fmt.Println("in h.broadcast id", id, m.From, userRoomid, roomid)
|
||||||
|
//fmt.Println("broadcasting to", id, ec.Idx, userRoomid, roomid)
|
||||||
|
h.mutex.RUnlock() |
||||||
|
if userRoomid != roomid && roomid != globalRoomId { |
||||||
|
// Skip other rooms.
|
||||||
|
continue |
||||||
|
} |
||||||
|
//fmt.Printf("%s\n", m.Message)
|
||||||
|
ec.send(m.Message) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// Run worker in room.
|
||||||
|
if !room.Run(worker) { |
||||||
|
// This handles the case that the room was cleaned up while we retrieved.
|
||||||
|
room = h.GetRoom(roomid) |
||||||
|
room.Run(worker) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) unicastHandler(m *MessageRequest) { |
||||||
|
|
||||||
|
h.mutex.RLock() |
||||||
|
out, ok := h.connectionTable[m.To] |
||||||
|
h.mutex.RUnlock() |
||||||
|
if !ok { |
||||||
|
log.Println("Unicast To not found", m.To) |
||||||
|
return |
||||||
|
} |
||||||
|
out.send(m.Message) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) usersHandler(c *Connection) { |
||||||
|
|
||||||
|
h.mutex.RLock() |
||||||
|
users := &DataUsers{Type: "Users", Index: 0, Batch: 0} |
||||||
|
usersList := users.Users |
||||||
|
roomid := c.User.Roomid |
||||||
|
for id, u := range h.userTable { |
||||||
|
if u.Roomid == roomid || u.Roomid == globalRoomId { |
||||||
|
user := &DataUser{Type: "Online", Id: id, Ua: u.Ua, Status: u.Status, Rev: u.UpdateRev} |
||||||
|
usersList = append(usersList, user) |
||||||
|
if len(usersList) >= maxUsersLength { |
||||||
|
log.Println("Limiting users response length in channel", roomid) |
||||||
|
break |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
h.mutex.RUnlock() |
||||||
|
users.Users = usersList |
||||||
|
usersJson, err := json.Marshal(&DataOutgoing{From: c.Id, Data: users}) |
||||||
|
if err != nil { |
||||||
|
log.Println("Users error while encoding JSON", err) |
||||||
|
return |
||||||
|
} |
||||||
|
c.send(usersJson) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) aliveHandler(c *Connection, alive *DataAlive) { |
||||||
|
|
||||||
|
aliveJson, err := json.Marshal(&DataOutgoing{From: c.Id, Data: alive}) |
||||||
|
if err != nil { |
||||||
|
log.Println("Alive error while encoding JSON", err) |
||||||
|
return |
||||||
|
} |
||||||
|
c.send(aliveJson) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Hub) userupdateHandler(u *UserUpdate) uint64 { |
||||||
|
|
||||||
|
//fmt.Println("Userupdate", u)
|
||||||
|
h.mutex.RLock() |
||||||
|
user, ok := h.userTable[u.Id] |
||||||
|
h.mutex.RUnlock() |
||||||
|
var rev uint64 |
||||||
|
if ok { |
||||||
|
h.mutex.Lock() |
||||||
|
rev = user.Update(u) |
||||||
|
h.mutex.Unlock() |
||||||
|
} else { |
||||||
|
log.Printf("Update data for unknown user %s\n", u.Id) |
||||||
|
} |
||||||
|
return rev |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,288 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"flag" |
||||||
|
"fmt" |
||||||
|
"github.com/gorilla/mux" |
||||||
|
"github.com/strukturag/goacceptlanguageparser" |
||||||
|
"github.com/strukturag/httputils" |
||||||
|
"github.com/strukturag/phoenix" |
||||||
|
"html/template" |
||||||
|
"log" |
||||||
|
"net/http" |
||||||
|
"os" |
||||||
|
"path" |
||||||
|
"strings" |
||||||
|
"syscall" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
RLIMIT_NO_FILE = 32768 |
||||||
|
) |
||||||
|
|
||||||
|
var version = "unreleased" |
||||||
|
var defaultConfig = "./server.conf" |
||||||
|
|
||||||
|
var templates *template.Template |
||||||
|
var config *Config |
||||||
|
var htmlApp string |
||||||
|
|
||||||
|
// Helper to retrieve languages from request.
|
||||||
|
func getRequestLanguages(r *http.Request, supported_languages []string) []string { |
||||||
|
|
||||||
|
accept_language_header, ok := r.Header["Accept-Language"] |
||||||
|
var langs []string |
||||||
|
if ok { |
||||||
|
langs = goacceptlanguageparser.ParseAcceptLanguage(accept_language_header[0], supported_languages) |
||||||
|
} |
||||||
|
return langs |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// Helper function to clean up string arrays.
|
||||||
|
func trimAndRemoveDuplicates(data *[]string) { |
||||||
|
found := make(map[string]bool) |
||||||
|
j := 0 |
||||||
|
for i, x := range *data { |
||||||
|
x = strings.TrimSpace(x) |
||||||
|
if len(x) > 0 && !found[x] { |
||||||
|
found[x] = true |
||||||
|
(*data)[j] = (*data)[i] |
||||||
|
j++ |
||||||
|
} |
||||||
|
} |
||||||
|
*data = (*data)[:j] |
||||||
|
} |
||||||
|
|
||||||
|
func mainHandler(w http.ResponseWriter, r *http.Request) { |
||||||
|
|
||||||
|
handleRoomView("", w, r) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func roomHandler(w http.ResponseWriter, r *http.Request) { |
||||||
|
|
||||||
|
vars := mux.Vars(r) |
||||||
|
handleRoomView(vars["room"], w, r) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func handleRoomView(room string, w http.ResponseWriter, r *http.Request) { |
||||||
|
|
||||||
|
w.Header().Set("Content-Type", "text/html; charset=UTF-8") |
||||||
|
w.Header().Set("Expires", "-1") |
||||||
|
w.Header().Set("Cache-Control", "private, max-age=0") |
||||||
|
|
||||||
|
// Detect if the request was made with SSL.
|
||||||
|
ssl := false |
||||||
|
proto, ok := r.Header["X-Forwarded-Proto"] |
||||||
|
if ok { |
||||||
|
ssl = proto[0] == "https" |
||||||
|
} |
||||||
|
|
||||||
|
// Get languages from request.
|
||||||
|
// TODO(longsleep): Added supported and default language to configuration.
|
||||||
|
langs := getRequestLanguages(r, []string{"en", "de"}) |
||||||
|
if len(langs) == 0 { |
||||||
|
langs = append(langs, "en") |
||||||
|
} |
||||||
|
|
||||||
|
// Prepare context to deliver to Javascript.
|
||||||
|
context := &Context{Cfg: config, App: htmlApp, Host: r.Host, Ssl: ssl, Languages: langs} |
||||||
|
|
||||||
|
// Render the template.
|
||||||
|
err := templates.ExecuteTemplate(w, "main.html", context) |
||||||
|
if err != nil { |
||||||
|
http.Error(w, err.Error(), http.StatusInternalServerError) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func runner(runtime phoenix.Runtime) error { |
||||||
|
rootFolder, err := runtime.GetString("http", "root") |
||||||
|
if err != nil { |
||||||
|
cwd, err2 := os.Getwd() |
||||||
|
if err2 != nil { |
||||||
|
return fmt.Errorf("Error while getting current directory: %s", err) |
||||||
|
} |
||||||
|
rootFolder = cwd |
||||||
|
} |
||||||
|
|
||||||
|
if !httputils.HasDirPath(rootFolder) { |
||||||
|
return fmt.Errorf("Configured root '%s' is not a directory.", rootFolder) |
||||||
|
} |
||||||
|
|
||||||
|
htmlApp = "main" |
||||||
|
if httputils.HasFilePath(path.Join(rootFolder, "static", "js", "main.min.js")) { |
||||||
|
runtime.Print("Using minimized javascript application.") |
||||||
|
htmlApp = "main.un" |
||||||
|
} |
||||||
|
|
||||||
|
if !httputils.HasFilePath(path.Join(rootFolder, "static", "css", "main.min.css")) { |
||||||
|
return fmt.Errorf("Unable to find client. Path correct and compiled css?") |
||||||
|
} |
||||||
|
|
||||||
|
sessionSecret, err := runtime.GetString("app", "sessionSecret") |
||||||
|
if err != nil { |
||||||
|
return fmt.Errorf("No sessionSecret in config file.") |
||||||
|
} |
||||||
|
|
||||||
|
tokenFile, err := runtime.GetString("app", "tokenFile") |
||||||
|
if err == nil { |
||||||
|
if !httputils.HasFilePath(path.Clean(tokenFile)) { |
||||||
|
return fmt.Errorf("Unable to find token file at %s", tokenFile) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
ver, err := runtime.GetString("app", "ver") |
||||||
|
if err != nil { |
||||||
|
ver = "" |
||||||
|
} |
||||||
|
|
||||||
|
runtimeVersion := version |
||||||
|
if version != "unreleased" { |
||||||
|
ver1 := ver |
||||||
|
if err != nil { |
||||||
|
ver1 = "" |
||||||
|
} |
||||||
|
ver = fmt.Sprintf("%s%s", ver1, strings.Replace(version, ".", "", -1)) |
||||||
|
} else { |
||||||
|
ts := fmt.Sprintf("%d", time.Now().Unix()) |
||||||
|
if err != nil { |
||||||
|
ver = ts |
||||||
|
} |
||||||
|
runtimeVersion = fmt.Sprintf("unreleased.%s", ts) |
||||||
|
} |
||||||
|
|
||||||
|
turnURIsString, err := runtime.GetString("app", "turnURIs") |
||||||
|
if err != nil { |
||||||
|
turnURIsString = "" |
||||||
|
} |
||||||
|
turnURIs := strings.Split(turnURIsString, " ") |
||||||
|
trimAndRemoveDuplicates(&turnURIs) |
||||||
|
|
||||||
|
turnSecret, err := runtime.GetString("app", "turnSecret") |
||||||
|
if err != nil { |
||||||
|
turnSecret = "" |
||||||
|
} |
||||||
|
|
||||||
|
stunURIsString, err := runtime.GetString("app", "stunURIs") |
||||||
|
if err != nil { |
||||||
|
stunURIsString = "" |
||||||
|
} |
||||||
|
stunURIs := strings.Split(stunURIsString, " ") |
||||||
|
trimAndRemoveDuplicates(&stunURIs) |
||||||
|
|
||||||
|
extraHTMLString, err := runtime.GetString("app", "extraHTML") |
||||||
|
if err != nil { |
||||||
|
extraHTMLString = "" |
||||||
|
} |
||||||
|
|
||||||
|
// Create token provider.
|
||||||
|
var tokenProvider TokenProvider |
||||||
|
if tokenFile != "" { |
||||||
|
log.Printf("Using token authorization from %s\n", tokenFile) |
||||||
|
tokenProvider = TokenFileProvider(tokenFile) |
||||||
|
} |
||||||
|
|
||||||
|
// Create configuration data structure.
|
||||||
|
config = NewConfig(ver, runtimeVersion, stunURIs, turnURIs, tokenProvider != nil) |
||||||
|
|
||||||
|
// Load templates.
|
||||||
|
tt := template.New("") |
||||||
|
tt.Delims("<%", "%>") |
||||||
|
|
||||||
|
// Add some functions.
|
||||||
|
extraHTML := template.HTML(extraHTMLString) |
||||||
|
tt.Funcs(template.FuncMap{"extraHTML": func() template.HTML { |
||||||
|
return extraHTML |
||||||
|
}}) |
||||||
|
|
||||||
|
templates, err = tt.ParseFiles(path.Join(rootFolder, "html", "main.html")) |
||||||
|
if err != nil { |
||||||
|
return fmt.Errorf("Failed to load templates: %s", err) |
||||||
|
} |
||||||
|
|
||||||
|
// Create our hub instance.
|
||||||
|
hub := NewHub(runtimeVersion, config, sessionSecret, turnSecret) |
||||||
|
|
||||||
|
// Try to increase number of file open files. This only works as root.
|
||||||
|
var rLimit syscall.Rlimit |
||||||
|
err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit) |
||||||
|
if err != nil { |
||||||
|
log.Println("Error getting rlimit numer of files", err) |
||||||
|
} |
||||||
|
rLimit.Max = RLIMIT_NO_FILE |
||||||
|
rLimit.Cur = RLIMIT_NO_FILE |
||||||
|
err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit) |
||||||
|
if err != nil { |
||||||
|
log.Println("Error setting rlimit", err) |
||||||
|
} else { |
||||||
|
log.Printf("Set rlimit successfully to %d\n", RLIMIT_NO_FILE) |
||||||
|
} |
||||||
|
|
||||||
|
// Create router.
|
||||||
|
r := mux.NewRouter() |
||||||
|
r.HandleFunc("/", httputils.MakeGzipHandler(mainHandler)) |
||||||
|
r.Handle("/static/{path:.*}", httputils.FileStaticServer(http.Dir(rootFolder))) |
||||||
|
r.Handle("/robots.txt", http.FileServer(http.Dir(path.Join(rootFolder, "static")))) |
||||||
|
r.Handle("/favicon.ico", http.FileServer(http.Dir(path.Join(rootFolder, "static", "img")))) |
||||||
|
r.Handle("/ws", makeWsHubHandler(hub)) |
||||||
|
r.HandleFunc("/{room}", httputils.MakeGzipHandler(roomHandler)) |
||||||
|
makeApiHandler(r, tokenProvider) |
||||||
|
runtime.DefaultHTTPHandler(r) |
||||||
|
|
||||||
|
return runtime.Start() |
||||||
|
} |
||||||
|
|
||||||
|
func boot() error { |
||||||
|
configPath := flag.String("c", defaultConfig, "Configuration file.") |
||||||
|
logPath := flag.String("l", "", "Log file, defaults to stderr.") |
||||||
|
showVersion := flag.Bool("v", false, "Display version number and exit.") |
||||||
|
memprofile := flag.String("memprofile", "", "Write memory profile to this file.") |
||||||
|
cpuprofile := flag.String("cpuprofile", "", "Write cpu profile to file.") |
||||||
|
showHelp := flag.Bool("h", false, "Show this usage information and exit.") |
||||||
|
flag.Parse() |
||||||
|
|
||||||
|
if *showHelp { |
||||||
|
flag.Usage() |
||||||
|
return nil |
||||||
|
} else if *showVersion { |
||||||
|
fmt.Printf("Version %s\n", version) |
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
return phoenix.NewServer("mediastream-connector", ""). |
||||||
|
Config(configPath). |
||||||
|
Log(logPath). |
||||||
|
CpuProfile(cpuprofile). |
||||||
|
MemProfile(memprofile). |
||||||
|
Run(runner) |
||||||
|
} |
||||||
|
|
||||||
|
func main() { |
||||||
|
if boot() != nil { |
||||||
|
os.Exit(-1) |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"math/rand" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
dict = "abcdefghijklmnopqrstuvwxyz0123456789" |
||||||
|
) |
||||||
|
|
||||||
|
func RandomString(length int) string { |
||||||
|
|
||||||
|
buf := make([]byte, length) |
||||||
|
for i := 0; i < length; i++ { |
||||||
|
buf[i] = dict[rand.Intn(len(dict)-1)] |
||||||
|
} |
||||||
|
return string(buf) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func init() { |
||||||
|
// Make sure to seed dsfault random generator.
|
||||||
|
rand.Seed(time.Now().UTC().UnixNano()) |
||||||
|
} |
||||||
@ -0,0 +1,41 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"net/http" |
||||||
|
) |
||||||
|
|
||||||
|
type Room struct { |
||||||
|
Name string `json:"name"` |
||||||
|
Url string `json:"url"` |
||||||
|
} |
||||||
|
|
||||||
|
type Rooms struct { |
||||||
|
} |
||||||
|
|
||||||
|
func (rooms Rooms) Post(r *http.Request) (int, interface{}) { |
||||||
|
|
||||||
|
name := RandomString(9) |
||||||
|
return 200, &Room{name, fmt.Sprintf("/%s", name)} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,102 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"log" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
roomMaxWorkers = 10000 |
||||||
|
roomExpiryDuration = 60 * time.Second |
||||||
|
) |
||||||
|
|
||||||
|
type RoomWorker struct { |
||||||
|
// References.
|
||||||
|
h *Hub |
||||||
|
|
||||||
|
// Data handling.
|
||||||
|
workers chan (func()) |
||||||
|
expired chan (bool) |
||||||
|
timer *time.Timer |
||||||
|
|
||||||
|
// Metadata.
|
||||||
|
Id string |
||||||
|
} |
||||||
|
|
||||||
|
func NewRoomWorker(h *Hub, id string) *RoomWorker { |
||||||
|
|
||||||
|
log.Printf("Creating worker for room '%s'\n", id) |
||||||
|
|
||||||
|
r := &RoomWorker{ |
||||||
|
h: h, |
||||||
|
Id: id, |
||||||
|
} |
||||||
|
r.workers = make(chan func(), roomMaxWorkers) |
||||||
|
r.expired = make(chan bool) |
||||||
|
|
||||||
|
// Create expire timer.
|
||||||
|
r.timer = time.AfterFunc(roomExpiryDuration, func() { |
||||||
|
log.Printf("Room worker not in use - cleaning up '%s'\n", r.Id) |
||||||
|
r.expired <- true |
||||||
|
}) |
||||||
|
|
||||||
|
return r |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (r *RoomWorker) Start() { |
||||||
|
|
||||||
|
// Main blocking worker.
|
||||||
|
L: |
||||||
|
for { |
||||||
|
|
||||||
|
r.timer.Reset(roomExpiryDuration) |
||||||
|
|
||||||
|
select { |
||||||
|
case <-r.expired: |
||||||
|
//fmt.Println("Work room expired", r.Id)
|
||||||
|
break L |
||||||
|
case w := <-r.workers: |
||||||
|
//fmt.Println("Running worker", r.Id, w)
|
||||||
|
w() |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
r.timer.Stop() |
||||||
|
close(r.workers) |
||||||
|
//fmt.Println("Exit worker", r.Id)
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (r *RoomWorker) Run(f func()) bool { |
||||||
|
|
||||||
|
select { |
||||||
|
case r.workers <- f: |
||||||
|
return true |
||||||
|
default: |
||||||
|
log.Printf("Room worker channel full or closed '%s'\n", r.Id) |
||||||
|
return false |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,178 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"encoding/json" |
||||||
|
"log" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
maxConferenceSize = 100 |
||||||
|
) |
||||||
|
|
||||||
|
type Server struct { |
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) OnRegister(c *Connection) { |
||||||
|
//log.Println("OnRegister", c.id)
|
||||||
|
if token, err := c.h.EncodeTicket("token", c.Id); err == nil { |
||||||
|
// Send stuff back.
|
||||||
|
s.Unicast(c, c.Id, &DataSelf{Type: "Self", Id: c.Id, Token: token, Version: c.h.version, Turn: c.h.CreateTurnData(c.Id), Stun: c.h.config.StunURIs}) |
||||||
|
} else { |
||||||
|
log.Println("Error in OnRegister", c.Idx, err) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) OnUnregister(c *Connection) { |
||||||
|
//log.Println("OnUnregister", c.id)
|
||||||
|
if c.Hello { |
||||||
|
s.Broadcast(c, &DataUser{Type: "Left", Id: c.Id, Status: "hard"}) |
||||||
|
} else { |
||||||
|
//log.Println("Ingoring OnUnregister because of no Hello", c.Idx)
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) OnText(c *Connection, b []byte) { |
||||||
|
|
||||||
|
//log.Printf("OnText from %d: %s\n", c.id, b)
|
||||||
|
var msg DataIncoming |
||||||
|
err := json.Unmarshal(b, &msg) |
||||||
|
if err != nil { |
||||||
|
log.Println("OnText error while decoding JSON", err) |
||||||
|
log.Printf("JSON:\n%s\n", b) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
switch msg.Type { |
||||||
|
case "Self": |
||||||
|
s.OnRegister(c) |
||||||
|
case "Hello": |
||||||
|
//log.Println("Hello", msg.Hello, c.Idx)
|
||||||
|
// TODO(longsleep): Filter room id and user agent.
|
||||||
|
s.UpdateUser(c, &UserUpdate{Types: []string{"Roomid", "Ua"}, Roomid: msg.Hello.Id, Ua: msg.Hello.Ua}) |
||||||
|
if c.Hello && c.Roomid != msg.Hello.Id { |
||||||
|
// Room changed.
|
||||||
|
s.Broadcast(c, &DataUser{Type: "Left", Id: c.Id, Status: "soft"}) |
||||||
|
} |
||||||
|
c.Roomid = msg.Hello.Id |
||||||
|
c.Hello = true |
||||||
|
s.Broadcast(c, &DataUser{Type: "Joined", Id: c.Id, Ua: msg.Hello.Ua}) |
||||||
|
case "Offer": |
||||||
|
// TODO(longsleep): Validate offer
|
||||||
|
s.Unicast(c, msg.Offer.To, msg.Offer) |
||||||
|
case "Candidate": |
||||||
|
// TODO(longsleep): Validate candidate
|
||||||
|
s.Unicast(c, msg.Candidate.To, msg.Candidate) |
||||||
|
case "Answer": |
||||||
|
// TODO(longsleep): Validate Answer
|
||||||
|
s.Unicast(c, msg.Answer.To, msg.Answer) |
||||||
|
case "Users": |
||||||
|
s.Users(c) |
||||||
|
case "Bye": |
||||||
|
s.Unicast(c, msg.Bye.To, msg.Bye) |
||||||
|
case "Status": |
||||||
|
//log.Println("Status", msg.Status)
|
||||||
|
rev := s.UpdateUser(c, &UserUpdate{Types: []string{"Status"}, Status: msg.Status.Status}) |
||||||
|
s.Broadcast(c, &DataUser{Type: "Status", Id: c.Id, Status: msg.Status.Status, Rev: rev}) |
||||||
|
case "Chat": |
||||||
|
// TODO(longsleep): Limit sent chat messages per incoming connection.
|
||||||
|
if !msg.Chat.Chat.NoEcho { |
||||||
|
s.Unicast(c, c.Id, msg.Chat) |
||||||
|
} |
||||||
|
msg.Chat.Chat.Time = time.Now().Format(time.RFC3339) |
||||||
|
if msg.Chat.To == "" { |
||||||
|
// TODO(longsleep): Check if chat broadcast is allowed.
|
||||||
|
s.Broadcast(c, msg.Chat) |
||||||
|
} else { |
||||||
|
s.Unicast(c, msg.Chat.To, msg.Chat) |
||||||
|
if msg.Chat.Chat.Mid != "" { |
||||||
|
// Send out delivery confirmation status chat message.
|
||||||
|
s.Unicast(c, c.Id, &DataChat{To: msg.Chat.To, Type: "Chat", Chat: &DataChatMessage{Mid: msg.Chat.Chat.Mid, Status: &DataChatMessageStatus{State: "sent"}}}) |
||||||
|
} |
||||||
|
} |
||||||
|
case "Conference": |
||||||
|
// Check conference maximum size.
|
||||||
|
if len(msg.Conference.Conference) > maxConferenceSize { |
||||||
|
log.Println("Refusing to create conference above limit.", len(msg.Conference.Conference)) |
||||||
|
} else { |
||||||
|
// Send conference update to anyone.
|
||||||
|
for _, id := range msg.Conference.Conference { |
||||||
|
if id != c.Id { |
||||||
|
//log.Println("participant", id)
|
||||||
|
s.Unicast(c, id, msg.Conference) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
case "Alive": |
||||||
|
s.Alive(c, msg.Alive) |
||||||
|
default: |
||||||
|
log.Println("OnText unhandled message type", msg.Type) |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) Unicast(c *Connection, to string, m interface{}) { |
||||||
|
|
||||||
|
b, err := json.Marshal(&DataOutgoing{From: c.Id, To: to, Data: m}) |
||||||
|
|
||||||
|
if err != nil { |
||||||
|
log.Println("Unicast error while encoding JSON", err) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
var msg = &MessageRequest{From: c.Id, To: to, Message: b} |
||||||
|
c.h.unicastHandler(msg) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) Broadcast(c *Connection, m interface{}) { |
||||||
|
|
||||||
|
b, err := json.Marshal(&DataOutgoing{From: c.Id, Data: m}) |
||||||
|
if err != nil { |
||||||
|
log.Println("Broadcast error while encoding JSON", err) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
var msg = &MessageRequest{From: c.Id, Message: b, Id: c.Roomid} |
||||||
|
c.h.broadcastHandler(msg) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) Users(c *Connection) { |
||||||
|
|
||||||
|
c.h.usersHandler(c) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) Alive(c *Connection, alive *DataAlive) { |
||||||
|
|
||||||
|
c.h.aliveHandler(c, alive) |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (s *Server) UpdateUser(c *Connection, userupdate *UserUpdate) uint64 { |
||||||
|
|
||||||
|
userupdate.Id = c.Id |
||||||
|
return c.h.userupdateHandler(userupdate) |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,115 @@ |
|||||||
|
/* This is a modified version of https://github.com/dougblack/sleepy
|
||||||
|
* with support for Gorilla muxing and full http.Request in handler. |
||||||
|
* |
||||||
|
* sleepy is released under the MIT License. |
||||||
|
*/ |
||||||
|
package sleepy |
||||||
|
|
||||||
|
import ( |
||||||
|
"encoding/json" |
||||||
|
"github.com/gorilla/mux" |
||||||
|
"net/http" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
GET = "GET" |
||||||
|
POST = "POST" |
||||||
|
PUT = "PUT" |
||||||
|
DELETE = "DELETE" |
||||||
|
) |
||||||
|
|
||||||
|
// GetSupported is the interface that provides the Get
|
||||||
|
// method a resource must support to receive HTTP GETs.
|
||||||
|
type GetSupported interface { |
||||||
|
Get(*http.Request) (int, interface{}) |
||||||
|
} |
||||||
|
|
||||||
|
// PostSupported is the interface that provides the Post
|
||||||
|
// method a resource must support to receive HTTP POSTs.
|
||||||
|
type PostSupported interface { |
||||||
|
Post(*http.Request) (int, interface{}) |
||||||
|
} |
||||||
|
|
||||||
|
// PutSupported is the interface that provides the Put
|
||||||
|
// method a resource must support to receive HTTP PUTs.
|
||||||
|
type PutSupported interface { |
||||||
|
Put(*http.Request) (int, interface{}) |
||||||
|
} |
||||||
|
|
||||||
|
// DeleteSupported is the interface that provides the Delete
|
||||||
|
// method a resource must support to receive HTTP DELETEs.
|
||||||
|
type DeleteSupported interface { |
||||||
|
Delete(*http.Request) (int, interface{}) |
||||||
|
} |
||||||
|
|
||||||
|
// An API manages a group of resources by routing requests
|
||||||
|
// to the correct method on a matching resource and marshalling
|
||||||
|
// the returned data to JSON for the HTTP response.
|
||||||
|
type API struct { |
||||||
|
mux *mux.Router |
||||||
|
} |
||||||
|
|
||||||
|
// NewAPI allocates and returns a new API.
|
||||||
|
func NewAPI(mux *mux.Router) *API { |
||||||
|
return &API{mux} |
||||||
|
} |
||||||
|
|
||||||
|
func (api *API) requestHandler(resource interface{}) http.HandlerFunc { |
||||||
|
return func(rw http.ResponseWriter, request *http.Request) { |
||||||
|
|
||||||
|
request.ParseForm() |
||||||
|
|
||||||
|
var handler func(*http.Request) (int, interface{}) |
||||||
|
|
||||||
|
switch request.Method { |
||||||
|
case GET: |
||||||
|
if resource, ok := resource.(GetSupported); ok { |
||||||
|
handler = resource.Get |
||||||
|
} |
||||||
|
case POST: |
||||||
|
if resource, ok := resource.(PostSupported); ok { |
||||||
|
handler = resource.Post |
||||||
|
} |
||||||
|
case PUT: |
||||||
|
if resource, ok := resource.(PutSupported); ok { |
||||||
|
handler = resource.Put |
||||||
|
} |
||||||
|
case DELETE: |
||||||
|
if resource, ok := resource.(DeleteSupported); ok { |
||||||
|
handler = resource.Delete |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if handler == nil { |
||||||
|
rw.WriteHeader(http.StatusMethodNotAllowed) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
code, data := handler(request) |
||||||
|
rw.Header().Set("Content-Type", "application/json; charset=utf-8") |
||||||
|
|
||||||
|
content, err := json.MarshalIndent(data, "", "\t") |
||||||
|
if err != nil { |
||||||
|
rw.WriteHeader(http.StatusInternalServerError) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
rw.WriteHeader(code) |
||||||
|
rw.Write(content) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// AddResource adds a new resource to an API. The API will route
|
||||||
|
// requests that match one of the given paths to the matching HTTP
|
||||||
|
// method on the resource.
|
||||||
|
func (api *API) AddResource(resource interface{}, paths ...string) { |
||||||
|
for _, path := range paths { |
||||||
|
api.mux.HandleFunc(path, api.requestHandler(resource)) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func (api *API) AddResourceWithWrapper(resource interface{}, wrapper func(handler http.HandlerFunc) http.HandlerFunc, paths ...string) { |
||||||
|
for _, path := range paths { |
||||||
|
api.mux.HandleFunc(path, wrapper(api.requestHandler(resource))) |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,26 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
type Token struct { |
||||||
|
Token string `json:"token"` |
||||||
|
Success bool `json:"success"` |
||||||
|
} |
||||||
@ -0,0 +1,90 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"encoding/csv" |
||||||
|
"log" |
||||||
|
"os" |
||||||
|
"strings" |
||||||
|
) |
||||||
|
|
||||||
|
type TokenProvider func(token string) string |
||||||
|
|
||||||
|
type TokenFile struct { |
||||||
|
Path string |
||||||
|
Info os.FileInfo |
||||||
|
Reload func() |
||||||
|
Tokens map[string]bool |
||||||
|
} |
||||||
|
|
||||||
|
func (tf *TokenFile) ReloadIfModified() error { |
||||||
|
info, err := os.Stat(tf.Path) |
||||||
|
if err != nil { |
||||||
|
log.Printf("Failed to loaad token file: %s", err) |
||||||
|
return err |
||||||
|
} |
||||||
|
if tf.Info == nil || tf.Info.ModTime() != info.ModTime() { |
||||||
|
tf.Info = info |
||||||
|
tf.Reload() |
||||||
|
} |
||||||
|
return nil |
||||||
|
} |
||||||
|
|
||||||
|
func reload_tokens(tf *TokenFile) { |
||||||
|
|
||||||
|
r, err := os.Open(tf.Path) |
||||||
|
if err != nil { |
||||||
|
panic(err) |
||||||
|
} |
||||||
|
|
||||||
|
csv_reader := csv.NewReader(r) |
||||||
|
csv_reader.Comma = ':' |
||||||
|
csv_reader.Comment = '#' |
||||||
|
csv_reader.TrimLeadingSpace = true |
||||||
|
|
||||||
|
records, err := csv_reader.ReadAll() |
||||||
|
if err != nil { |
||||||
|
panic(err) |
||||||
|
} |
||||||
|
|
||||||
|
tf.Tokens = make(map[string]bool) |
||||||
|
for _, record := range records { |
||||||
|
tf.Tokens[strings.ToLower(record[0])] = true |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func TokenFileProvider(filename string) TokenProvider { |
||||||
|
|
||||||
|
tf := &TokenFile{Path: filename} |
||||||
|
tf.Reload = func() { reload_tokens(tf) } |
||||||
|
return func(token string) string { |
||||||
|
tf.ReloadIfModified() |
||||||
|
_, exists := tf.Tokens[token] |
||||||
|
if !exists { |
||||||
|
return "" |
||||||
|
} else { |
||||||
|
return token |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,61 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"log" |
||||||
|
"net/http" |
||||||
|
"strings" |
||||||
|
) |
||||||
|
|
||||||
|
type Tokens struct { |
||||||
|
provider TokenProvider |
||||||
|
} |
||||||
|
|
||||||
|
func (tokens Tokens) Post(r *http.Request) (int, interface{}) { |
||||||
|
|
||||||
|
r.ParseForm() |
||||||
|
auth := r.FormValue("a") |
||||||
|
|
||||||
|
remoteAddr := r.RemoteAddr |
||||||
|
if remoteAddr == "@" || remoteAddr == "127.0.0.1" { |
||||||
|
if r.Header["X-Forwarded-For"][0] != "" { |
||||||
|
remoteAddr = r.Header["X-Forwarded-For"][0] |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if len(auth) > 100 { |
||||||
|
return 413, NewApiError("auth_too_large", "Auth too large") |
||||||
|
} |
||||||
|
|
||||||
|
valid := tokens.provider(strings.ToLower(auth)) |
||||||
|
response := &Token{Token: valid} |
||||||
|
|
||||||
|
if valid != "" { |
||||||
|
log.Printf("Good incoming token request: %s from %s\n", auth, remoteAddr) |
||||||
|
response.Success = true |
||||||
|
} else { |
||||||
|
log.Printf("Wrong incoming token request: %s from %s\n", auth, remoteAddr) |
||||||
|
} |
||||||
|
|
||||||
|
return 200, response |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,62 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import () |
||||||
|
|
||||||
|
type User struct { |
||||||
|
Id string |
||||||
|
Roomid string |
||||||
|
Ua string |
||||||
|
UpdateRev uint64 |
||||||
|
Status interface{} |
||||||
|
} |
||||||
|
|
||||||
|
func (u *User) Update(update *UserUpdate) uint64 { |
||||||
|
|
||||||
|
//user := reflect.ValueOf(&u).Elem()
|
||||||
|
|
||||||
|
for _, key := range update.Types { |
||||||
|
|
||||||
|
//fmt.Println("type update", key)
|
||||||
|
switch key { |
||||||
|
case "Roomid": |
||||||
|
u.Roomid = update.Roomid |
||||||
|
case "Ua": |
||||||
|
u.Ua = update.Ua |
||||||
|
case "Status": |
||||||
|
u.Status = update.Status |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
u.UpdateRev++ |
||||||
|
return u.UpdateRev |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
type UserUpdate struct { |
||||||
|
Id string |
||||||
|
Types []string |
||||||
|
Roomid string |
||||||
|
Ua string |
||||||
|
Status interface{} |
||||||
|
} |
||||||
@ -0,0 +1,86 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"github.com/gorilla/websocket" |
||||||
|
"log" |
||||||
|
"net/http" |
||||||
|
) |
||||||
|
|
||||||
|
const ( |
||||||
|
wsReadBufSize = 1024 |
||||||
|
wsWriteBufSize = 1024 |
||||||
|
) |
||||||
|
|
||||||
|
func makeWsHubHandler(h *Hub) http.HandlerFunc { |
||||||
|
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) { |
||||||
|
|
||||||
|
// Validate incoming request.
|
||||||
|
if r.Method != "GET" { |
||||||
|
w.WriteHeader(http.StatusMethodNotAllowed) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
// Upgrade to Websocket mode.
|
||||||
|
ws, err := websocket.Upgrade(w, r, nil, wsReadBufSize, wsWriteBufSize) |
||||||
|
if _, ok := err.(websocket.HandshakeError); ok { |
||||||
|
w.WriteHeader(http.StatusBadRequest) |
||||||
|
return |
||||||
|
} else if err != nil { |
||||||
|
log.Println(err) |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
// Read request details.
|
||||||
|
r.ParseForm() |
||||||
|
token := r.FormValue("t") |
||||||
|
remoteAddr := r.RemoteAddr |
||||||
|
if remoteAddr == "@" || remoteAddr == "127.0.0.1" { |
||||||
|
if r.Header["X-Forwarded-For"][0] != "" { |
||||||
|
remoteAddr = r.Header["X-Forwarded-For"][0] |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Create a new connection instance.
|
||||||
|
c := NewConnection(h, ws, remoteAddr) |
||||||
|
if token != "" { |
||||||
|
if err := c.reregister(token); err != nil { |
||||||
|
log.Println(err) |
||||||
|
w.WriteHeader(http.StatusInternalServerError) |
||||||
|
return |
||||||
|
} |
||||||
|
} else { |
||||||
|
if err := c.register(); err != nil { |
||||||
|
log.Println(err) |
||||||
|
w.WriteHeader(http.StatusInternalServerError) |
||||||
|
return |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Start pumps (readPump blocks).
|
||||||
|
go c.writePump() |
||||||
|
c.readPump() |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,138 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
package main |
||||||
|
|
||||||
|
type DataHello struct { |
||||||
|
Version string |
||||||
|
Ua string |
||||||
|
Id string |
||||||
|
} |
||||||
|
|
||||||
|
type DataOffer struct { |
||||||
|
Type string |
||||||
|
To string |
||||||
|
Offer interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type DataCandidate struct { |
||||||
|
Type string |
||||||
|
To string |
||||||
|
Candidate interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type DataAnswer struct { |
||||||
|
Type string |
||||||
|
To string |
||||||
|
Answer interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type DataSelf struct { |
||||||
|
Type string |
||||||
|
Id string |
||||||
|
Token string |
||||||
|
Version string |
||||||
|
Turn *DataTurn |
||||||
|
Stun []string |
||||||
|
} |
||||||
|
|
||||||
|
type DataTurn struct { |
||||||
|
Username string `json:"username"` |
||||||
|
Password string `json:"password"` |
||||||
|
Ttl int `json:"ttl"` |
||||||
|
Urls []string `json:"urls"` |
||||||
|
} |
||||||
|
|
||||||
|
type DataUser struct { |
||||||
|
Type string |
||||||
|
Id string |
||||||
|
Ua string |
||||||
|
Token string |
||||||
|
Version string |
||||||
|
Rev uint64 |
||||||
|
Status interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type DataBye struct { |
||||||
|
Type string |
||||||
|
To string |
||||||
|
Bye interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type DataStatus struct { |
||||||
|
Type string |
||||||
|
Status interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type DataChat struct { |
||||||
|
To string |
||||||
|
Type string |
||||||
|
Chat *DataChatMessage |
||||||
|
} |
||||||
|
|
||||||
|
type DataChatMessage struct { |
||||||
|
Mid string |
||||||
|
Message string |
||||||
|
Time string |
||||||
|
NoEcho bool `json:"NoEcho,omitempty"` |
||||||
|
Status interface{} |
||||||
|
} |
||||||
|
|
||||||
|
type DataChatMessageStatus struct { |
||||||
|
State string |
||||||
|
Mid string |
||||||
|
} |
||||||
|
|
||||||
|
type DataIncoming struct { |
||||||
|
Type string |
||||||
|
Hello *DataHello |
||||||
|
Offer *DataOffer |
||||||
|
Candidate *DataCandidate |
||||||
|
Answer *DataAnswer |
||||||
|
Bye *DataBye |
||||||
|
Status *DataStatus |
||||||
|
Chat *DataChat |
||||||
|
Conference *DataConference |
||||||
|
Alive *DataAlive |
||||||
|
} |
||||||
|
|
||||||
|
type DataOutgoing struct { |
||||||
|
Data interface{} |
||||||
|
From string |
||||||
|
To string |
||||||
|
} |
||||||
|
|
||||||
|
type DataUsers struct { |
||||||
|
Type string |
||||||
|
Users []*DataUser |
||||||
|
Index uint64 |
||||||
|
Batch uint64 |
||||||
|
} |
||||||
|
|
||||||
|
type DataConference struct { |
||||||
|
Id string |
||||||
|
Type string |
||||||
|
Conference []string |
||||||
|
} |
||||||
|
|
||||||
|
type DataAlive struct { |
||||||
|
Type string |
||||||
|
Alive uint64 |
||||||
|
} |
||||||
|
After Width: | Height: | Size: 4.4 KiB |
@ -0,0 +1,53 @@ |
|||||||
|
#!/usr/bin/python |
||||||
|
|
||||||
|
import wave |
||||||
|
import os |
||||||
|
import glob |
||||||
|
import json |
||||||
|
import math |
||||||
|
|
||||||
|
silenceDuration = 0.05 # Seconds of silence between merged files |
||||||
|
outfile = "sprite1.wav" # Output file. Will be saved in the path below. |
||||||
|
|
||||||
|
def main(folder="./files"): |
||||||
|
|
||||||
|
currentTime = 0 |
||||||
|
sprite = {} |
||||||
|
|
||||||
|
# Open output file |
||||||
|
output = wave.open(outfile, 'wb') |
||||||
|
|
||||||
|
# Loop through files in folder and append to outfile |
||||||
|
for i, infile in enumerate(glob.glob(os.path.join(folder, '*.wav'))): |
||||||
|
|
||||||
|
# Open file and get info |
||||||
|
w = wave.open(infile, 'rb') |
||||||
|
soundDuration = w.getnframes() / float(w.getframerate()) |
||||||
|
|
||||||
|
# First file: determine general parameters- Create silence. |
||||||
|
if i == 0: |
||||||
|
print "params", w.getparams() |
||||||
|
output.setparams(w.getparams()) |
||||||
|
silenceData = [0] * int(w.getframerate() * 2 * silenceDuration) # N 0's where N are the number of samples corresponding to the duration specified in "silenceDuration" |
||||||
|
silenceFrames = "".join(wave.struct.pack('h', item) for item in silenceData) |
||||||
|
|
||||||
|
# Output sound + silence to file |
||||||
|
output.writeframes(w.readframes(w.getnframes())) |
||||||
|
output.writeframes(silenceFrames) |
||||||
|
w.close() |
||||||
|
|
||||||
|
# Create sprite data for Howler |
||||||
|
start = int(math.floor(currentTime * 1000)) |
||||||
|
duration = int(math.ceil((soundDuration) * 1000)) |
||||||
|
sprite[os.path.basename(infile[:-4])] = [start, duration] |
||||||
|
print "infile", infile, start, duration |
||||||
|
currentTime += (soundDuration + silenceDuration) |
||||||
|
|
||||||
|
# Yay, the worst is behind us. Close output file |
||||||
|
output.close() |
||||||
|
|
||||||
|
# Output howler sprite data |
||||||
|
print json.dumps(sprite, sort_keys=True, indent=4, separators=(',', ': ')) |
||||||
|
|
||||||
|
if __name__ == "__main__": |
||||||
|
main() |
||||||
@ -0,0 +1,10 @@ |
|||||||
|
#!/bin/bash |
||||||
|
|
||||||
|
sox -v .4 sprite1.wav .tmp-sprite1.wav |
||||||
|
|
||||||
|
avconv -y -i .tmp-sprite1.wav -aq 2 -acodec libmp3lame sprite1.mp3 |
||||||
|
avconv -y -i .tmp-sprite1.wav -aq 2 -acodec libvorbis sprite1.ogg |
||||||
|
|
||||||
|
rm -f .tmp-sprite1.wav |
||||||
|
|
||||||
|
cp -fv sprite1.{mp3,ogg} ../../static/sounds |
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,28 @@ |
|||||||
|
VERSION := "1.0" |
||||||
|
PROJECT := "Spreed Speak Freely" |
||||||
|
COPYRIGHT := "struktur AG" |
||||||
|
EMAIL := "simon@struktur.de" |
||||||
|
ROOT := "$(CURDIR)/../.." |
||||||
|
|
||||||
|
# Tools
|
||||||
|
NODEJS := nodejs |
||||||
|
PYBABEL := pybabel |
||||||
|
NODE_PATH := /usr/local/lib/node_modules:/usr/lib/node_modules |
||||||
|
|
||||||
|
extract: |
||||||
|
$(PYBABEL) extract -F babel.cfg -k _n:1,2 -k _ \
|
||||||
|
--no-location --project=$(PROJECT) --version=$(VERSION) \
|
||||||
|
--copyright-holder=$(COPYRIGHT) --msgid-bugs-address=$(EMAIL) \
|
||||||
|
-o messages.pot \
|
||||||
|
$(ROOT)/html \
|
||||||
|
$(ROOT)/static/partials \
|
||||||
|
$(ROOT)/static/js/ \
|
||||||
|
$(ROOT)/static/js/controllers \
|
||||||
|
$(ROOT)/static/js/directives \
|
||||||
|
$(ROOT)/static/js/services |
||||||
|
|
||||||
|
update: |
||||||
|
$(PYBABEL) update -l de -i messages.pot -o messages-de.po |
||||||
|
|
||||||
|
build: update |
||||||
|
NODE_PATH=$(NODE_PATH) $(NODEJS) helpers/po2json messages-de.po $(ROOT)/static/translation/messages-de.json |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
[javascript:*.js] |
||||||
|
encoding = utf-8 |
||||||
|
|
||||||
|
[jinja2: *.html] |
||||||
|
encoding = utf-8 |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
#!/usr/bin/env nodejs |
||||||
|
|
||||||
|
var po2json = require('po2json'), |
||||||
|
fs = require('fs'), |
||||||
|
assert = require('assert'), |
||||||
|
argv = process.argv; |
||||||
|
|
||||||
|
assert.equal(argv.length, 4, 'Usage: po2json <input_file.po> <output_file.json>'); |
||||||
|
|
||||||
|
var result = po2json.parseFileSync(argv[2], { stringify: true, format: 'jed', pretty: false }), |
||||||
|
stream = fs.createWriteStream(argv[3], {}); |
||||||
|
|
||||||
|
stream.write(result); |
||||||
@ -0,0 +1,413 @@ |
|||||||
|
# German translations for Spreed Speak Freely. |
||||||
|
# Copyright (C) 2014 struktur AG |
||||||
|
# This file is distributed under the same license as Spreed Speak Freely. |
||||||
|
# project. |
||||||
|
# Simon Eisenmann <simon@struktur.de>, 2013. |
||||||
|
# |
||||||
|
msgid "" |
||||||
|
msgstr "" |
||||||
|
"Project-Id-Version: Spreed Speak Freely\n" |
||||||
|
"Report-Msgid-Bugs-To: simon@struktur.de\n" |
||||||
|
"POT-Creation-Date: 2014-02-13 16:01+0100\n" |
||||||
|
"PO-Revision-Date: 2014-02-01 18:24+0100\n" |
||||||
|
"Last-Translator: Simon Eisenmann <simon@struktur.de>\n" |
||||||
|
"Language-Team: de <LL@li.org>\n" |
||||||
|
"Plural-Forms: nplurals=1; plural=0\n" |
||||||
|
"MIME-Version: 1.0\n" |
||||||
|
"Content-Type: text/plain; charset=utf-8\n" |
||||||
|
"Content-Transfer-Encoding: 8bit\n" |
||||||
|
"Generated-By: Babel 0.9.6\n" |
||||||
|
|
||||||
|
msgid "Share your screen" |
||||||
|
msgstr "Bildschirm freigeben" |
||||||
|
|
||||||
|
msgid "Mute microphone" |
||||||
|
msgstr "Mikrofon abschalten" |
||||||
|
|
||||||
|
msgid "Turn camera off" |
||||||
|
msgstr "Kamera abschalten" |
||||||
|
|
||||||
|
msgid "Settings" |
||||||
|
msgstr "Einstellungen" |
||||||
|
|
||||||
|
msgid "Your audio level" |
||||||
|
msgstr "Ihr Audio-Pegel" |
||||||
|
|
||||||
|
msgid "Start chat" |
||||||
|
msgstr "Chat starten" |
||||||
|
|
||||||
|
msgid "Start video call" |
||||||
|
msgstr "Video-Anruf starten" |
||||||
|
|
||||||
|
msgid "Start audio conference" |
||||||
|
msgstr "Audio-Konferenz starten" |
||||||
|
|
||||||
|
msgid "No other users online" |
||||||
|
msgstr "Niemand sonst online" |
||||||
|
|
||||||
|
msgid "Peer to peer" |
||||||
|
msgstr "Peer-to-peer" |
||||||
|
|
||||||
|
msgid "Maximize" |
||||||
|
msgstr "Maximieren" |
||||||
|
|
||||||
|
msgid "Normal size" |
||||||
|
msgstr "Normale Größe" |
||||||
|
|
||||||
|
msgid "Minimize" |
||||||
|
msgstr "Minimieren" |
||||||
|
|
||||||
|
msgid "Close chat" |
||||||
|
msgstr "Chat schließen" |
||||||
|
|
||||||
|
msgid "is typing..." |
||||||
|
msgstr " schreibt gerade..." |
||||||
|
|
||||||
|
msgid "has stopped typing..." |
||||||
|
msgstr " schreibt nicht mehr..." |
||||||
|
|
||||||
|
msgid "Type here to chat..." |
||||||
|
msgstr "Nachricht hier eingeben..." |
||||||
|
|
||||||
|
msgid "Send" |
||||||
|
msgstr "Senden" |
||||||
|
|
||||||
|
msgid "File sharing" |
||||||
|
msgstr "Datei-Austausch" |
||||||
|
|
||||||
|
msgid "File is no longer available" |
||||||
|
msgstr "Datei ist nicht mehr verfügbar" |
||||||
|
|
||||||
|
msgid "Download" |
||||||
|
msgstr "Laden" |
||||||
|
|
||||||
|
msgid "Open" |
||||||
|
msgstr "Öffnen" |
||||||
|
|
||||||
|
msgid "Cancel" |
||||||
|
msgstr "Abbrechen" |
||||||
|
|
||||||
|
msgid "Unshare" |
||||||
|
msgstr "Zurückziehen" |
||||||
|
|
||||||
|
msgid "Retry" |
||||||
|
msgstr "Nochmal versuchen" |
||||||
|
|
||||||
|
msgid "Download failed." |
||||||
|
msgstr "Fehler beim Download." |
||||||
|
|
||||||
|
msgid "Change room" |
||||||
|
msgstr "Raum wechseln" |
||||||
|
|
||||||
|
msgid "Room" |
||||||
|
msgstr "Raum" |
||||||
|
|
||||||
|
msgid "Main" |
||||||
|
msgstr "Standard" |
||||||
|
|
||||||
|
msgid "Leave room" |
||||||
|
msgstr "Raum verlassen" |
||||||
|
|
||||||
|
msgid "Current room" |
||||||
|
msgstr "Raum" |
||||||
|
|
||||||
|
msgid "Your picture" |
||||||
|
msgstr "Ihr Bild" |
||||||
|
|
||||||
|
msgid "Take picture" |
||||||
|
msgstr "Bild machen" |
||||||
|
|
||||||
|
msgid "Waiting for camera" |
||||||
|
msgstr "Warte auf die Kamera" |
||||||
|
|
||||||
|
msgid "Your name" |
||||||
|
msgstr "Ihr Name" |
||||||
|
|
||||||
|
msgid "Name" |
||||||
|
msgstr "Name" |
||||||
|
|
||||||
|
msgid "Your picture and name are visible to others." |
||||||
|
msgstr "Ihr Bild und Name werden anderen Benutzern angezeigt." |
||||||
|
|
||||||
|
msgid "Microphone" |
||||||
|
msgstr "Mikrofon" |
||||||
|
|
||||||
|
msgid "Camera" |
||||||
|
msgstr "Kamera" |
||||||
|
|
||||||
|
msgid "Video quality" |
||||||
|
msgstr "Video-Qualität" |
||||||
|
|
||||||
|
msgid "Low" |
||||||
|
msgstr "Gering" |
||||||
|
|
||||||
|
msgid "High" |
||||||
|
msgstr "Hoch" |
||||||
|
|
||||||
|
msgid "720p" |
||||||
|
msgstr "720p" |
||||||
|
|
||||||
|
msgid "1080p" |
||||||
|
msgstr "1080p" |
||||||
|
|
||||||
|
msgid "Language" |
||||||
|
msgstr "Sprache" |
||||||
|
|
||||||
|
msgid "Use browser language" |
||||||
|
msgstr "Browsereinstellung" |
||||||
|
|
||||||
|
msgid "Language changes become active on reload." |
||||||
|
msgstr "Sie müssen die Seite neu laden, um die Spracheinstellung zu übernehmen." |
||||||
|
|
||||||
|
msgid "Default room" |
||||||
|
msgstr "Standard Raum" |
||||||
|
|
||||||
|
msgid "Set alternative room to join at start." |
||||||
|
msgstr " Raum wird beim Start automatisch betreten." |
||||||
|
|
||||||
|
msgid "Desktop notification" |
||||||
|
msgstr "Desktop-Benachrichtigung" |
||||||
|
|
||||||
|
msgid "Enable" |
||||||
|
msgstr "Aktivieren" |
||||||
|
|
||||||
|
msgid "Denied - check your browser settings" |
||||||
|
msgstr "Verweigert - prüfen Sie die Browser-Einstellungen" |
||||||
|
|
||||||
|
msgid "Allowed" |
||||||
|
msgstr "Aktiviert" |
||||||
|
|
||||||
|
msgid "Advanced settings" |
||||||
|
msgstr "Erweiterte Einstellungen" |
||||||
|
|
||||||
|
msgid "Stereo audio" |
||||||
|
msgstr "Stereo-Audio" |
||||||
|
|
||||||
|
msgid "Max video frame rate" |
||||||
|
msgstr "Max. Bildwiederholrate" |
||||||
|
|
||||||
|
msgid "auto" |
||||||
|
msgstr "auto" |
||||||
|
|
||||||
|
msgid "Media screen sharing" |
||||||
|
msgstr "Media Bildschirmfreigabe" |
||||||
|
|
||||||
|
msgid "Chrome usermedia screen capture feature is required." |
||||||
|
msgstr "Das Chrome Feature Bildschirmaufzeichnung in getUserMedia() wird benötigt." |
||||||
|
|
||||||
|
msgid "Experimental settings" |
||||||
|
msgstr "Experimentelle Einstellungen" |
||||||
|
|
||||||
|
msgid "Show advanced settings" |
||||||
|
msgstr "Erweiterte Einstellungen anzeigen" |
||||||
|
|
||||||
|
msgid "Hide advanced settings" |
||||||
|
msgstr "Erweiterte Einstellungen ausblenden" |
||||||
|
|
||||||
|
msgid "Remember settings" |
||||||
|
msgstr "Einstellungen merken" |
||||||
|
|
||||||
|
msgid "Apply" |
||||||
|
msgstr "Übernehmen" |
||||||
|
|
||||||
|
msgid "Initializing" |
||||||
|
msgstr "Initialisiere" |
||||||
|
|
||||||
|
msgid "Online" |
||||||
|
msgstr "Online" |
||||||
|
|
||||||
|
msgid "Calling" |
||||||
|
msgstr "Verbinde mit" |
||||||
|
|
||||||
|
msgid "Hangup" |
||||||
|
msgstr "Auflegen" |
||||||
|
|
||||||
|
msgid "In call with" |
||||||
|
msgstr "Verbunden mit" |
||||||
|
|
||||||
|
msgid "Conference with" |
||||||
|
msgstr "Konferenz mit" |
||||||
|
|
||||||
|
msgid "Your are offline" |
||||||
|
msgstr "Sie sind offline" |
||||||
|
|
||||||
|
msgid "Go online" |
||||||
|
msgstr "Online gehen" |
||||||
|
|
||||||
|
msgid "Connection interrupted" |
||||||
|
msgstr "Verbindung unterbrochen" |
||||||
|
|
||||||
|
msgid "An error occured" |
||||||
|
msgstr "Ein Fehler ist aufgetreten" |
||||||
|
|
||||||
|
msgid "Incoming call" |
||||||
|
msgstr "Eingehender Anruf" |
||||||
|
|
||||||
|
msgid "from" |
||||||
|
msgstr "von" |
||||||
|
|
||||||
|
msgid "Accept call" |
||||||
|
msgstr "Anruf annehmen" |
||||||
|
|
||||||
|
msgid "Reject" |
||||||
|
msgstr "Abweisen" |
||||||
|
|
||||||
|
msgid "Waiting for camera/microphone access" |
||||||
|
msgstr "Warte auf Kamera/Mikrofon Freigabe" |
||||||
|
|
||||||
|
msgid "Checking camera and microphone access." |
||||||
|
msgstr "Prüfe Zugriff auf Kamera und Mikrofon." |
||||||
|
|
||||||
|
msgid "Select one of the users from the online list to start a video call." |
||||||
|
msgstr "Wählen Sie einen Benutzer aus der Liste, um einen Video-Anruf zu starten." |
||||||
|
|
||||||
|
msgid "Hover over users in the list for more actions." |
||||||
|
msgstr "" |
||||||
|
"Halten Sie die Maus über die Benutzer in der Liste, um weitere Aktionen " |
||||||
|
"anzuzeigen." |
||||||
|
|
||||||
|
msgid "Double click on video for fullscreen when in a call." |
||||||
|
msgstr "Doppelklick auf ein Video für Vollbild-Modus." |
||||||
|
|
||||||
|
msgid "Drag files into a chat window to share files with this room or person." |
||||||
|
msgstr "" |
||||||
|
"Ziehen Sie Dateien in ein Chat-Fenster, um Dateien mit diesem Raum oder " |
||||||
|
"einer Person zu teilen." |
||||||
|
|
||||||
|
msgid "Please allow access to your camera and microphone." |
||||||
|
msgstr "Bitte gestatten Sie den Zugriff auf Ihre Kamera und Mikrofon." |
||||||
|
|
||||||
|
msgid "Camera / microphone access required." |
||||||
|
msgstr "Kamera / Mikrofon Zugriff wird benötigt." |
||||||
|
|
||||||
|
msgid "" |
||||||
|
"Please check your browser settings and allow camera and microphone access" |
||||||
|
" for this site." |
||||||
|
msgstr "" |
||||||
|
"Bitte prüfen Sie Ihre Browser-Einstellungen und gestatten Sie den Zugriff" |
||||||
|
" auf Kamera und Mikrofon für diese Seite." |
||||||
|
|
||||||
|
msgid "Skip check" |
||||||
|
msgstr "Überspringen" |
||||||
|
|
||||||
|
msgid "Click here for help (Google Chrome)." |
||||||
|
msgstr "Hier klicken für weitere Infos (Google Chrome)." |
||||||
|
|
||||||
|
msgid "Please set your user details and settings." |
||||||
|
msgstr "Bitte vervollständigen Sie Ihre Daten und Einstellungen." |
||||||
|
|
||||||
|
msgid "" |
||||||
|
"Please note that some settings require you to reload or to make a new " |
||||||
|
"call to become effective." |
||||||
|
msgstr "" |
||||||
|
"Bitte beachten Sie, dass einige Einstellungen erst nach einem Reload oder" |
||||||
|
" einem neuen Anruf aktiv werden." |
||||||
|
|
||||||
|
msgid "Peer to peer chat active." |
||||||
|
msgstr "Peer-to-peer Chat ist aktiv." |
||||||
|
|
||||||
|
msgid "Peer to peer chat is now off." |
||||||
|
msgstr "Peer-to-peer Chat ist nicht mehr aktiv." |
||||||
|
|
||||||
|
msgid " is now offline." |
||||||
|
msgstr " ist jetzt offline." |
||||||
|
|
||||||
|
msgid " is now online." |
||||||
|
msgstr " ist jetzt online." |
||||||
|
|
||||||
|
msgid "You share file:" |
||||||
|
msgstr "Sie geben eine Datei frei:" |
||||||
|
|
||||||
|
msgid "Incoming file:" |
||||||
|
msgstr "Eingehende Datei:" |
||||||
|
|
||||||
|
msgid "Quit from Spreed Me?" |
||||||
|
msgstr "Spreed Me beenden?" |
||||||
|
|
||||||
|
msgid "Restart required to apply updates. Click ok to restart now." |
||||||
|
msgstr "" |
||||||
|
"Es stehen Updates zur Verfügung. Klicken Sie Ok um die Anwendung neu zu " |
||||||
|
"starten." |
||||||
|
|
||||||
|
msgid "Failed to access camera/microphone." |
||||||
|
msgstr "Fehler beim Zugriff auf die Kamera / das Mikrofon." |
||||||
|
|
||||||
|
msgid "Failed to establish peer connection." |
||||||
|
msgstr "Fehler beim Verbindungsaufbau." |
||||||
|
|
||||||
|
msgid "We are sorry but something went wrong. Boo boo." |
||||||
|
msgstr "Leider ist ein Fehler aufgetreten. Buhuhu." |
||||||
|
|
||||||
|
msgid "Oops" |
||||||
|
msgstr "Hoppla" |
||||||
|
|
||||||
|
msgid "Peer connection failed. Check your settings." |
||||||
|
msgstr "Verbindung fehlgeschlagen. Überprüfen Sie Ihre Einstellungen." |
||||||
|
|
||||||
|
msgid "User hung up because of error." |
||||||
|
msgstr "Teilnehmer hat aufgelegt, da ein Fehler aufgetreten ist." |
||||||
|
|
||||||
|
msgid " is busy. Try again later." |
||||||
|
msgstr " ist in einem Gespräch. Probieren Sie es später." |
||||||
|
|
||||||
|
msgid " rejected your call." |
||||||
|
msgstr " hat Ihren Anruf abgelehnt." |
||||||
|
|
||||||
|
msgid " does not pick up." |
||||||
|
msgstr " nimmt nicht ab." |
||||||
|
|
||||||
|
msgid " tried to call you." |
||||||
|
msgstr " hat versucht Sie anzurufen." |
||||||
|
|
||||||
|
msgid " called you." |
||||||
|
msgstr " hat Sie angerufen." |
||||||
|
|
||||||
|
msgid "Your browser does not support WebRTC. No calls possible." |
||||||
|
msgstr "Ihr Browser unterstützt kein WebRTC. Keine Anrufe möglich." |
||||||
|
|
||||||
|
msgid "Chat with" |
||||||
|
msgstr "Chat mit" |
||||||
|
|
||||||
|
msgid "Message from " |
||||||
|
msgstr "Nachricht von " |
||||||
|
|
||||||
|
msgid "Group chat" |
||||||
|
msgstr "Gruppen-Chat" |
||||||
|
|
||||||
|
msgid "Your browser does not support file transfer." |
||||||
|
msgstr "Mit Ihrem Browser können keine Dateien übertragen werden." |
||||||
|
|
||||||
|
msgid "Error" |
||||||
|
msgstr "Fehler" |
||||||
|
|
||||||
|
msgid "Hint" |
||||||
|
msgstr "Hinweis" |
||||||
|
|
||||||
|
msgid "Please confirm" |
||||||
|
msgstr "Bitte bestätigen" |
||||||
|
|
||||||
|
msgid "More information required" |
||||||
|
msgstr "Weitere Informationen nötig" |
||||||
|
|
||||||
|
msgid "Ok" |
||||||
|
msgstr "Ok" |
||||||
|
|
||||||
|
msgid "Close" |
||||||
|
msgstr "Schließen" |
||||||
|
|
||||||
|
msgid "Access code required" |
||||||
|
msgstr "Bitte Zugriffscode eingeben" |
||||||
|
|
||||||
|
msgid "Access denied" |
||||||
|
msgstr "Zugriff verweigert" |
||||||
|
|
||||||
|
msgid "Please provide a valid access code." |
||||||
|
msgstr "Bitte geben Sie einen gültigen Zugriffscode ein." |
||||||
|
|
||||||
|
msgid "" |
||||||
|
"Failed to verify access code. Check your Internet connection and try " |
||||||
|
"again." |
||||||
|
msgstr "" |
||||||
|
"Der Zugriffscode konnte nicht überprueft werden. Bitte prüfen Sie Ihre " |
||||||
|
"Internetverbindung." |
||||||
|
|
||||||
@ -0,0 +1,401 @@ |
|||||||
|
# Translations template for Spreed Speak Freely. |
||||||
|
# Copyright (C) 2014 struktur AG |
||||||
|
# This file is distributed under the same license as the Spreed Speak Freely |
||||||
|
# project. |
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, 2014. |
||||||
|
# |
||||||
|
#, fuzzy |
||||||
|
msgid "" |
||||||
|
msgstr "" |
||||||
|
"Project-Id-Version: Spreed Speak Freely 1.0\n" |
||||||
|
"Report-Msgid-Bugs-To: simon@struktur.de\n" |
||||||
|
"POT-Creation-Date: 2014-02-13 16:01+0100\n" |
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n" |
||||||
|
"MIME-Version: 1.0\n" |
||||||
|
"Content-Type: text/plain; charset=utf-8\n" |
||||||
|
"Content-Transfer-Encoding: 8bit\n" |
||||||
|
"Generated-By: Babel 0.9.6\n" |
||||||
|
|
||||||
|
msgid "Share your screen" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Mute microphone" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Turn camera off" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Settings" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Your audio level" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Start chat" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Start video call" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Start audio conference" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "No other users online" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Peer to peer" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Maximize" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Normal size" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Minimize" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Close chat" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "is typing..." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "has stopped typing..." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Type here to chat..." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Send" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "File sharing" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "File is no longer available" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Download" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Open" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Cancel" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Unshare" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Retry" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Download failed." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Change room" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Room" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Main" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Leave room" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Current room" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Your picture" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Take picture" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Waiting for camera" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Your name" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Name" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Your picture and name are visible to others." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Microphone" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Camera" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Video quality" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Low" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "High" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "720p" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "1080p" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Language" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Use browser language" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Language changes become active on reload." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Default room" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Set alternative room to join at start." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Desktop notification" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Enable" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Denied - check your browser settings" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Allowed" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Advanced settings" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Stereo audio" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Max video frame rate" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "auto" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Media screen sharing" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Chrome usermedia screen capture feature is required." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Experimental settings" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Show advanced settings" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Hide advanced settings" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Remember settings" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Apply" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Initializing" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Online" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Calling" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Hangup" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "In call with" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Conference with" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Your are offline" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Go online" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Connection interrupted" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "An error occured" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Incoming call" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "from" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Accept call" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Reject" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Waiting for camera/microphone access" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Checking camera and microphone access." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Select one of the users from the online list to start a video call." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Hover over users in the list for more actions." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Double click on video for fullscreen when in a call." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Drag files into a chat window to share files with this room or person." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Please allow access to your camera and microphone." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Camera / microphone access required." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "" |
||||||
|
"Please check your browser settings and allow camera and microphone access" |
||||||
|
" for this site." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Skip check" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Click here for help (Google Chrome)." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Please set your user details and settings." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "" |
||||||
|
"Please note that some settings require you to reload or to make a new " |
||||||
|
"call to become effective." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Peer to peer chat active." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Peer to peer chat is now off." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid " is now offline." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid " is now online." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "You share file:" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Incoming file:" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Quit from Spreed Me?" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Restart required to apply updates. Click ok to restart now." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Failed to access camera/microphone." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Failed to establish peer connection." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "We are sorry but something went wrong. Boo boo." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Oops" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Peer connection failed. Check your settings." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "User hung up because of error." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid " is busy. Try again later." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid " rejected your call." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid " does not pick up." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid " tried to call you." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid " called you." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Your browser does not support WebRTC. No calls possible." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Chat with" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Message from " |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Group chat" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Your browser does not support file transfer." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Error" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Hint" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Please confirm" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "More information required" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Ok" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Close" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Access code required" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Access denied" |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "Please provide a valid access code." |
||||||
|
msgstr "" |
||||||
|
|
||||||
|
msgid "" |
||||||
|
"Failed to verify access code. Check your Internet connection and try " |
||||||
|
"again." |
||||||
|
msgstr "" |
||||||
|
|
||||||
@ -0,0 +1,25 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
// Remove boostrap 3 modal scroll bar. |
||||||
|
.modal { |
||||||
|
overflow-y: auto; |
||||||
|
} |
||||||
@ -0,0 +1,54 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#audiolevel { |
||||||
|
position:fixed; |
||||||
|
top: 38px; |
||||||
|
left: 0px; |
||||||
|
right: 0px; |
||||||
|
width:400px; |
||||||
|
margin:0 auto; |
||||||
|
z-index:6; |
||||||
|
} |
||||||
|
#audiolevel .audio-level { |
||||||
|
height: 4px; |
||||||
|
-webkit-border-bottom-right-radius: 2px; |
||||||
|
-webkit-border-bottom-left-radius: 2px; |
||||||
|
-moz-border-radius-bottomright: 2px; |
||||||
|
-moz-border-radius-bottomleft: 2px; |
||||||
|
border-bottom-right-radius: 2px; |
||||||
|
border-bottom-left-radius: 2px; |
||||||
|
background: #9dd53a; /* Old browsers */ |
||||||
|
background: -moz-linear-gradient(top, #9dd53a 0%, #a1d54f 50%, #80c217 51%, #7cbc0a 100%); /* FF3.6+ */ |
||||||
|
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#9dd53a), color-stop(50%,#a1d54f), color-stop(51%,#80c217), color-stop(100%,#7cbc0a)); /* Chrome,Safari4+ */ |
||||||
|
background: -webkit-linear-gradient(top, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* Chrome10+,Safari5.1+ */ |
||||||
|
background: -o-linear-gradient(top, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* Opera 11.10+ */ |
||||||
|
background: -ms-linear-gradient(top, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* IE10+ */ |
||||||
|
background: linear-gradient(to bottom, #9dd53a 0%,#a1d54f 50%,#80c217 51%,#7cbc0a 100%); /* W3C */ |
||||||
|
width:0%; |
||||||
|
position:absolute; |
||||||
|
margin:0 auto; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
-webkit-transition: width 0.05s ease-in-out; |
||||||
|
-moz-transition: width 0.05s ease-in-out; |
||||||
|
-o-transition: width 0.05s ease-in-out; |
||||||
|
transition: width 0.05s ease-in-out; |
||||||
|
} |
||||||
@ -0,0 +1,59 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#audiovideo { |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
top:44px; |
||||||
|
bottom:0px; |
||||||
|
right:260px; |
||||||
|
boder-top:1px solid $bordercolor; |
||||||
|
} |
||||||
|
#audiovideo.fullscreen { |
||||||
|
top:0px; |
||||||
|
right:0px; |
||||||
|
bottom:0px; |
||||||
|
left:0px; |
||||||
|
background:black; |
||||||
|
} |
||||||
|
#audiovideo.fullscreen .remoteVideo .peeractions { |
||||||
|
display:none; |
||||||
|
} |
||||||
|
#audiovideo.leftsided { |
||||||
|
width:150px |
||||||
|
} |
||||||
|
#audiovideo.leftsided .remoteVideo .peerlabel { |
||||||
|
font-size:12px; |
||||||
|
font-weight:bold; |
||||||
|
} |
||||||
|
#audiovideo.leftsided .remoteVideo .peeractions i { |
||||||
|
font-size:1em; |
||||||
|
} |
||||||
|
@media only screen and (max-width: 630px) { |
||||||
|
#audiovideo.leftsided { |
||||||
|
display:none; |
||||||
|
} |
||||||
|
} |
||||||
|
@media only screen and (max-width:590px) { |
||||||
|
#audiovideo { |
||||||
|
right:0px; |
||||||
|
z-index:12; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,164 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#bar { |
||||||
|
-webkit-box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.2); |
||||||
|
box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.2); |
||||||
|
position: fixed; |
||||||
|
top: 0; |
||||||
|
left: 0; |
||||||
|
right: 0; |
||||||
|
min-height: 44px; |
||||||
|
background-color: $componentbg; |
||||||
|
color: $componentfg1; |
||||||
|
font-size: 1em; |
||||||
|
font-weight: bold; |
||||||
|
line-height: 40px; |
||||||
|
text-align: center; |
||||||
|
-webkit-touch-callout: none; |
||||||
|
-webkit-user-select: none; |
||||||
|
-khtml-user-select: none; |
||||||
|
-moz-user-select: none; |
||||||
|
-ms-user-select: none; |
||||||
|
user-select: none; |
||||||
|
z-index:5; |
||||||
|
} |
||||||
|
#bar > .left { |
||||||
|
position: absolute; |
||||||
|
left:0px; |
||||||
|
top:0px; |
||||||
|
bottom:0px; |
||||||
|
padding-left:12px; |
||||||
|
} |
||||||
|
#bar .logo { |
||||||
|
font-size:11px; |
||||||
|
line-height:11px; |
||||||
|
font-weight:normal; |
||||||
|
color:black; |
||||||
|
width:106px; |
||||||
|
height:32px; |
||||||
|
background-size:106px 32px; |
||||||
|
background-repeat:no-repeat; |
||||||
|
display: inline-block; |
||||||
|
text-align:left; |
||||||
|
} |
||||||
|
#bar .logo > span { |
||||||
|
position: relative; |
||||||
|
left: 38px; |
||||||
|
top: 26px; |
||||||
|
font-style: italic; |
||||||
|
} |
||||||
|
#bar > .right { |
||||||
|
position: absolute; |
||||||
|
right:0px; |
||||||
|
top:1px; |
||||||
|
bottom:1px; |
||||||
|
padding-right:8px; |
||||||
|
} |
||||||
|
#bar > .left > *, #bar > .right > * { |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
#bar > .right .btn { |
||||||
|
border-color:transparent; |
||||||
|
background:transparent; |
||||||
|
color:rgba(0,0,0,0.3); |
||||||
|
height:42px; |
||||||
|
width:42px; |
||||||
|
display: inline-block; |
||||||
|
font-size:24px; |
||||||
|
padding:0px; |
||||||
|
line-height:40px; |
||||||
|
text-align:center; |
||||||
|
} |
||||||
|
#bar > .right .btn:focus { |
||||||
|
border: none; |
||||||
|
box-shadow: 0; |
||||||
|
outline: none; |
||||||
|
} |
||||||
|
#bar > .right .btn:hover { |
||||||
|
border-color: #ccc; |
||||||
|
background-color:none; |
||||||
|
color:rgba(0,0,0,0.4); |
||||||
|
} |
||||||
|
#bar > .right .btn.active { |
||||||
|
border-color: #ccc; |
||||||
|
background-color:none; |
||||||
|
color:rgba(0,0,0,0.4); |
||||||
|
} |
||||||
|
#bar > .right .btn.active.amutebtn { |
||||||
|
background-color: #db4f39; |
||||||
|
border-color: #db4f39; |
||||||
|
color: white; |
||||||
|
} |
||||||
|
#bar > .right .btn.active.aenablebtn { |
||||||
|
background-color: #84b819; |
||||||
|
border-color: #84b819; |
||||||
|
color: white; |
||||||
|
} |
||||||
|
#bar .userpicture { |
||||||
|
margin:-5px 0.5em 0px 0.5em; |
||||||
|
width:46px; |
||||||
|
height:46px; |
||||||
|
border-radius:2px; |
||||||
|
display:inline-block; |
||||||
|
} |
||||||
|
#bar > .middle { |
||||||
|
z-index:5; |
||||||
|
background-color: $componentbg; |
||||||
|
display:inline-block; |
||||||
|
padding:0 1em; |
||||||
|
position:relative; |
||||||
|
} |
||||||
|
|
||||||
|
@media all and (max-width: 700px) { |
||||||
|
#bar { |
||||||
|
z-index:40; |
||||||
|
-webkit-box-shadow: none; |
||||||
|
box-shadow: none; |
||||||
|
} |
||||||
|
#bar > .middle.status-connecting, #bar > .middle.status-closed, #bar > .middle.status-reconnecting, #bar > .middle.status-error, #bar > .middle.status-ringing { |
||||||
|
max-width:100%; |
||||||
|
border-bottom:1px solid $bordercolor; |
||||||
|
.actions { |
||||||
|
display: block; |
||||||
|
padding:.2em 0 .8em 0; |
||||||
|
} |
||||||
|
min-height: 45px; |
||||||
|
} |
||||||
|
#bar > .middle.status-connected, #bar > .middle.status-conference { |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
max-width:100%; |
||||||
|
} |
||||||
|
#bar > .middle { |
||||||
|
display:block; |
||||||
|
max-width:50%; |
||||||
|
overflow:hidden; |
||||||
|
text-overflow:ellipsis; |
||||||
|
white-space:nowrap; |
||||||
|
|
||||||
|
img { |
||||||
|
display:none; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,157 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#buddylist { |
||||||
|
position: fixed; |
||||||
|
top: 44px; |
||||||
|
right: 0px; |
||||||
|
bottom: 0px; |
||||||
|
width:260px; |
||||||
|
border-top: 1px solid $bordercolor; |
||||||
|
z-index:5; |
||||||
|
pointer-events:none; |
||||||
|
} |
||||||
|
.buddylist { |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
top:0px; |
||||||
|
bottom:0px; |
||||||
|
overflow-x: hidden; |
||||||
|
overflow-y: auto; |
||||||
|
} |
||||||
|
.buddylist .buddycontainer { |
||||||
|
-webkit-user-select: none; |
||||||
|
position: relative; |
||||||
|
pointer-events:auto; |
||||||
|
} |
||||||
|
.buddylist .buddylistloading, .buddylist .buddylistempty { |
||||||
|
padding:.4em; |
||||||
|
background: $sidepanebg; |
||||||
|
font-size:0.8em; |
||||||
|
text-align:center; |
||||||
|
display:none; |
||||||
|
} |
||||||
|
.buddylist.loading .buddylistloading { |
||||||
|
display:block; |
||||||
|
} |
||||||
|
.buddylist.empty .buddylistempty { |
||||||
|
display:block; |
||||||
|
} |
||||||
|
.buddy { |
||||||
|
overflow: hidden; |
||||||
|
height: 66px; |
||||||
|
display: block; |
||||||
|
border-bottom: 1px solid $bordercolor; |
||||||
|
position: relative; |
||||||
|
cursor: pointer; |
||||||
|
text-align: left; |
||||||
|
width: 100%; |
||||||
|
font-size: 13px; |
||||||
|
background: $sidepanebg; |
||||||
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); |
||||||
|
} |
||||||
|
.buddy:hover { |
||||||
|
background: $componentbg; |
||||||
|
} |
||||||
|
.buddy > .buddyimage { |
||||||
|
float:left; |
||||||
|
height: 46px; |
||||||
|
width: 46px; |
||||||
|
overflow: hidden; |
||||||
|
margin: 10px; |
||||||
|
position: relative; |
||||||
|
border-radius: 2px; |
||||||
|
background: $actioncolor1; |
||||||
|
text-align:center; |
||||||
|
} |
||||||
|
.buddy > .buddyimage > i { |
||||||
|
line-height:46px; |
||||||
|
color:$actioncolor2; |
||||||
|
} |
||||||
|
.buddy > .buddyimage > img { |
||||||
|
position: absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
bottom:0px; |
||||||
|
top:0px; |
||||||
|
display:block; |
||||||
|
} |
||||||
|
.buddy > .buddy1 { |
||||||
|
position: absolute; |
||||||
|
left: 65px; |
||||||
|
white-space: nowrap; |
||||||
|
overflow: hidden; |
||||||
|
right: 4px; |
||||||
|
height: 28px; |
||||||
|
color: $componentfg1; |
||||||
|
font-weight:bold; |
||||||
|
font-size:14px; |
||||||
|
top: 24px; |
||||||
|
text-overflow: ellipsis; |
||||||
|
} |
||||||
|
.buddy.withSubline > .buddy1 { |
||||||
|
top: 15px; |
||||||
|
} |
||||||
|
.buddy > .buddy2 { |
||||||
|
position: absolute; |
||||||
|
left: 65px; |
||||||
|
white-space: nowrap; |
||||||
|
overflow: hidden; |
||||||
|
right: 0px; |
||||||
|
color: $componentfg2; |
||||||
|
top: 33px; |
||||||
|
} |
||||||
|
.buddy .buddyactions { |
||||||
|
position:absolute; |
||||||
|
right:-125px; |
||||||
|
top:0px; |
||||||
|
bottom:0px; |
||||||
|
background:rgba(255,255,255,0.5); |
||||||
|
z-index:5; |
||||||
|
line-height:66px; |
||||||
|
padding:0 10px; |
||||||
|
/*width:110px;*/ |
||||||
|
transition-property: right; |
||||||
|
-webkit-transition-property: right; |
||||||
|
transition-duration: .3s; |
||||||
|
-webkit-transition-duration: .3s; |
||||||
|
white-space:nowrap; |
||||||
|
text-align:right; |
||||||
|
} |
||||||
|
.buddy .buddyactions i { |
||||||
|
font-size:2em; |
||||||
|
} |
||||||
|
.buddy.hovered .buddyactions { |
||||||
|
right:0px; |
||||||
|
} |
||||||
|
|
||||||
|
@media only screen and (max-width: 400px) { |
||||||
|
#buddylist { |
||||||
|
left:0px; |
||||||
|
width:auto; |
||||||
|
margin-bottom:26px; |
||||||
|
} |
||||||
|
.buddylist .buddylistempty { |
||||||
|
background: transparent; |
||||||
|
color:#ccc; |
||||||
|
padding-top:14px; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,393 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
$chatwidth: 260px; |
||||||
|
$chatheight: 312px; |
||||||
|
#chat { |
||||||
|
position: fixed; |
||||||
|
left:8px; |
||||||
|
bottom:0px; |
||||||
|
right:8px; |
||||||
|
height:$chatheight; |
||||||
|
max-height:100%; |
||||||
|
pointer-events: none; |
||||||
|
z-index:45; |
||||||
|
} |
||||||
|
.chatpane { |
||||||
|
height:100%; |
||||||
|
position:relative; |
||||||
|
overflow-x:auto; |
||||||
|
overflow-y:hidden; |
||||||
|
} |
||||||
|
.chat { |
||||||
|
position:absolute; |
||||||
|
pointer-events: auto; |
||||||
|
left:0px; |
||||||
|
bottom:( -1* $chatheight - 30); |
||||||
|
width:$chatwidth; |
||||||
|
background: #e7e7e7;; |
||||||
|
min-width:$chatwidth; |
||||||
|
overflow:hidden; |
||||||
|
max-width:100%; |
||||||
|
height:100%; |
||||||
|
display:none; |
||||||
|
-webkit-border-top-left-radius: 4px; |
||||||
|
-webkit-border-top-right-radius: 4px; |
||||||
|
-moz-border-radius-topleft: 4px; |
||||||
|
-moz-border-radius-topright: 4px; |
||||||
|
border-top-left-radius: 4px; |
||||||
|
border-top-right-radius: 4px; |
||||||
|
} |
||||||
|
.chat.visible { |
||||||
|
display:block; |
||||||
|
bottom:0px; |
||||||
|
} |
||||||
|
.chat.visible.minimized { |
||||||
|
background:transparent; |
||||||
|
border:none; |
||||||
|
pointer-events:none; |
||||||
|
.chatheader { |
||||||
|
position:absolute; |
||||||
|
bottom:0px; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
pointer-events:auto; |
||||||
|
} |
||||||
|
.outputbox, .typinghint, .inputbox { |
||||||
|
display:none; |
||||||
|
} |
||||||
|
} |
||||||
|
.chat.visible.maximized { |
||||||
|
bottom:0px; |
||||||
|
top:0px; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
position:fixed; |
||||||
|
width:100%; |
||||||
|
z-index:20; |
||||||
|
background-image: url("../img/wild_oliva.png"); |
||||||
|
background-repeat: repeat; |
||||||
|
@include hidpi { |
||||||
|
background-image: url("../img/wild_oliva_x2.png"); |
||||||
|
background-size: 192px 200px; |
||||||
|
} |
||||||
|
} |
||||||
|
.chat.visible.maximized .output { |
||||||
|
margin:4px; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .chatheader { |
||||||
|
background: $componentbg; |
||||||
|
padding:6px 4px 4px 8px; |
||||||
|
border: 1px solid $bordercolor; |
||||||
|
font-size:0.8em; |
||||||
|
font-weight:bold; |
||||||
|
height:30px; |
||||||
|
-webkit-border-top-left-radius: 4px; |
||||||
|
-webkit-border-top-right-radius: 4px; |
||||||
|
-moz-border-radius-topleft: 4px; |
||||||
|
-moz-border-radius-topright: 4px; |
||||||
|
border-top-left-radius: 4px; |
||||||
|
border-top-right-radius: 4px; |
||||||
|
} |
||||||
|
.chat .chatheader .ctrl { |
||||||
|
position:absolute; |
||||||
|
top:4px; |
||||||
|
right:1px; |
||||||
|
} |
||||||
|
.chat .chatheader span { |
||||||
|
display: inline-block; |
||||||
|
max-width:60%; |
||||||
|
text-overflow:ellipsis; |
||||||
|
white-space:nowrap; |
||||||
|
overflow:hidden; |
||||||
|
pointer-events: none; |
||||||
|
vertical-align: middle; |
||||||
|
} |
||||||
|
.chat .chatheader .ctrl i { |
||||||
|
padding:6px; |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
.chat .outputbox { |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
top:34px; |
||||||
|
bottom:74px; |
||||||
|
max-width:600px; |
||||||
|
margin:0 auto; |
||||||
|
} |
||||||
|
.chat .output { |
||||||
|
overflow-x: hidden; |
||||||
|
overflow-y: auto; |
||||||
|
padding: 0.4em 0; |
||||||
|
height:100%; |
||||||
|
} |
||||||
|
.chat .output > i { |
||||||
|
font-size:0.8em; |
||||||
|
color: #aaa; |
||||||
|
display:block; |
||||||
|
padding:6px 0; |
||||||
|
text-align:center; |
||||||
|
clear:both; |
||||||
|
} |
||||||
|
.chat .output > i.p2p { |
||||||
|
padding:6px 0; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
.chat .output .message { |
||||||
|
background: #fff; |
||||||
|
border: 1px solid #e5e5ef; |
||||||
|
border-radius: 6px; |
||||||
|
margin-bottom: 2px; |
||||||
|
position: relative; |
||||||
|
word-wrap: break-word; |
||||||
|
padding:8px; |
||||||
|
margin-left:20px; |
||||||
|
margin-right:4px; |
||||||
|
clear:both; |
||||||
|
display:block; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message .timestamp { |
||||||
|
font-size:0.8em; |
||||||
|
color: #aaa; |
||||||
|
text-align:right; |
||||||
|
position:absolute; |
||||||
|
top:8px; |
||||||
|
right:8px; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message.is_self .timestamp { |
||||||
|
right:58px; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message > ul { |
||||||
|
list-style-type: none; |
||||||
|
margin:0; |
||||||
|
padding-left:0; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message > ul > li { |
||||||
|
line-height:1.1em; |
||||||
|
margin:4px 0; |
||||||
|
padding-left:1.2em; |
||||||
|
position:relative; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message li:before { |
||||||
|
font-family: 'FontAwesome'; |
||||||
|
content: '\f075'; |
||||||
|
color:#ccc; |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message.is_self li:before { |
||||||
|
moz-transform: scale(-1, 1); |
||||||
|
-webkit-transform: scale(-1, 1); |
||||||
|
transform: scale(-1, 1); |
||||||
|
color:#ccc; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message li.unread:before { |
||||||
|
color: #FE9A2E; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message li.sending:before { |
||||||
|
content: '\f0e5'; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message li.sent:before { |
||||||
|
content: '\f0e5'; |
||||||
|
color:#5882FA; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message li.delivered:before { |
||||||
|
color:#5882FA; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message li.received:before { |
||||||
|
color:#84b819; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .message li.read:before { |
||||||
|
color:#ccc; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message .buddyimage { |
||||||
|
position: absolute; |
||||||
|
top: 4px; |
||||||
|
width:46px; |
||||||
|
height:46px; |
||||||
|
left: 4px; |
||||||
|
overflow: hidden; |
||||||
|
border-radius: 2px; |
||||||
|
background: $actioncolor1; |
||||||
|
text-align:center; |
||||||
|
} |
||||||
|
.chat .output .message.is_self .buddyimage { |
||||||
|
right: 4px; |
||||||
|
left: auto; |
||||||
|
} |
||||||
|
.chat .output .message .buddyimage > i { |
||||||
|
line-height:46px; |
||||||
|
color:$actioncolor2; |
||||||
|
} |
||||||
|
.chat .output .message .buddyimage > img { |
||||||
|
position: absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
bottom:0px; |
||||||
|
top:0px; |
||||||
|
display:block; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message.is_remote { |
||||||
|
padding-left: 58px; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message:before, .chat .output .message:after { |
||||||
|
content:""; |
||||||
|
position:absolute; |
||||||
|
border-style: solid; |
||||||
|
width:0; |
||||||
|
display:block; |
||||||
|
} |
||||||
|
.chat .output .message.is_remote:before { |
||||||
|
top:4px; |
||||||
|
bottom:auto; |
||||||
|
left:-16px; |
||||||
|
border-width: 10px 17px 10px 0; |
||||||
|
border-color: transparent #fff; |
||||||
|
} |
||||||
|
.chat .output .message.is_remote:after { |
||||||
|
top:5px; |
||||||
|
bottom:auto; |
||||||
|
left:-15px; |
||||||
|
border-width: 9px 15px 9px 0; |
||||||
|
border-color: transparent #fff; |
||||||
|
} |
||||||
|
.chat .output .message.is_self:before { |
||||||
|
top:4px; |
||||||
|
bottom:auto; |
||||||
|
right:-16px; |
||||||
|
border-width: 10px 0 10px 17px; |
||||||
|
border-color: transparent #fff; |
||||||
|
} |
||||||
|
.chat .output .message.is_self:after { |
||||||
|
top:5px; |
||||||
|
bottom:auto; |
||||||
|
right:-15px; |
||||||
|
border-width: 9px 0 9px 15px; |
||||||
|
border-color: transparent #fff; |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message.with_name { |
||||||
|
} |
||||||
|
|
||||||
|
.chat .output .message.is_self { |
||||||
|
background: #fff; |
||||||
|
margin-right:20px; |
||||||
|
margin-left:4px; |
||||||
|
padding-right:54px; |
||||||
|
} |
||||||
|
.chat .output .message strong { |
||||||
|
display:block; |
||||||
|
padding-bottom:2px; |
||||||
|
margin-right:40px; |
||||||
|
white-space:nowrap; |
||||||
|
overflow:hidden; |
||||||
|
text-overflow:ellipsis; |
||||||
|
} |
||||||
|
.chat .typinghint { |
||||||
|
position:absolute; |
||||||
|
left:6px; |
||||||
|
right:6px; |
||||||
|
bottom:60px; |
||||||
|
font-size:.8em; |
||||||
|
color: #aaa; |
||||||
|
max-width:500px; |
||||||
|
margin:0 auto; |
||||||
|
} |
||||||
|
.chat .inputbox { |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
bottom:0px; |
||||||
|
right:0px; |
||||||
|
height:60px; |
||||||
|
max-width:500px; |
||||||
|
margin:0 auto; |
||||||
|
} |
||||||
|
.chat .inputbox .btn { |
||||||
|
position:absolute; |
||||||
|
right:6px; |
||||||
|
top:4px; |
||||||
|
padding: 0.5em 1em; |
||||||
|
} |
||||||
|
.chat .inputbox > div { |
||||||
|
margin: 4px 54px 0px 4px; |
||||||
|
} |
||||||
|
.chat .input { |
||||||
|
display:block; |
||||||
|
resize: none; |
||||||
|
width:100%; |
||||||
|
height:54px; |
||||||
|
max-height:54px; /* FF hack */ |
||||||
|
margin-bottom: 4px; |
||||||
|
} |
||||||
|
@for $i from 0 through 10 { |
||||||
|
.chat.room-#{$i} { |
||||||
|
left: ($chatwidth+8)*$i; |
||||||
|
} |
||||||
|
} |
||||||
|
@keyframes newmessage { |
||||||
|
0% {background-color: rgba(132,184,25,1.0);} |
||||||
|
50% {background-color: $componentbg;} |
||||||
|
100% {background-color: rgba(132,184,25,1.0);} |
||||||
|
} |
||||||
|
@-webkit-keyframes newmessage { |
||||||
|
0% {background-color: rgba(132,184,25,1.0);} |
||||||
|
50% {background-color: $componentbg;} |
||||||
|
100% {background-color: rgba(132,184,25,1.0);} |
||||||
|
} |
||||||
|
.chat.newmessage .chatheader { |
||||||
|
animation: newmessage 1s ease -0.3s infinite; |
||||||
|
-webkit-animation: newmessage 1s ease -0.3s infinite; |
||||||
|
} |
||||||
|
.chat.newmessage .chatheader span:after { |
||||||
|
content: "***"; |
||||||
|
position:absolute; |
||||||
|
top:0px; |
||||||
|
line-height:32px; |
||||||
|
right:70px; |
||||||
|
} |
||||||
|
|
||||||
|
@media all and (max-height: 150px) { |
||||||
|
.chat .inputbox { |
||||||
|
height: auto; |
||||||
|
} |
||||||
|
.chat .input { |
||||||
|
max-height: 2.5em; |
||||||
|
} |
||||||
|
.chat .outputbox { |
||||||
|
bottom:45px; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,150 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
.file-info { |
||||||
|
text-align:center; |
||||||
|
border: 1px solid #ddd; |
||||||
|
padding: 1em; |
||||||
|
background: #fff; |
||||||
|
border-radius: 4px; |
||||||
|
padding: 1em; |
||||||
|
position: relative; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info > div { |
||||||
|
z-index: 3; |
||||||
|
position: relative; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info div.file-info-bg { |
||||||
|
position:absolute; |
||||||
|
left:41px; |
||||||
|
top:-17px; |
||||||
|
right:0px; |
||||||
|
bottom:0px; |
||||||
|
z-index:2; |
||||||
|
overflow:hidden; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info-bg i { |
||||||
|
font-size: 20em; |
||||||
|
color: #eee; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info-name { |
||||||
|
font-size: 1.1em; |
||||||
|
padding: 0 .2em; |
||||||
|
margin:0.2em 0; |
||||||
|
min-width:140px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info-size { |
||||||
|
font-size: 0.8em; |
||||||
|
position:relative; |
||||||
|
height: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info.downloader .file-info-size { |
||||||
|
margin-bottom: 10px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info.downloading .file-info-size{ |
||||||
|
border-color: #ddd; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info-size > span { |
||||||
|
padding: 4px; |
||||||
|
z-index:5; |
||||||
|
display:block; |
||||||
|
position:relative; |
||||||
|
text-shadow: 1px 1px 1px white; |
||||||
|
position: absolute; |
||||||
|
margin: 0 auto; |
||||||
|
top:1px; |
||||||
|
right:0px; |
||||||
|
left:0px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info-size > div { |
||||||
|
z-index:0; |
||||||
|
width:0%; |
||||||
|
-webkit-box-shadow: none !important; |
||||||
|
box-shadow: none !important; |
||||||
|
position: absolute; |
||||||
|
left:0px; |
||||||
|
bottom:0px; |
||||||
|
top:0px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info-size > div.progress-bar { |
||||||
|
opacity: 0.5; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info-size > div.progress-bar.download { |
||||||
|
z-index:1; |
||||||
|
opacity: 1; |
||||||
|
} |
||||||
|
|
||||||
|
div.file-info-speed { |
||||||
|
position: absolute; |
||||||
|
left: 0px; |
||||||
|
right: 0px; |
||||||
|
bottom: 8px; |
||||||
|
text-align: center; |
||||||
|
font-size: 0.8em; |
||||||
|
} |
||||||
|
.file-info.uploader div.file-info-speed { |
||||||
|
bottom: 6px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info.downloader .anim { |
||||||
|
margin-left: -40px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info.uploader .anim { |
||||||
|
margin-left: 0px; |
||||||
|
} |
||||||
|
.file-info.uploader .hovercontrol:hover .anim { |
||||||
|
margin-left: -50px; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info.uploader .hovercontrol > div { |
||||||
|
-webkit-transition: all .2s ease-in-out; |
||||||
|
-moz-transition: all .2s ease-in-out; |
||||||
|
-o-transition: all .2s ease-in-out; |
||||||
|
transition: all .2s ease-in-out |
||||||
|
} |
||||||
|
|
||||||
|
.file-info .actions { |
||||||
|
position: absolute; |
||||||
|
top: 14px; |
||||||
|
left: 50%; |
||||||
|
margin-left: 10px; |
||||||
|
text-align: left; |
||||||
|
} |
||||||
|
|
||||||
|
.file-info.uploader .actions { |
||||||
|
margin-left:30px; |
||||||
|
opacity:0; |
||||||
|
} |
||||||
|
.file-info.uploader .hovercontrol:hover .actions { |
||||||
|
margin-left:0px; |
||||||
|
opacity:1; |
||||||
|
} |
||||||
@ -0,0 +1,66 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#roombar { |
||||||
|
position: absolute; |
||||||
|
left:3px; |
||||||
|
top:46px; |
||||||
|
right:3px; |
||||||
|
height:32px; |
||||||
|
color:#ccc; |
||||||
|
z-index:4; |
||||||
|
} |
||||||
|
#roombar .roombar { |
||||||
|
position: absolute; |
||||||
|
left:0px; |
||||||
|
bottom:0px; |
||||||
|
top:0px; |
||||||
|
padding:4px 4px 4px 30px; |
||||||
|
vertical-align:middle; |
||||||
|
} |
||||||
|
.roombarbutton { |
||||||
|
font-size:20px; |
||||||
|
vertical-align:middle; |
||||||
|
position:absolute; |
||||||
|
left: 0px; |
||||||
|
top: 0px; |
||||||
|
padding:7px; |
||||||
|
display:block; |
||||||
|
color:#ccc; |
||||||
|
z-index:15; |
||||||
|
opacity:0.7; |
||||||
|
} |
||||||
|
.roombarcontent { |
||||||
|
display:inline-block; |
||||||
|
max-width:300px; |
||||||
|
} |
||||||
|
.roombar .roomlabellabel { |
||||||
|
display:none; |
||||||
|
opacity: 0.7; |
||||||
|
text-align:left; |
||||||
|
} |
||||||
|
#roombar .roombar.notvisible { |
||||||
|
.roombarcontent { |
||||||
|
display: none; |
||||||
|
} |
||||||
|
.roomlabellabel { |
||||||
|
display:block; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
.screenshare .remoteScreen { |
||||||
|
width:100%; |
||||||
|
height:100%; |
||||||
|
position:relative; |
||||||
|
} |
||||||
|
.screenshare video { |
||||||
|
width:100%; |
||||||
|
max-height:100%; |
||||||
|
} |
||||||
@ -0,0 +1,82 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#settings { |
||||||
|
position:fixed; |
||||||
|
top:44px; |
||||||
|
right:-460px; |
||||||
|
bottom:0px; |
||||||
|
width:440px; |
||||||
|
z-index: 50; |
||||||
|
-webkit-transition-property: right; |
||||||
|
-webkit-transition-duration: 0.2s; |
||||||
|
padding-right: 20px; |
||||||
|
border-top:1px solid $bordercolor; |
||||||
|
} |
||||||
|
#settings.show { |
||||||
|
right:0px; |
||||||
|
} |
||||||
|
.settings { |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
top:0px; |
||||||
|
bottom:0px; |
||||||
|
background: $sidepanebg; |
||||||
|
overflow-x: hidden; |
||||||
|
overflow-y: auto; |
||||||
|
padding:10px; |
||||||
|
} |
||||||
|
.settings .version { |
||||||
|
position:absolute; |
||||||
|
top:10px; |
||||||
|
right:10px; |
||||||
|
font-size:10px; |
||||||
|
color:#ccc; |
||||||
|
} |
||||||
|
@media only screen and (max-width: 630px) { |
||||||
|
.settings .form-horizontal .controls { |
||||||
|
margin-left:110px; |
||||||
|
} |
||||||
|
.settings .form-horizontal .control-label { |
||||||
|
width:100px; |
||||||
|
word-wrap:break-word; |
||||||
|
} |
||||||
|
.settings { |
||||||
|
padding-bottom:10px; |
||||||
|
} |
||||||
|
#settings.show { |
||||||
|
width:auto; |
||||||
|
left:0px; |
||||||
|
background:white; |
||||||
|
} |
||||||
|
#settings.show .form-actions { |
||||||
|
position: fixed; |
||||||
|
bottom: 0px; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
margin-bottom:0px; |
||||||
|
padding-bottom:0px; |
||||||
|
height:60px; |
||||||
|
padding-left:120px; |
||||||
|
padding-top:6px; |
||||||
|
padding-bottom:6px; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,64 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#help { |
||||||
|
position:absolute; |
||||||
|
top:120px; |
||||||
|
bottom:120px; |
||||||
|
left:15%; |
||||||
|
right:0px; |
||||||
|
width:400px; |
||||||
|
font-size:1.4em; |
||||||
|
font-style:italic; |
||||||
|
color:#aaa; |
||||||
|
font-family: Garamond, Baskerville, "Baskerville Old Face", "Hoefler Text", "Times New Roman", serif; |
||||||
|
} |
||||||
|
#help > div { |
||||||
|
} |
||||||
|
#help i { |
||||||
|
float:right; |
||||||
|
} |
||||||
|
#help li { |
||||||
|
padding:0 0 20px 0; |
||||||
|
} |
||||||
|
#help .help-subline { |
||||||
|
padding:20px 0; |
||||||
|
color:#666; |
||||||
|
} |
||||||
|
#help .fadetogglecontainer > div { |
||||||
|
width:400px; |
||||||
|
} |
||||||
|
@media only screen and (max-width: 800px) and (min-width: 400px) { |
||||||
|
#help, #help .fadetogglecontainer > div { |
||||||
|
width:200px; |
||||||
|
} |
||||||
|
#help { |
||||||
|
font-size:1em; |
||||||
|
} |
||||||
|
#help > div { |
||||||
|
margin-left:0px; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@media only screen and (max-width: 400px) { |
||||||
|
#help { |
||||||
|
display:none; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,198 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
#container { |
||||||
|
position: absolute; |
||||||
|
/*margin: 0px auto;*/ |
||||||
|
perspective: 1000; |
||||||
|
-webkit-perspective: 1000; |
||||||
|
top:0px; |
||||||
|
left:0px; |
||||||
|
bottom:0px; |
||||||
|
right:0px; |
||||||
|
} |
||||||
|
#container .visible { |
||||||
|
opacity:1 !important; |
||||||
|
} |
||||||
|
#card { |
||||||
|
position:relative; |
||||||
|
width:100%; |
||||||
|
height:100%; |
||||||
|
transition-property: transform; |
||||||
|
-webkit-transition-property: -webkit-transform; |
||||||
|
transition-duration: 2s; |
||||||
|
-webkit-transition-duration: 2s; |
||||||
|
transform: rotateY(0deg); |
||||||
|
-webkit-transform: rotateY(0deg); |
||||||
|
} |
||||||
|
#card.active { |
||||||
|
transform: rotateY(180deg); |
||||||
|
-webkit-transform: rotateY(180deg); |
||||||
|
} |
||||||
|
#local { |
||||||
|
position: absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
top:0px; |
||||||
|
bottom:0px; |
||||||
|
transform: scale(-1, 1); |
||||||
|
-webkit-transform: scale(-1, 1); |
||||||
|
pointer-events:none; |
||||||
|
} |
||||||
|
#remote { |
||||||
|
position: absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
top:0px; |
||||||
|
bottom:0px; |
||||||
|
transform: rotateY(180deg); |
||||||
|
-webkit-transform: rotateY(180deg); |
||||||
|
} |
||||||
|
#mini { |
||||||
|
position: absolute; |
||||||
|
height: 20%; |
||||||
|
bottom: 4px; |
||||||
|
right: 2px; |
||||||
|
transform: scale(-1, 1); |
||||||
|
-webkit-transform: scale(-1, 1); |
||||||
|
opacity: 0; |
||||||
|
transition-property: opacity; |
||||||
|
-webkit-transition-property: opacity; |
||||||
|
transition-duration: 0.5s; |
||||||
|
-webkit-transition-duration: 0.5s; |
||||||
|
} |
||||||
|
#localVideo { |
||||||
|
width: 100%; |
||||||
|
height: 100%; |
||||||
|
opacity: 0; |
||||||
|
transition-property: opacity; |
||||||
|
-webkit-transition-property: opacity; |
||||||
|
transition-duration: 2s; |
||||||
|
-webkit-transition-duration: 2s; |
||||||
|
/*background: red;*/ |
||||||
|
} |
||||||
|
#remoteVideos { |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
bottom:0px; |
||||||
|
top:0px; |
||||||
|
opacity: 0; |
||||||
|
transition-property: opacity; |
||||||
|
-webkit-transition-property: opacity; |
||||||
|
transition-duration: 2s; |
||||||
|
-webkit-transition-duration: 2s; |
||||||
|
/*background: blue;*/ |
||||||
|
} |
||||||
|
#remoteVideos video { |
||||||
|
width:100%; |
||||||
|
height:100%; |
||||||
|
} |
||||||
|
#miniVideo { |
||||||
|
height: 100%; |
||||||
|
} |
||||||
|
.indicator { |
||||||
|
position: absolute; |
||||||
|
z-index: 5; |
||||||
|
right: 5px; |
||||||
|
top: 2px; |
||||||
|
color: #9dd53a; |
||||||
|
opacity: 0; |
||||||
|
-webkit-transition: opacity .2s ease-in-out; |
||||||
|
-moz-transition: opacity .2s ease-in-out; |
||||||
|
-ms-transition: opacity .2s ease-in-out; |
||||||
|
-o-transition: opacity .2s ease-in-out; |
||||||
|
transition: opacity .2s ease-in-out; |
||||||
|
text-shadow: 0px 0px 6px black; |
||||||
|
} |
||||||
|
.talking .indicator { |
||||||
|
opacity: 0.8; |
||||||
|
} |
||||||
|
#remoteVideos .indicator { |
||||||
|
left: 5%; |
||||||
|
top: 5%; |
||||||
|
right: auto; |
||||||
|
font-size:2em; |
||||||
|
} |
||||||
|
.remoteVideo { |
||||||
|
display: inline-block; |
||||||
|
width:100%; |
||||||
|
height:100%; |
||||||
|
vertical-align:bottom; |
||||||
|
position:relative; |
||||||
|
visibility:hidden; |
||||||
|
} |
||||||
|
.remoteVideo.withvideo { |
||||||
|
visibility:visible; |
||||||
|
} |
||||||
|
.remoteVideo.onlyaudio { |
||||||
|
visibility:visible; |
||||||
|
background: #666; |
||||||
|
} |
||||||
|
.remoteVideo .onlyaudio { |
||||||
|
display:none; |
||||||
|
position:absolute; |
||||||
|
left:0px; |
||||||
|
top:45%; |
||||||
|
right:0px; |
||||||
|
color:rgba(255,255,255,0.3); |
||||||
|
text-align:center; |
||||||
|
font-size:80px; |
||||||
|
margin-top:-40px; |
||||||
|
} |
||||||
|
.remoteVideo.onlyaudio video { |
||||||
|
display:none; |
||||||
|
} |
||||||
|
.remoteVideo.onlyaudio .onlyaudio { |
||||||
|
display:block; |
||||||
|
} |
||||||
|
.remoteVideo .peeractions { |
||||||
|
position: absolute; |
||||||
|
z-index: 10; |
||||||
|
left:0px; |
||||||
|
right:0px; |
||||||
|
bottom:5%; |
||||||
|
text-align:center; |
||||||
|
opacity:.0; |
||||||
|
transition-property: opacity; |
||||||
|
-webkit-transition-property: opacity; |
||||||
|
transition-duration: 0.2s; |
||||||
|
-webkit-transition-duration: 0.2s; |
||||||
|
} |
||||||
|
.remoteVideo .peeractions i { |
||||||
|
font-size:3vw; |
||||||
|
} |
||||||
|
.remoteVideo:hover .peeractions { |
||||||
|
opacity:.5; |
||||||
|
} |
||||||
|
.remoteVideo .peerlabel { |
||||||
|
position: absolute; |
||||||
|
z-index:8; |
||||||
|
left:5%; |
||||||
|
bottom:5%; |
||||||
|
font-size:2.5vw; |
||||||
|
color:white; |
||||||
|
opacity:.7; |
||||||
|
text-shadow: 0px 0px 10px rgb(0, 0, 0); |
||||||
|
max-width:30%; |
||||||
|
overflow:hidden; |
||||||
|
white-space:nowrap; |
||||||
|
text-overflow:ellipsis; |
||||||
|
} |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
images_dir = "../../static/img" |
||||||
|
project_path = "../../static/css" |
||||||
|
|
||||||
|
relative_assets = true |
||||||
@ -0,0 +1,23 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { |
||||||
|
display: none; |
||||||
|
} |
||||||
@ -0,0 +1,42 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
.fadetogglecontainer > div { |
||||||
|
position:absolute; |
||||||
|
} |
||||||
|
|
||||||
|
.animate-show.ng-hide-add, |
||||||
|
.animate-show.ng-hide-remove { |
||||||
|
-webkit-transition:all linear 0.5s; |
||||||
|
-moz-transition:all linear 0.5s; |
||||||
|
-o-transition:all linear 0.5s; |
||||||
|
transition:all linear 0.5s; |
||||||
|
display:block!important; |
||||||
|
} |
||||||
|
|
||||||
|
.animate-show.ng-hide-add.ng-hide-add-active, |
||||||
|
.animate-show.ng-hide-remove { |
||||||
|
opacity:0; |
||||||
|
} |
||||||
|
|
||||||
|
.animate-show.ng-hide-add, |
||||||
|
.animate-show.ng-hide-remove.ng-hide-remove-active { |
||||||
|
opacity:1; |
||||||
|
} |
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,31 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
$background: #e5e5e5; |
||||||
|
$componentbg: #f5f5f5; |
||||||
|
$componentfg1: #262626; |
||||||
|
$componentfg2: rgba(0,0,0,.5); |
||||||
|
$componentfg3: rgba(0,0,0,.2); |
||||||
|
$componentfg4: #737373; |
||||||
|
$sidepanebg: white; |
||||||
|
$bordercolor: #ccc; |
||||||
|
$actioncolor1: rgb(132,184,25); |
||||||
|
$actioncolor2: rgb(0,149,52); |
||||||
|
|
||||||
@ -0,0 +1,39 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
.nicescroll::-webkit-scrollbar { |
||||||
|
width: 8px; |
||||||
|
background-color: $background; |
||||||
|
border: solid transparent; |
||||||
|
} |
||||||
|
|
||||||
|
.nicescroll::-webkit-scrollbar:hover { |
||||||
|
background-color: $background; |
||||||
|
border-left: 1px solid rgba(0,0,0,.12); |
||||||
|
border-right: 1px solid rgba(0,0,0,.12); |
||||||
|
} |
||||||
|
|
||||||
|
.nicescroll::-webkit-scrollbar-thumb { |
||||||
|
background: rgba(0,0,0,0.2); |
||||||
|
} |
||||||
|
|
||||||
|
.nicescroll::-webkit-scrollbar-thumb:active { |
||||||
|
background: rgba(0,0,0,0.4); |
||||||
|
} |
||||||
@ -0,0 +1,32 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
.dialog-header-error { background-color: #d2322d; } |
||||||
|
.dialog-header-wait { background-color: #428bca; } |
||||||
|
.dialog-header-notify { background-color: #eee; } |
||||||
|
.dialog-header-confirm { background-color: #eee; } |
||||||
|
.dialog-header-error span, .dialog-header-error h4, |
||||||
|
.dialog-header-wait span, .dialog-header-wait h4 { color: #fff; } |
||||||
|
.modal-content { |
||||||
|
overflow:hidden; |
||||||
|
} |
||||||
|
.modal-backdrop.in { |
||||||
|
opacity:0.2; |
||||||
|
} |
||||||
@ -0,0 +1,46 @@ |
|||||||
|
/*! HiDPI v2.0.1 | MIT License | git.io/hidpi */ |
||||||
|
|
||||||
|
// Force HiDPI graphics on regular displays |
||||||
|
$hidpi-debug: false !default; |
||||||
|
|
||||||
|
// Change default filename postfix |
||||||
|
// default: imagename_x2.png |
||||||
|
$hidpi-postfix: '_x2' !default; |
||||||
|
|
||||||
|
// Default pixel ratio: 1.3 to support Nexus 7 |
||||||
|
// Depending on your target, you may want to set a |
||||||
|
// more suitable minimum pixel ratio here: |
||||||
|
// http://bjango.com/articles/min-device-pixel-ratio/ |
||||||
|
$hidpi-min-pixel-ratio: 1.3 !default; |
||||||
|
|
||||||
|
@mixin hidpi-abstract($image, $extension, $postfix: $hidpi-postfix) { |
||||||
|
$image-fullname: '#{$image}.#{$extension}'; |
||||||
|
$image-hidpi-fullname: '#{$image}#{$postfix}.#{$extension}'; |
||||||
|
|
||||||
|
background-image: image-url($image-hidpi-fullname); |
||||||
|
background-size: image-width($image-fullname) image-height($image-fullname); |
||||||
|
} |
||||||
|
|
||||||
|
@mixin hidpi($image: false, $extension: png, $postfix: $hidpi-postfix) { |
||||||
|
@if $hidpi-debug { |
||||||
|
@if $image { |
||||||
|
@include hidpi-abstract($image, $extension, $postfix); |
||||||
|
} @else { |
||||||
|
@content; |
||||||
|
} |
||||||
|
} @else { |
||||||
|
@if $image { |
||||||
|
background-image: image-url('#{$image}.#{$extension}'); |
||||||
|
} |
||||||
|
// Inspired by: |
||||||
|
// http://www.brettjankord.com/2012/11/28/cross-browser-retinahigh-resolution-media-queries/ |
||||||
|
@media (-webkit-min-device-pixel-ratio: $hidpi-min-pixel-ratio), |
||||||
|
(min-resolution: $hidpi-min-pixel-ratio * 1dppx) { |
||||||
|
@if $image { |
||||||
|
@include hidpi-abstract($image, $extension, $postfix); |
||||||
|
} @else { |
||||||
|
@content; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,4 @@ |
|||||||
|
/* third party imports*/ |
||||||
|
@import "hidpi"; |
||||||
|
@import "toastr/toastr.scss"; |
||||||
|
@import "dialogs"; |
||||||
@ -0,0 +1,183 @@ |
|||||||
|
/* |
||||||
|
* Toastr |
||||||
|
* Version 2.0.1 |
||||||
|
* Copyright 2012 John Papa and Hans Fjällemark. |
||||||
|
* All Rights Reserved. |
||||||
|
* Use, reproduction, distribution, and modification of this code is subject to the terms and |
||||||
|
* conditions of the MIT license, available at http://www.opensource.org/licenses/mit-license.php |
||||||
|
* |
||||||
|
* Author: John Papa and Hans Fjällemark |
||||||
|
* Project: https://github.com/CodeSeven/toastr |
||||||
|
*/ |
||||||
|
.toast-title { |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
.toast-message { |
||||||
|
-ms-word-wrap: break-word; |
||||||
|
word-wrap: break-word; |
||||||
|
} |
||||||
|
.toast-message a, |
||||||
|
.toast-message label { |
||||||
|
color: #ffffff; |
||||||
|
} |
||||||
|
.toast-message a:hover { |
||||||
|
color: #cccccc; |
||||||
|
text-decoration: none; |
||||||
|
} |
||||||
|
|
||||||
|
.toast-close-button { |
||||||
|
position: relative; |
||||||
|
right: -0.3em; |
||||||
|
top: -0.3em; |
||||||
|
float: right; |
||||||
|
font-size: 20px; |
||||||
|
font-weight: bold; |
||||||
|
color: #ffffff; |
||||||
|
-webkit-text-shadow: 0 1px 0 #ffffff; |
||||||
|
text-shadow: 0 1px 0 #ffffff; |
||||||
|
opacity: 0.8; |
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); |
||||||
|
filter: alpha(opacity=80); |
||||||
|
} |
||||||
|
.toast-close-button:hover, |
||||||
|
.toast-close-button:focus { |
||||||
|
color: #000000; |
||||||
|
text-decoration: none; |
||||||
|
cursor: pointer; |
||||||
|
opacity: 0.4; |
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); |
||||||
|
filter: alpha(opacity=40); |
||||||
|
} |
||||||
|
|
||||||
|
/*Additional properties for button version |
||||||
|
iOS requires the button element instead of an anchor tag. |
||||||
|
If you want the anchor version, it requires `href="#"`.*/ |
||||||
|
button.toast-close-button { |
||||||
|
padding: 0; |
||||||
|
cursor: pointer; |
||||||
|
background: transparent; |
||||||
|
border: 0; |
||||||
|
-webkit-appearance: none; |
||||||
|
} |
||||||
|
.toast-top-full-width { |
||||||
|
top: 0; |
||||||
|
right: 0; |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
.toast-bottom-full-width { |
||||||
|
bottom: 0; |
||||||
|
right: 0; |
||||||
|
width: 100%; |
||||||
|
} |
||||||
|
.toast-top-left { |
||||||
|
top: 12px; |
||||||
|
left: 12px; |
||||||
|
} |
||||||
|
.toast-top-right { |
||||||
|
top: 12px; |
||||||
|
right: 12px; |
||||||
|
} |
||||||
|
.toast-bottom-right { |
||||||
|
right: 12px; |
||||||
|
bottom: 12px; |
||||||
|
} |
||||||
|
.toast-bottom-left { |
||||||
|
bottom: 12px; |
||||||
|
left: 12px; |
||||||
|
} |
||||||
|
#toast-container { |
||||||
|
position: fixed; |
||||||
|
z-index: 999999; |
||||||
|
/*overrides*/ |
||||||
|
|
||||||
|
} |
||||||
|
#toast-container * { |
||||||
|
-moz-box-sizing: border-box; |
||||||
|
-webkit-box-sizing: border-box; |
||||||
|
box-sizing: border-box; |
||||||
|
} |
||||||
|
#toast-container > div { |
||||||
|
margin: 0 0 6px; |
||||||
|
padding: 15px 15px 15px 50px; |
||||||
|
width: 300px; |
||||||
|
-moz-border-radius: 3px 3px 3px 3px; |
||||||
|
-webkit-border-radius: 3px 3px 3px 3px; |
||||||
|
border-radius: 3px 3px 3px 3px; |
||||||
|
background-position: 15px center; |
||||||
|
background-repeat: no-repeat; |
||||||
|
-moz-box-shadow: 0 0 12px #999999; |
||||||
|
-webkit-box-shadow: 0 0 12px #999999; |
||||||
|
box-shadow: 0 0 12px #999999; |
||||||
|
color: #ffffff; |
||||||
|
opacity: 0.8; |
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); |
||||||
|
filter: alpha(opacity=80); |
||||||
|
} |
||||||
|
#toast-container > :hover { |
||||||
|
-moz-box-shadow: 0 0 12px #000000; |
||||||
|
-webkit-box-shadow: 0 0 12px #000000; |
||||||
|
box-shadow: 0 0 12px #000000; |
||||||
|
opacity: 1; |
||||||
|
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=100); |
||||||
|
filter: alpha(opacity=100); |
||||||
|
cursor: pointer; |
||||||
|
} |
||||||
|
#toast-container > .toast-info { |
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGwSURBVEhLtZa9SgNBEMc9sUxxRcoUKSzSWIhXpFMhhYWFhaBg4yPYiWCXZxBLERsLRS3EQkEfwCKdjWJAwSKCgoKCcudv4O5YLrt7EzgXhiU3/4+b2ckmwVjJSpKkQ6wAi4gwhT+z3wRBcEz0yjSseUTrcRyfsHsXmD0AmbHOC9Ii8VImnuXBPglHpQ5wwSVM7sNnTG7Za4JwDdCjxyAiH3nyA2mtaTJufiDZ5dCaqlItILh1NHatfN5skvjx9Z38m69CgzuXmZgVrPIGE763Jx9qKsRozWYw6xOHdER+nn2KkO+Bb+UV5CBN6WC6QtBgbRVozrahAbmm6HtUsgtPC19tFdxXZYBOfkbmFJ1VaHA1VAHjd0pp70oTZzvR+EVrx2Ygfdsq6eu55BHYR8hlcki+n+kERUFG8BrA0BwjeAv2M8WLQBtcy+SD6fNsmnB3AlBLrgTtVW1c2QN4bVWLATaIS60J2Du5y1TiJgjSBvFVZgTmwCU+dAZFoPxGEEs8nyHC9Bwe2GvEJv2WXZb0vjdyFT4Cxk3e/kIqlOGoVLwwPevpYHT+00T+hWwXDf4AJAOUqWcDhbwAAAAASUVORK5CYII=") !important; |
||||||
|
} |
||||||
|
#toast-container > .toast-error { |
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAHOSURBVEhLrZa/SgNBEMZzh0WKCClSCKaIYOED+AAKeQQLG8HWztLCImBrYadgIdY+gIKNYkBFSwu7CAoqCgkkoGBI/E28PdbLZmeDLgzZzcx83/zZ2SSXC1j9fr+I1Hq93g2yxH4iwM1vkoBWAdxCmpzTxfkN2RcyZNaHFIkSo10+8kgxkXIURV5HGxTmFuc75B2RfQkpxHG8aAgaAFa0tAHqYFfQ7Iwe2yhODk8+J4C7yAoRTWI3w/4klGRgR4lO7Rpn9+gvMyWp+uxFh8+H+ARlgN1nJuJuQAYvNkEnwGFck18Er4q3egEc/oO+mhLdKgRyhdNFiacC0rlOCbhNVz4H9FnAYgDBvU3QIioZlJFLJtsoHYRDfiZoUyIxqCtRpVlANq0EU4dApjrtgezPFad5S19Wgjkc0hNVnuF4HjVA6C7QrSIbylB+oZe3aHgBsqlNqKYH48jXyJKMuAbiyVJ8KzaB3eRc0pg9VwQ4niFryI68qiOi3AbjwdsfnAtk0bCjTLJKr6mrD9g8iq/S/B81hguOMlQTnVyG40wAcjnmgsCNESDrjme7wfftP4P7SP4N3CJZdvzoNyGq2c/HWOXJGsvVg+RA/k2MC/wN6I2YA2Pt8GkAAAAASUVORK5CYII=") !important; |
||||||
|
} |
||||||
|
#toast-container > .toast-success { |
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAADsSURBVEhLY2AYBfQMgf///3P8+/evAIgvA/FsIF+BavYDDWMBGroaSMMBiE8VC7AZDrIFaMFnii3AZTjUgsUUWUDA8OdAH6iQbQEhw4HyGsPEcKBXBIC4ARhex4G4BsjmweU1soIFaGg/WtoFZRIZdEvIMhxkCCjXIVsATV6gFGACs4Rsw0EGgIIH3QJYJgHSARQZDrWAB+jawzgs+Q2UO49D7jnRSRGoEFRILcdmEMWGI0cm0JJ2QpYA1RDvcmzJEWhABhD/pqrL0S0CWuABKgnRki9lLseS7g2AlqwHWQSKH4oKLrILpRGhEQCw2LiRUIa4lwAAAABJRU5ErkJggg==") !important; |
||||||
|
} |
||||||
|
#toast-container > .toast-warning { |
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGYSURBVEhL5ZSvTsNQFMbXZGICMYGYmJhAQIJAICYQPAACiSDB8AiICQQJT4CqQEwgJvYASAQCiZiYmJhAIBATCARJy+9rTsldd8sKu1M0+dLb057v6/lbq/2rK0mS/TRNj9cWNAKPYIJII7gIxCcQ51cvqID+GIEX8ASG4B1bK5gIZFeQfoJdEXOfgX4QAQg7kH2A65yQ87lyxb27sggkAzAuFhbbg1K2kgCkB1bVwyIR9m2L7PRPIhDUIXgGtyKw575yz3lTNs6X4JXnjV+LKM/m3MydnTbtOKIjtz6VhCBq4vSm3ncdrD2lk0VgUXSVKjVDJXJzijW1RQdsU7F77He8u68koNZTz8Oz5yGa6J3H3lZ0xYgXBK2QymlWWA+RWnYhskLBv2vmE+hBMCtbA7KX5drWyRT/2JsqZ2IvfB9Y4bWDNMFbJRFmC9E74SoS0CqulwjkC0+5bpcV1CZ8NMej4pjy0U+doDQsGyo1hzVJttIjhQ7GnBtRFN1UarUlH8F3xict+HY07rEzoUGPlWcjRFRr4/gChZgc3ZL2d8oAAAAASUVORK5CYII=") !important; |
||||||
|
} |
||||||
|
#toast-container.toast-top-full-width > div, |
||||||
|
#toast-container.toast-bottom-full-width > div { |
||||||
|
width: 96%; |
||||||
|
margin: auto; |
||||||
|
} |
||||||
|
.toast { |
||||||
|
background-color: #030303; |
||||||
|
} |
||||||
|
.toast-success { |
||||||
|
background-color: #51a351; |
||||||
|
} |
||||||
|
.toast-error { |
||||||
|
background-color: #bd362f; |
||||||
|
} |
||||||
|
.toast-info { |
||||||
|
background-color: #2f96b4; |
||||||
|
} |
||||||
|
.toast-warning { |
||||||
|
background-color: #f89406; |
||||||
|
} |
||||||
|
/*Responsive Design*/ |
||||||
|
@media all and (max-width: 239px) { |
||||||
|
#toast-container > div { |
||||||
|
padding: 8px 8px 8px 50px; |
||||||
|
width: 11em; |
||||||
|
} |
||||||
|
#toast-container .toast-close-button { |
||||||
|
right: -0.2em; |
||||||
|
top: -0.2em; |
||||||
|
} |
||||||
|
} |
||||||
|
@media all and (min-width: 240px) and (max-width: 479px) { |
||||||
|
#toast-container > div { |
||||||
|
padding: 8px 8px 8px 50px; |
||||||
|
width: 18em; |
||||||
|
} |
||||||
|
#toast-container .toast-close-button { |
||||||
|
right: -0.2em; |
||||||
|
top: -0.2em; |
||||||
|
} |
||||||
|
} |
||||||
|
@media all and (min-width: 480px) and (max-width: 767px) { |
||||||
|
#toast-container > div { |
||||||
|
padding: 15px 15px 15px 50px; |
||||||
|
width: 25em; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
||||||
|
* |
||||||
|
*/ |
||||||
|
|
||||||
|
@import "compass"; |
||||||
|
|
||||||
|
@import "libs/libs"; |
||||||
|
|
||||||
|
@import "global/colors"; |
||||||
|
|
||||||
|
@import "global/base"; |
||||||
|
@import "global/angular"; |
||||||
|
@import "global/nicescroll"; |
||||||
|
@import "global/animations"; |
||||||
|
|
||||||
|
@import "components/bar"; |
||||||
|
@import "components/webrtc"; |
||||||
|
@import "components/buddylist"; |
||||||
|
@import "components/settings"; |
||||||
|
@import "components/chat"; |
||||||
|
@import "components/usability"; |
||||||
|
@import "components/audiolevel"; |
||||||
|
@import "components/fileinfo"; |
||||||
|
@import "components/audiovideo"; |
||||||
|
@import "components/screenshare"; |
||||||
|
@import "components/roombar"; |
||||||
|
|
||||||
|
@import "shame"; |
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,4 @@ |
|||||||
|
Font Awesome by Dave Gandy - http://fontawesome.io |
||||||
|
|
||||||
|
Desktop and webfont files license: SIL OFL 1.1 |
||||||
|
http://scripts.sil.org/OFL |
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 30 KiB |
@ -0,0 +1,152 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define([ |
||||||
|
'require', |
||||||
|
'jquery', |
||||||
|
'underscore', |
||||||
|
'angular', |
||||||
|
'modernizr', |
||||||
|
'moment', |
||||||
|
|
||||||
|
'services/services', |
||||||
|
'directives/directives', |
||||||
|
'filters/filters', |
||||||
|
'controllers/controllers', |
||||||
|
|
||||||
|
'ui-bootstrap', |
||||||
|
'angular-sanitize', |
||||||
|
'angular-animate', |
||||||
|
'angular-humanize', |
||||||
|
'angular-route', |
||||||
|
'mobile-events', |
||||||
|
'dialogs' |
||||||
|
|
||||||
|
], function(require, $, _, angular, modernizr, moment, services, directives, filters, controllers) { |
||||||
|
|
||||||
|
var initialize = function() { |
||||||
|
|
||||||
|
var app = angular.module('app', ['ui.bootstrap', 'ngSanitize', 'ngAnimate', 'ngHumanize', 'ngRoute', 'dialogs']); |
||||||
|
services.initialize(app); |
||||||
|
directives.initialize(app); |
||||||
|
filters.initialize(app); |
||||||
|
controllers.initialize(app); |
||||||
|
|
||||||
|
app.config(["$compileProvider", "$locationProvider", "$routeProvider", function($compileProvider, $locationProvider, $routeProvider) { |
||||||
|
// Allow angular to use filesystem: hrefs which would else be prefixed with unsafe:.
|
||||||
|
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|file|filesystem|blob):/); |
||||||
|
$compileProvider.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|file|filesystem|blob):|data:image\//); |
||||||
|
// Setup routing
|
||||||
|
$routeProvider.when("/:room", {}); |
||||||
|
// Use HTML5 routing.
|
||||||
|
$locationProvider.html5Mode(true); |
||||||
|
}]); |
||||||
|
|
||||||
|
app.run(["$rootScope", "mediaStream", "translation", function($rootScope, mediaStream, translation) { |
||||||
|
translation.inject($rootScope); |
||||||
|
console.log("Initializing ..."); |
||||||
|
mediaStream.initialize($rootScope, translation); |
||||||
|
}]); |
||||||
|
|
||||||
|
angular.element(document).ready(function() { |
||||||
|
|
||||||
|
// Detect language.
|
||||||
|
var lang = (function() { |
||||||
|
var lang; |
||||||
|
var html = document.getElementsByTagName("html")[0]; |
||||||
|
if (modernizr.localstorage) { |
||||||
|
lang = localStorage.getItem("mediastream-language"); |
||||||
|
if (!lang || lang === "undefined") { |
||||||
|
lang = null; |
||||||
|
} |
||||||
|
} |
||||||
|
if (lang) { |
||||||
|
html.setAttribute("lang", lang); |
||||||
|
return lang; |
||||||
|
} else { |
||||||
|
try { |
||||||
|
return html.getAttribute("lang"); |
||||||
|
} catch(e) { |
||||||
|
return "en"; |
||||||
|
}; |
||||||
|
} |
||||||
|
}()); |
||||||
|
|
||||||
|
// Prepare bootstrap function with injected locale data.
|
||||||
|
var domain = "messages"; |
||||||
|
var catalog = domain + "-" + lang; |
||||||
|
var bootstrap = function(translationData) { |
||||||
|
if (translationData) { |
||||||
|
// Set loaded translation data.
|
||||||
|
translationData.missing_key_callback = function(key) { |
||||||
|
console.warn("Missing key " + key + " for " + lang); |
||||||
|
}; |
||||||
|
} else { |
||||||
|
// Fallback catalog in case translation could not be loaded.
|
||||||
|
lang = "en"; |
||||||
|
translationData = {}; |
||||||
|
translationData.locale_data = {}; |
||||||
|
translationData.domain = domain; |
||||||
|
translationData.locale_data[domain] = { |
||||||
|
"": { |
||||||
|
"domain": domain, |
||||||
|
"lang": lang, |
||||||
|
"plural_forms" : "nplurals=2; plural=(n != 1);" |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
// Set date language too.
|
||||||
|
moment.lang([lang, "en"]); |
||||||
|
// Inject translation data globally.
|
||||||
|
app.constant("translationData", translationData); |
||||||
|
// Bootstrap AngularJS app.
|
||||||
|
console.log("Bootstrapping ..."); |
||||||
|
angular.bootstrap(document, ['app']); |
||||||
|
} |
||||||
|
|
||||||
|
if (lang !== "en") { |
||||||
|
// Load translation file.
|
||||||
|
//console.log("Loading translation data: " + lang);
|
||||||
|
$.ajax({ |
||||||
|
dataType: "json", |
||||||
|
url: require.toUrl('translation/'+catalog+'.json'), |
||||||
|
success: function(data) { |
||||||
|
//console.log("Loaded translation data.");
|
||||||
|
bootstrap(data); |
||||||
|
}, |
||||||
|
error: function(err, textStatus, errorThrown) { |
||||||
|
console.warn("Failed to load translation data " + catalog + ": "+ errorThrown); |
||||||
|
bootstrap(null); |
||||||
|
} |
||||||
|
}); |
||||||
|
} else { |
||||||
|
// No need to load english as this is built in.
|
||||||
|
bootstrap(); |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
initialize: initialize |
||||||
|
}; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
// Helper module to put non dependency base libraries together.
|
||||||
|
define([ |
||||||
|
'modernizr', |
||||||
|
'moment', |
||||||
|
'Howler', |
||||||
|
'desktop-notify', |
||||||
|
'bigscreen', |
||||||
|
'visibly', |
||||||
|
'avltree', |
||||||
|
'jed', |
||||||
|
'audiocontext', |
||||||
|
'rAF', |
||||||
|
'humanize', |
||||||
|
'sha' |
||||||
|
], function(){}); |
||||||
@ -0,0 +1,469 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define(['underscore', 'moment', 'text!partials/fileinfo.html'], function(_, moment, templateFileInfo) { |
||||||
|
|
||||||
|
// ChatroomController
|
||||||
|
return ["$scope", "$element", "$window", "safeMessage", "safeDisplayName", "$compile", "$filter", "translation", function($scope, $element, $window, safeMessage, safeDisplayName, $compile, $filter, translation) { |
||||||
|
|
||||||
|
$scope.outputElement = $(".output", $element); |
||||||
|
$scope.inputElement = $(".input", $element); |
||||||
|
var lastSender = null; |
||||||
|
var lastDate = null; |
||||||
|
var lastMessageContainer = null; |
||||||
|
var senderExpired = null; |
||||||
|
var isTyping = false; |
||||||
|
var isTypingExpired = null; |
||||||
|
var peerTypingExpired = null; |
||||||
|
var p2p = false; |
||||||
|
var scrollAfterInput = false; |
||||||
|
|
||||||
|
// Mark seen on several events.
|
||||||
|
$element.on("mouseover mouseenter touchstart", _.debounce(function(event) { |
||||||
|
$scope.$parent.seen(); |
||||||
|
$scope.$apply(); |
||||||
|
}, 100)); |
||||||
|
|
||||||
|
var displayName = safeDisplayName; |
||||||
|
var buddyImageSrc = $filter("buddyImageSrc"); |
||||||
|
var fileInfo = $compile(templateFileInfo); |
||||||
|
|
||||||
|
var knowMessage = { |
||||||
|
r: {}, |
||||||
|
pending: [], |
||||||
|
register: function(element, mid, status, received) { |
||||||
|
if (mid) { |
||||||
|
if (knowMessage.r.hasOwnProperty(mid)) { |
||||||
|
console.warn("Duplicate chat message registration.", mid, element, status); |
||||||
|
return; |
||||||
|
} |
||||||
|
var e = knowMessage.r[mid] = { |
||||||
|
element: element, |
||||||
|
status: status |
||||||
|
} |
||||||
|
if (e.status) { |
||||||
|
element.addClass(e.status); |
||||||
|
} |
||||||
|
if (received) { |
||||||
|
knowMessage.pending.push(mid); |
||||||
|
$scope.$emit("submitreceived", mid); |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
update: function(mid, status) { |
||||||
|
var e = knowMessage.r[mid]; |
||||||
|
if (e) { |
||||||
|
if (e.status !== status && status) { |
||||||
|
if (e.status) { |
||||||
|
e.element.removeClass(e.status); |
||||||
|
} |
||||||
|
e.status = status; |
||||||
|
e.element.addClass(e.status); |
||||||
|
if (status === "received" || status === "read") { |
||||||
|
// last one - cleanup
|
||||||
|
delete knowMessage.r[mid]; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}, |
||||||
|
seen: function() { |
||||||
|
var pending = knowMessage.pending; |
||||||
|
if (pending.length) { |
||||||
|
knowMessage.pending = []; |
||||||
|
$scope.$emit("submitseen", pending); |
||||||
|
_.each(pending, function(mid) { |
||||||
|
knowMessage.update(mid, "read"); |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
// Make sure that chat links are openend in a new window.
|
||||||
|
$element.on("click", function(event) { |
||||||
|
var elem = $(event.target); |
||||||
|
if (elem.is("a")) { |
||||||
|
var url = elem.attr("href"); |
||||||
|
if (url && !elem.attr("download")) { |
||||||
|
if (url.match(/mailto:/gi) === null) { |
||||||
|
event.preventDefault(); |
||||||
|
$window.open(elem.attr("href"), "_blank"); |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$watch("input", function(newvalue) { |
||||||
|
|
||||||
|
$scope.$parent.seen(); |
||||||
|
$window.clearTimeout(isTypingExpired); |
||||||
|
if (!newvalue) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if (!isTyping) { |
||||||
|
isTyping = true; |
||||||
|
$scope.$emit("typing", {who: "local", status: "start"}); |
||||||
|
} |
||||||
|
isTypingExpired = $window.setTimeout(function() { |
||||||
|
isTyping = false; |
||||||
|
$scope.$emit("typing", {who: "local", status: "stop"}); |
||||||
|
}, 4000); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
$scope.reset = function() { |
||||||
|
$scope.input = ""; |
||||||
|
isTyping = false; |
||||||
|
$window.clearTimeout(isTypingExpired); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.focus = function() { |
||||||
|
$scope.inputElement.focus(); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.submit = function() { |
||||||
|
var input = $scope.input; |
||||||
|
if (input) { |
||||||
|
scrollAfterInput = true; |
||||||
|
$scope.$emit("submit", $scope.input); |
||||||
|
$scope.reset(); |
||||||
|
$scope.focus(); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.canScroll = function() { |
||||||
|
|
||||||
|
var o = $scope.outputElement.get(0); |
||||||
|
if ((o.clientHeight - 20) < o.scrollHeight) { |
||||||
|
if (!scrollAfterInput && (o.clientHeight + 20) < (o.scrollHeight - o.scrollTop)) { |
||||||
|
// Manually scrolled -> do nothing.
|
||||||
|
} else { |
||||||
|
scrollAfterInput = false; |
||||||
|
// Return scroll function.
|
||||||
|
return function() { |
||||||
|
o.scrollTop = o.scrollHeight; |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
$scope.display = function(s, nodes, extra_css, title, picture) { |
||||||
|
|
||||||
|
var container; |
||||||
|
var element; |
||||||
|
var scroll = this.canScroll(); |
||||||
|
lastMessageContainer = null; |
||||||
|
|
||||||
|
if (!extra_css) { |
||||||
|
extra_css = ""; |
||||||
|
} |
||||||
|
if (s || title || picture) { |
||||||
|
container = $('<div class="message ' + extra_css + '"></div>'); |
||||||
|
if (title) { |
||||||
|
container.prepend(title); |
||||||
|
} |
||||||
|
if (picture) { |
||||||
|
container.prepend(picture); |
||||||
|
} |
||||||
|
lastMessageContainer = $("<ul>").appendTo(container); |
||||||
|
if ($.trim(s)) { |
||||||
|
element = $("<li>").html(s).appendTo(lastMessageContainer); |
||||||
|
} |
||||||
|
} |
||||||
|
if (nodes) { |
||||||
|
if (container) { |
||||||
|
// Insert at the end of previously created container.
|
||||||
|
container.append(nodes); |
||||||
|
} else { |
||||||
|
$scope.outputElement.append(nodes); |
||||||
|
} |
||||||
|
if (container && lastMessageContainer) { |
||||||
|
lastMessageContainer = $("<ul>").appendTo(container); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (container) { |
||||||
|
$scope.outputElement.append(container); |
||||||
|
} |
||||||
|
|
||||||
|
if (scroll) { |
||||||
|
scroll(); |
||||||
|
} |
||||||
|
|
||||||
|
return element; |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.append = function(s, nodes) { |
||||||
|
|
||||||
|
if (!lastMessageContainer) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
var scroll = this.canScroll(); |
||||||
|
|
||||||
|
var li = $("<li>"); |
||||||
|
li.html(s) |
||||||
|
lastMessageContainer.append(li) |
||||||
|
|
||||||
|
if (nodes) { |
||||||
|
var parent = lastMessageContainer.parent(); |
||||||
|
parent.append(nodes); |
||||||
|
lastMessageContainer = $("<ul>"); |
||||||
|
parent.append(lastMessageContainer); |
||||||
|
} |
||||||
|
|
||||||
|
if (scroll) { |
||||||
|
scroll(); |
||||||
|
} |
||||||
|
|
||||||
|
return li; |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.showtime = function(d, format, compare) { |
||||||
|
|
||||||
|
var m; |
||||||
|
if (d) { |
||||||
|
m = moment(d); |
||||||
|
} else { |
||||||
|
m = moment(); |
||||||
|
} |
||||||
|
if (!format) { |
||||||
|
format = "LLL"; |
||||||
|
} |
||||||
|
|
||||||
|
var datestring = m.format(format); |
||||||
|
if (compare && datestring === compare) { |
||||||
|
// Do nothing if compare matches.
|
||||||
|
return datestring; |
||||||
|
} |
||||||
|
$scope.display(null, $("<i>" + datestring + "</i>")); |
||||||
|
if (!d) { |
||||||
|
lastSender = null; |
||||||
|
} |
||||||
|
return datestring; |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.showdate = function(d) { |
||||||
|
|
||||||
|
lastDate = $scope.showtime(d, "LL", lastDate); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.showmessage = function(from, timestamp, message, nodes) { |
||||||
|
|
||||||
|
var userid = $scope.$parent.$parent.id; |
||||||
|
|
||||||
|
// Prepare message to display.
|
||||||
|
var s = []; |
||||||
|
if (message) { |
||||||
|
s.push(message); |
||||||
|
$scope.$emit("incoming", message, from, userid); |
||||||
|
} |
||||||
|
|
||||||
|
var is_new_message = lastSender !== from; |
||||||
|
var is_self = from === userid; |
||||||
|
|
||||||
|
var extra_css = ""; |
||||||
|
var title = null; |
||||||
|
var picture = null; |
||||||
|
|
||||||
|
if (is_new_message) { |
||||||
|
var buddyScope; |
||||||
|
title = $("<strong>"); |
||||||
|
title.html(displayName(from, true)); |
||||||
|
lastSender = from; |
||||||
|
extra_css += "with_name "; |
||||||
|
$scope.showdate(timestamp); |
||||||
|
var imgSrc = buddyImageSrc(from); |
||||||
|
picture = $('<div class="buddyimage"><i class="fa fa-user fa-3x"/><img/></div>'); |
||||||
|
if (imgSrc) { |
||||||
|
picture.find("img").attr("src", imgSrc); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var message = s.join(" "); |
||||||
|
|
||||||
|
if (!is_new_message) { |
||||||
|
var element = this.append(message, nodes); |
||||||
|
if (element) { |
||||||
|
return element; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (is_self) { |
||||||
|
extra_css += "is_self"; |
||||||
|
} else { |
||||||
|
extra_css += "is_remote"; |
||||||
|
} |
||||||
|
if (timestamp) { |
||||||
|
var ts = $('<div class="timestamp"/>'); |
||||||
|
ts.text(moment(timestamp).format("H:mm")); |
||||||
|
if (nodes) { |
||||||
|
nodes = nodes.add(ts); |
||||||
|
} else { |
||||||
|
nodes = ts; |
||||||
|
} |
||||||
|
} |
||||||
|
return $scope.display(message, nodes, extra_css, title, picture); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.$on("seen", function() { |
||||||
|
|
||||||
|
knowMessage.seen(); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("p2p", function(event, state) { |
||||||
|
//console.log("changed p2p state", state, p2p);
|
||||||
|
var msg; |
||||||
|
if (state) { |
||||||
|
msg = translation._("Peer to peer chat active."); |
||||||
|
} else { |
||||||
|
msg = translation._("Peer to peer chat is now off."); |
||||||
|
} |
||||||
|
$scope.display(null, $("<i class='p2p'><span class='icon-exchange'></span> " + msg + "</i>")); |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("focus", function() { |
||||||
|
|
||||||
|
$scope.focus(); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("received", function(event, from, data) { |
||||||
|
|
||||||
|
var userid = $scope.$parent.$parent.id; |
||||||
|
var mid = data.Mid || null; |
||||||
|
|
||||||
|
switch (data.Type) { |
||||||
|
case "LeftOrJoined": |
||||||
|
$scope.showtime(new Date()); |
||||||
|
if (data.LeftOrJoined === "left") { |
||||||
|
$scope.display(null, $("<i>"+ displayName(from) + translation._(" is now offline.") + "</i>")); |
||||||
|
} else { |
||||||
|
$scope.display(null, $("<i>"+ displayName(from) + translation._(" is now online.") + "</i>")); |
||||||
|
} |
||||||
|
break; |
||||||
|
case "Log": |
||||||
|
$scope.showtime(new Date()); |
||||||
|
$scope.display(null, data.Log); |
||||||
|
break; |
||||||
|
case "Message": |
||||||
|
default: |
||||||
|
|
||||||
|
// Definitions.
|
||||||
|
var message = null; |
||||||
|
var nodes = null; |
||||||
|
var fromself = from === userid; |
||||||
|
var noop = false; |
||||||
|
var element = null; |
||||||
|
|
||||||
|
var timestamp = data.Time; |
||||||
|
if (!timestamp) { |
||||||
|
timestamp = new Date(); |
||||||
|
} |
||||||
|
|
||||||
|
// Process internal status messages.
|
||||||
|
if (data.Status) { |
||||||
|
|
||||||
|
if (!mid && data.Status.Mid) { |
||||||
|
mid = data.Status.Mid; // Inner Mid means internal chat status.
|
||||||
|
} |
||||||
|
|
||||||
|
// Typing notification.
|
||||||
|
if (data.Status.Typing && !fromself) { |
||||||
|
$window.clearTimeout(peerTypingExpired); |
||||||
|
$scope.$emit("typing", {who: "peer", status: data.Status.Typing}); |
||||||
|
if (data.Status.Typing === "stop") { |
||||||
|
peerTypingExpired = $window.setTimeout(function() { |
||||||
|
$scope.$emit("typing", {who: "peer", status: "no"}); |
||||||
|
}, 20000); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Mid updates.
|
||||||
|
if (mid && data.Status.State) { |
||||||
|
knowMessage.update(mid, data.Status.State); |
||||||
|
} |
||||||
|
|
||||||
|
// Mid batch updates.
|
||||||
|
if (data.Status.SeenMids) { |
||||||
|
_.each(data.Status.SeenMids, function(mid) { |
||||||
|
knowMessage.update(mid, "received"); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// File offers.
|
||||||
|
if (data.Status.FileInfo) { |
||||||
|
var subscope = $scope.$new(); |
||||||
|
subscope.info = data.Status.FileInfo; |
||||||
|
subscope.from = from; |
||||||
|
fileInfo(subscope, function(clonedElement, scope) { |
||||||
|
var text = fromself ? translation._("You share file:") : translation._("Incoming file:"); |
||||||
|
element = $scope.showmessage(from, timestamp, text, clonedElement); |
||||||
|
}); |
||||||
|
noop = true; |
||||||
|
} |
||||||
|
|
||||||
|
// Ignore unknown status messages.
|
||||||
|
if (message === null && nodes === null) { |
||||||
|
noop = true; |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// Do nothing when where is nothing.
|
||||||
|
if (!data.Message && message === null && nodes === null) { |
||||||
|
noop = true; |
||||||
|
} |
||||||
|
|
||||||
|
if (!noop) { |
||||||
|
// Default handling is to use full message with security in place.
|
||||||
|
if (message === null && nodes === null && data.Message && typeof data.Message == "string") { |
||||||
|
message = safeMessage(data.Message); |
||||||
|
} |
||||||
|
// Show the beast.
|
||||||
|
element = $scope.showmessage(from, timestamp, message, nodes); |
||||||
|
} |
||||||
|
|
||||||
|
if (element && mid && !$scope.isgroupchat) { |
||||||
|
knowMessage.register(element, mid, fromself ? "sending" : "unread", !fromself); |
||||||
|
} |
||||||
|
|
||||||
|
break; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// Reset last sender to allow a new time stamp after a while.
|
||||||
|
$window.clearTimeout(senderExpired); |
||||||
|
senderExpired = $window.setTimeout(function() { |
||||||
|
lastSender = null; |
||||||
|
}, 61000); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,45 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define([ |
||||||
|
'underscore', |
||||||
|
|
||||||
|
'controllers/mediastreamcontroller', |
||||||
|
'controllers/statusmessagecontroller', |
||||||
|
'controllers/chatroomcontroller' |
||||||
|
], function(_, MediastreamController, StatusmessageController, ChatroomController) { |
||||||
|
|
||||||
|
var controllers = { |
||||||
|
MediastreamController: MediastreamController, |
||||||
|
StatusmessageController: StatusmessageController, |
||||||
|
ChatroomController: ChatroomController |
||||||
|
}; |
||||||
|
|
||||||
|
var initialize = function (angModule) { |
||||||
|
_.each(controllers, function(controller, name) { |
||||||
|
angModule.controller(name, controller); |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
return { |
||||||
|
initialize: initialize |
||||||
|
}; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,638 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define(['underscore', 'bigscreen', 'moment', 'webrtc.adapter', 'webrtc.ice'], function(_, BigScreen, moment) { |
||||||
|
|
||||||
|
return ["$scope", "$rootScope", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", function($scope, $rootScope, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload) { |
||||||
|
|
||||||
|
/*console.log("route", $route, $routeParams, $location);*/ |
||||||
|
|
||||||
|
// Disable drag and drop.
|
||||||
|
$($window).on("dragover dragenter drop", function(event) { |
||||||
|
event.preventDefault(); |
||||||
|
}); |
||||||
|
|
||||||
|
// Avoid accidential reloads or exits.
|
||||||
|
var manualUnload = false; |
||||||
|
$($window).on("beforeunload", function(event) { |
||||||
|
if (manualUnload && !$scope.peer) { |
||||||
|
return; |
||||||
|
} |
||||||
|
return translation._("Quit from Spreed Me?"); |
||||||
|
}); |
||||||
|
|
||||||
|
// Enable app full screen listener.
|
||||||
|
$("#bar .logo").on("doubletap", function() { |
||||||
|
if (BigScreen.enabled) { |
||||||
|
BigScreen.toggle($("body").get(0)); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
// Load default sounds.
|
||||||
|
playSound.initialize({ |
||||||
|
urls: ['sounds/sprite1.ogg', 'sounds/sprite1.mp3'], |
||||||
|
sprite: { |
||||||
|
"connect1": [ |
||||||
|
0, |
||||||
|
5179 |
||||||
|
], |
||||||
|
"end1": [ |
||||||
|
12892, |
||||||
|
6199 |
||||||
|
], |
||||||
|
"entry1": [ |
||||||
|
8387, |
||||||
|
3000 |
||||||
|
], |
||||||
|
"leaving1": [ |
||||||
|
5228, |
||||||
|
2126 |
||||||
|
], |
||||||
|
"message1": [ |
||||||
|
19140, |
||||||
|
816 |
||||||
|
], |
||||||
|
"question1": [ |
||||||
|
20006, |
||||||
|
3313 |
||||||
|
], |
||||||
|
"ringtone1": [ |
||||||
|
7403, |
||||||
|
935 |
||||||
|
], |
||||||
|
"whistle1": [ |
||||||
|
11437, |
||||||
|
1405 |
||||||
|
] |
||||||
|
} |
||||||
|
}, null, { |
||||||
|
"ring": "whistle1", |
||||||
|
"joined": "entry1", |
||||||
|
"left": "leaving1", |
||||||
|
"end": "end1", |
||||||
|
"dial": "ringtone1", |
||||||
|
"connect": "connect1", |
||||||
|
"prompt": "question1" |
||||||
|
}); |
||||||
|
|
||||||
|
appData.set($scope); |
||||||
|
|
||||||
|
var videoQualityMap = { |
||||||
|
low: { |
||||||
|
maxWidth: 320, |
||||||
|
maxHeight: 180 |
||||||
|
}, |
||||||
|
high: { |
||||||
|
maxWidth: 640, |
||||||
|
maxHeight: 360 |
||||||
|
}, |
||||||
|
hd: { |
||||||
|
minWidth: 1280, |
||||||
|
minHeight: 720 |
||||||
|
}, |
||||||
|
fullhd: { |
||||||
|
minWidth: 1920, |
||||||
|
minHeight: 1080 |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var displayName = safeDisplayName; |
||||||
|
|
||||||
|
// Init STUN and TURN servers.
|
||||||
|
$scope.stun = mediaStream.config.StunURIs || []; |
||||||
|
if (!$scope.stun.length) { |
||||||
|
$scope.stun.push("stun:stun.l.google.com:19302") |
||||||
|
} |
||||||
|
$scope.turn = {}; // TURN servers are set on received.self.
|
||||||
|
|
||||||
|
// Add browser details for easy access.
|
||||||
|
$scope.isChrome = $window.webrtcDetectedBrowser === "chrome"; |
||||||
|
$scope.webrtcDetectedBrowser = $window.webrtcDetectedBrowser; |
||||||
|
$scope.webrtcDetectedVersion = $window.webrtcDetectedVersion; |
||||||
|
|
||||||
|
// Default scope data.
|
||||||
|
$scope.status = "initializing"; |
||||||
|
$scope.id = null; |
||||||
|
$scope.peer = null; |
||||||
|
$scope.mainView = null; |
||||||
|
$scope.dialing = null; |
||||||
|
$scope.conference = null; |
||||||
|
$scope.conferencePeers = []; |
||||||
|
$scope.incoming = null; |
||||||
|
$scope.microphoneMute = false; |
||||||
|
$scope.cameraMute = false; |
||||||
|
$scope.autoAccept = null; |
||||||
|
$scope.master = { |
||||||
|
displayName: null, |
||||||
|
buddyPicture: null, |
||||||
|
settings: { |
||||||
|
videoQuality: "high", |
||||||
|
stereo: true, |
||||||
|
maxFrameRate: 20, |
||||||
|
screensharingMedia: false, |
||||||
|
defaultRoom: "" |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
// Cache.
|
||||||
|
var cache = {}; |
||||||
|
|
||||||
|
$scope.update = function(user, noRefresh) { |
||||||
|
$scope.master = angular.copy(user); |
||||||
|
$scope.updateStatus(); |
||||||
|
if (!noRefresh) { |
||||||
|
$scope.refreshWebrtcSettings(); |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.setStatus = function(status) { |
||||||
|
// This is the connection status to signaling server.
|
||||||
|
$scope.$emit("status", status); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.updateStatus = (function() { |
||||||
|
return function() { |
||||||
|
// This is the user status.
|
||||||
|
var status = { |
||||||
|
displayName: $scope.master.displayName || null, |
||||||
|
buddyPicture: $scope.master.buddyPicture || null |
||||||
|
} |
||||||
|
if (_.isEqual(status, cache.status)) { |
||||||
|
console.log("Status update skipped, as status has not changed.") |
||||||
|
} else { |
||||||
|
console.log("Updating own status", status); |
||||||
|
mediaStream.api.updateStatus(status); |
||||||
|
cache.status = status; |
||||||
|
} |
||||||
|
}; |
||||||
|
}()); |
||||||
|
|
||||||
|
$scope.reset = function() { |
||||||
|
$scope.user = angular.copy($scope.master); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.refreshWebrtcSettings = function() { |
||||||
|
|
||||||
|
if (!$window.webrtcDetectedBrowser) { |
||||||
|
console.warn("This is not a WebRTC capable browser."); |
||||||
|
return; |
||||||
|
} |
||||||
|
var settings = $scope.master.settings; |
||||||
|
|
||||||
|
// Create iceServers from scope settings.
|
||||||
|
var iceServers = []; |
||||||
|
var iceServer; |
||||||
|
if ($scope.stun.length) { |
||||||
|
iceServer = createIceServers($scope.stun); |
||||||
|
if (iceServer.length) { |
||||||
|
iceServers.push.apply(iceServers, iceServer); |
||||||
|
} |
||||||
|
} |
||||||
|
if ($scope.turn.urls && $scope.turn.urls.length) { |
||||||
|
iceServer = createIceServers($scope.turn.urls, $scope.turn.username, $scope.turn.password); |
||||||
|
if (iceServer.length) { |
||||||
|
iceServers.push.apply(iceServers, iceServer); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
var audioConstraints = []; |
||||||
|
var videoConstraints = []; |
||||||
|
var videoConstraintsMandatory = {}; |
||||||
|
|
||||||
|
// Chrome only constraints.
|
||||||
|
if ($scope.isChrome) { |
||||||
|
// Video.
|
||||||
|
videoConstraintsMandatory = $.extend(videoConstraintsMandatory, videoQualityMap[settings.videoQuality]); |
||||||
|
// Not supported as of Firefox 27.
|
||||||
|
if (settings.microphoneId) { |
||||||
|
audioConstraints.push({sourceId: settings.microphoneId}); |
||||||
|
} |
||||||
|
// Not supported as of Firefox 27.
|
||||||
|
if (settings.cameraId) { |
||||||
|
videoConstraints.push({sourceId: settings.cameraId}); |
||||||
|
} |
||||||
|
// Not supported as of Firefox 27.
|
||||||
|
if (settings.maxFrameRate && settings.maxFrameRate != "auto") { |
||||||
|
videoConstraintsMandatory.maxFrameRate = parseInt(settings.maxFrameRate, 10); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Apply the shit.
|
||||||
|
mediaStream.webrtc.settings.stereo = settings.stereo; |
||||||
|
mediaStream.webrtc.settings.mediaConstraints.video.mandatory = videoConstraintsMandatory; |
||||||
|
mediaStream.webrtc.settings.mediaConstraints.video.optional = videoConstraints; |
||||||
|
mediaStream.webrtc.settings.mediaConstraints.audio = { |
||||||
|
optional: audioConstraints |
||||||
|
}; |
||||||
|
mediaStream.webrtc.settings.pcConfig.iceServers = iceServers; |
||||||
|
|
||||||
|
// Inject optional stuff.
|
||||||
|
var optionalPcConstraints = mediaStream.webrtc.settings.pcConstraints.optional = []; |
||||||
|
if ($window.webrtcDetectedBrowser === "chrome") { |
||||||
|
// NOTE(longsleep): We can always enable SCTP data channels, as we have a workaround
|
||||||
|
// using the "active" event for Firefox < 27.
|
||||||
|
if (true) { |
||||||
|
// SCTP does not work correctly with Chrome 31. Require M32.
|
||||||
|
if ($window.webrtcDetectedVersion >= 32) { |
||||||
|
// SCTP is supported from Chrome M31.
|
||||||
|
// No need to pass DTLS constraint as it is on by default in Chrome M31.
|
||||||
|
// For SCTP, reliable and ordered is true by default.
|
||||||
|
console.info("Using SCTP based Data Channels."); |
||||||
|
} else { |
||||||
|
// Chrome < M31 does not yet do DTLS-SRTP by default whereas Firefox only
|
||||||
|
// does DTLS-SRTP. In order to get interop, you must supply Chrome
|
||||||
|
// with a PC constructor constraint to enable DTLS.
|
||||||
|
optionalPcConstraints.push({DtlsSrtpKeyAgreement: true}); |
||||||
|
} |
||||||
|
} else { |
||||||
|
// NOTE(longsleep): This disables SCTP data channels, which hacks Firefox
|
||||||
|
// support by forcing old style Chrome Rtp data channels. SCTP Data Channels
|
||||||
|
// between Firefox and Chrome will not work until FF 27.
|
||||||
|
// See https://code.google.com/p/webrtc/issues/detail?id=2279 and
|
||||||
|
// https://code.google.com/p/chromium/issues/detail?id=295771
|
||||||
|
optionalPcConstraints.push({RtpDataChannels: true}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
console.log("WebRTC settings", mediaStream.webrtc.settings); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
var pickupTimeout = null; |
||||||
|
var autoAcceptTimeout = null; |
||||||
|
$scope.updateAutoAccept = function(id, from) { |
||||||
|
|
||||||
|
if (id) { |
||||||
|
console.log("Auto accept requested", id); |
||||||
|
$scope.autoAccept = id; |
||||||
|
$window.clearTimeout(autoAcceptTimeout); |
||||||
|
autoAcceptTimeout = window.setTimeout(function() { |
||||||
|
$scope.autoAccept=null; |
||||||
|
console.warn("Auto accept expired!") |
||||||
|
safeApply($scope); |
||||||
|
}, 2000); |
||||||
|
} else { |
||||||
|
if ($scope.autoAccept && $scope.autoAccept === from) { |
||||||
|
$scope.autoAccept = null; |
||||||
|
$window.clearTimeout(autoAcceptTimeout); |
||||||
|
console.log("Auto accept success", from) |
||||||
|
return from; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.manualReloadApp = function() { |
||||||
|
manualUnload = true; |
||||||
|
$window.location.reload(true); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.$watch("cameraMute", function(cameraMute) { |
||||||
|
mediaStream.webrtc.setVideoMute(cameraMute); |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$watch("microphoneMute", function(cameraMute) { |
||||||
|
mediaStream.webrtc.setAudioMute(cameraMute); |
||||||
|
}); |
||||||
|
|
||||||
|
// Load stuff from localStorage.
|
||||||
|
// TODO(longsleep): Put localStorage into Angular service.
|
||||||
|
var storedUser = localStorage.getItem("mediastream-user"); |
||||||
|
console.log("Found stored user data:", storedUser); |
||||||
|
if (storedUser) { |
||||||
|
storedUser = JSON.parse(storedUser); |
||||||
|
$scope.user = $.extend(true, {}, $scope.master, storedUser); |
||||||
|
$scope.user.settings = $.extend(true, {}, $scope.user.settings, $scope.master.settings, $scope.user.settings); |
||||||
|
$scope.update($scope.user, true); |
||||||
|
$scope.loadedUser = true; |
||||||
|
// Add room definition to root to be availale on initial connect.
|
||||||
|
$rootScope.roomid = $scope.user.settings.defaultRoom || ""; |
||||||
|
} |
||||||
|
$scope.reset(); |
||||||
|
|
||||||
|
var ringer = playSound.interval("ring", null, 4000); |
||||||
|
var dialer = playSound.interval("dial", null, 4000); |
||||||
|
var dialerEnabled = false; |
||||||
|
var notification; |
||||||
|
var ttlTimeout; |
||||||
|
var reloadDialog = false; |
||||||
|
|
||||||
|
mediaStream.api.e.on("received.self", function(event, data) { |
||||||
|
$window.clearTimeout(ttlTimeout); |
||||||
|
safeApply($scope, function(scope) { |
||||||
|
scope.id = scope.myid = data.Id; |
||||||
|
scope.turn = data.Turn; |
||||||
|
scope.stun = data.Stun; |
||||||
|
scope.refreshWebrtcSettings(); |
||||||
|
}); |
||||||
|
if (data.Version !== mediaStream.version) { |
||||||
|
console.info("Server was upgraded. Reload required."); |
||||||
|
if (!reloadDialog) { |
||||||
|
reloadDialog = true; |
||||||
|
_.delay(function() { |
||||||
|
alertify.dialog.confirm(translation._("Restart required to apply updates. Click ok to restart now."), function() { |
||||||
|
$scope.manualReloadApp(); |
||||||
|
}, function() { |
||||||
|
reloadDialog = false; |
||||||
|
}); |
||||||
|
}, 300); |
||||||
|
} |
||||||
|
} |
||||||
|
// Support to upgrade stuff when ttl was reached.
|
||||||
|
if (data.Turn.ttl) { |
||||||
|
ttlTimeout = $window.setTimeout(function() { |
||||||
|
console.log("Ttl reached - sending refresh request."); |
||||||
|
mediaStream.api.sendSelf(); |
||||||
|
}, data.Turn.ttl / 100 * 90 * 1000); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("peercall", function(event, peercall) { |
||||||
|
// Kill timeout.
|
||||||
|
$timeout.cancel(pickupTimeout); |
||||||
|
pickupTimeout = null; |
||||||
|
// Kill ringer.
|
||||||
|
if (peercall && peercall.from === null) { |
||||||
|
dialerEnabled = true; |
||||||
|
} else { |
||||||
|
dialerEnabled = false; |
||||||
|
} |
||||||
|
ringer.stop(); |
||||||
|
// Close notifications.
|
||||||
|
if (notification) { |
||||||
|
notification.close(); |
||||||
|
} |
||||||
|
// Apply peer call to scope.
|
||||||
|
safeApply($scope, function(scope) { |
||||||
|
scope.peer = peercall ? peercall.id : null; |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("peerconference", function(event, peerconference) { |
||||||
|
safeApply($scope, function(scope) { |
||||||
|
scope.conference = peerconference ? peerconference.id : null; |
||||||
|
scope.conferencePeers = peerconference ? peerconference.peerIds() : []; |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("offer", function(event, from, to2, to) { |
||||||
|
safeApply($scope, function(scope) { |
||||||
|
scope.incoming = from; |
||||||
|
}); |
||||||
|
if ($scope.updateAutoAccept(null, from)) { |
||||||
|
// Auto accept support.
|
||||||
|
mediaStream.webrtc.doAccept(); |
||||||
|
return; |
||||||
|
} |
||||||
|
// Start to ring.
|
||||||
|
ringer.start(); |
||||||
|
// Show incoming call notification.
|
||||||
|
notification = desktopNotify.notify(translation._("Incoming call"), translation._("from") + " "+ displayName(from), {timeout: null}); |
||||||
|
$scope.$emit("status", "ringing"); |
||||||
|
// Start accept timeout.
|
||||||
|
pickupTimeout = $timeout(function() { |
||||||
|
console.log("Pickup timeout reached."); |
||||||
|
mediaStream.webrtc.doHangup("pickuptimeout"); |
||||||
|
$scope.$emit("notification", "incomingpickuptimeout", {reason: 'pickuptimeout', from: from}); |
||||||
|
}, 30000); |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("error", function(event, message, msgid) { |
||||||
|
switch (msgid) { |
||||||
|
case "failed_getusermedia": |
||||||
|
message = translation._("Failed to access camera/microphone."); |
||||||
|
break |
||||||
|
case "failed_peerconnection_setup": |
||||||
|
case "failed_peerconnection": |
||||||
|
message = translation._("Failed to establish peer connection.") |
||||||
|
break |
||||||
|
default: |
||||||
|
break |
||||||
|
} |
||||||
|
if (!message) { |
||||||
|
message = msgid; |
||||||
|
} |
||||||
|
if (!message) { |
||||||
|
message = translation._("We are sorry but something went wrong. Boo boo."); |
||||||
|
} |
||||||
|
alertify.dialog.alert(translation._("Oops")+"<br/>"+message); |
||||||
|
}); |
||||||
|
|
||||||
|
var reconnecting = false; |
||||||
|
var connected = false; |
||||||
|
var autoreconnect = true; |
||||||
|
|
||||||
|
var reconnect = function() { |
||||||
|
if (connected && autoreconnect) { |
||||||
|
reconnecting = false; |
||||||
|
_.delay(function() { |
||||||
|
if (autoreconnect && !reconnecting) { |
||||||
|
reconnecting = true; |
||||||
|
mediaStream.connector.reconnect() |
||||||
|
} |
||||||
|
}, 500); |
||||||
|
$scope.setStatus("reconnecting"); |
||||||
|
} else { |
||||||
|
$scope.setStatus("closed"); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
mediaStream.connector.e.on("open error close", function(event, options) { |
||||||
|
var t = event.type; |
||||||
|
var opts = $.extend({}, options); |
||||||
|
switch (t) { |
||||||
|
case "open": |
||||||
|
t = "waiting"; |
||||||
|
connected = true; |
||||||
|
reconnecting = false; |
||||||
|
cache = {}; // Start fresh.
|
||||||
|
$scope.updateStatus(); |
||||||
|
if (opts.soft) { |
||||||
|
return; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "error": |
||||||
|
if (reconnecting || connected) { |
||||||
|
reconnecting = false; |
||||||
|
reconnect(); |
||||||
|
return; |
||||||
|
} |
||||||
|
break; |
||||||
|
case "close": |
||||||
|
reconnect(); |
||||||
|
break; |
||||||
|
} |
||||||
|
$scope.setStatus(t); |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("waitforusermedia connecting", function(event, currentcall) { |
||||||
|
var t = event.type; |
||||||
|
safeApply($scope, function(scope) { |
||||||
|
scope.dialing = currentcall ? currentcall.id : null; |
||||||
|
scope.setStatus(t); |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("statechange", function(event, state, currentcall) { |
||||||
|
console.info("P2P state changed", state, currentcall.id); |
||||||
|
switch (state) { |
||||||
|
case "completed": |
||||||
|
case "connected": |
||||||
|
if ($scope.conference) { |
||||||
|
$scope.setStatus('conference'); |
||||||
|
} else { |
||||||
|
$scope.setStatus('connected'); |
||||||
|
} |
||||||
|
break; |
||||||
|
case "failed": |
||||||
|
mediaStream.webrtc.doHangup(); |
||||||
|
alertify.dialog.alert(translation._("Peer connection failed. Check your settings.")); |
||||||
|
break; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("active", function(event, currentcall) { |
||||||
|
|
||||||
|
console.info("Video state active (assuming connected)", currentcall.id); |
||||||
|
if ($scope.conference) { |
||||||
|
$scope.setStatus('conference'); |
||||||
|
} else { |
||||||
|
$scope.setStatus('connected'); |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("mainview", function(event, mainview, state) { |
||||||
|
console.info("Main view update", mainview, state); |
||||||
|
var changed = false; |
||||||
|
if ($scope.mainview === mainview && !state) { |
||||||
|
$scope.mainview = null; |
||||||
|
changed = true; |
||||||
|
|
||||||
|
} else if (state) { |
||||||
|
$scope.mainview = mainview; |
||||||
|
changed = true; |
||||||
|
} |
||||||
|
if (changed) { |
||||||
|
$scope.$broadcast("mainresize"); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("done", function() { |
||||||
|
if (mediaStream.connector.connected) { |
||||||
|
$scope.setStatus("waiting"); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("busy", function(event, from) { |
||||||
|
console.log("Incoming call - sent busy.", from); |
||||||
|
$scope.$emit("notification", "incomingbusy", {reason: 'busy', from: from}); |
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("bye", function(event, reason, from) { |
||||||
|
switch (reason) { |
||||||
|
case "busy": |
||||||
|
console.log("User is busy", reason, from); |
||||||
|
$scope.$emit("notification", "busy", {reason: reason, from: from}); |
||||||
|
break; |
||||||
|
case "reject": |
||||||
|
console.log("User rejected", reason, from); |
||||||
|
$scope.$emit("notification", "reject", {reason: reason, from: from}); |
||||||
|
break; |
||||||
|
case "pickuptimeout": |
||||||
|
console.log("User did not pick up", reason, from); |
||||||
|
$scope.$emit("notification", "pickuptimeout", {reason: reason, from: from}); |
||||||
|
break; |
||||||
|
case "error": |
||||||
|
console.log("User cannot accept call because of error"); |
||||||
|
alertify.dialog.alert(translation._("Oops")+"<br/>"+translation._("User hung up because of error.")); |
||||||
|
break; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("status", function(event, status) { |
||||||
|
if (status === "connecting" && dialerEnabled) { |
||||||
|
dialer.start(); |
||||||
|
} else { |
||||||
|
dialer.stop(); |
||||||
|
} |
||||||
|
safeApply($scope, function(scope) { |
||||||
|
var old = $scope.status; |
||||||
|
$scope.status = status; |
||||||
|
if (old === "connected" && status === "waiting") { |
||||||
|
_.delay(playSound.play, 100, "end"); |
||||||
|
} else if (old === "connecting" && status === "connected") { |
||||||
|
playSound.play("connect"); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("notification", function(event, type, details) { |
||||||
|
var message = null; |
||||||
|
switch(type) { |
||||||
|
case "busy": |
||||||
|
message = displayName(details.from)+translation._(" is busy. Try again later."); |
||||||
|
break; |
||||||
|
case "reject": |
||||||
|
message = displayName(details.from)+translation._(" rejected your call."); |
||||||
|
break; |
||||||
|
case "pickuptimeout": |
||||||
|
message = displayName(details.from)+translation._(" does not pick up."); |
||||||
|
break; |
||||||
|
case "incomingbusy": |
||||||
|
toastr.info(moment().format("llll"), displayName(details.from)+translation._(" tried to call you.")); |
||||||
|
break; |
||||||
|
case "incomingpickuptimeout": |
||||||
|
toastr.info(moment().format("llll"), displayName(details.from)+translation._(" called you.")); |
||||||
|
break; |
||||||
|
} |
||||||
|
if (message) { |
||||||
|
playSound.play("question"); |
||||||
|
alertify.dialog.alert(message); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("download", function(event, from, token) { |
||||||
|
|
||||||
|
var scope = event.targetScope; |
||||||
|
fileDownload.startDownload(scope, from, token); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("screenshare", function(event, status) { |
||||||
|
|
||||||
|
//console.log("AAAAAAAAAAA screenshare", status, $scope.enableScreenshare);
|
||||||
|
if ($scope.enableScreenshare !== status) { |
||||||
|
$scope.enableScreenshare = !!status; |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
_.defer(function() { |
||||||
|
if (!$window.webrtcDetectedVersion) { |
||||||
|
alertify.dialog.alert(translation._("Your browser does not support WebRTC. No calls possible.")); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,44 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define([], function() { |
||||||
|
|
||||||
|
// StatusmessageController
|
||||||
|
return ["$scope", "mediaStream", function($scope, mediaStream) { |
||||||
|
|
||||||
|
$scope.doHangup = function() { |
||||||
|
mediaStream.webrtc.doHangup(); |
||||||
|
} |
||||||
|
$scope.doAbort = function() { |
||||||
|
mediaStream.webrtc.doHangup("abort", $scope.dialing); |
||||||
|
} |
||||||
|
$scope.doReconnect = function() { |
||||||
|
mediaStream.connector.reconnect(); |
||||||
|
} |
||||||
|
$scope.doAccept = function() { |
||||||
|
mediaStream.webrtc.doAccept(); |
||||||
|
} |
||||||
|
$scope.doReject = function() { |
||||||
|
mediaStream.webrtc.doHangup('reject'); |
||||||
|
} |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,156 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define(['jquery', 'underscore', 'rAF'], function($, _) { |
||||||
|
|
||||||
|
return ["$window", "mediaStream", "safeApply", function($window, mediaStream, safeApply) { |
||||||
|
|
||||||
|
var requestAnimationFrame = $window.requestAnimationFrame; |
||||||
|
var webrtc = mediaStream.webrtc; |
||||||
|
|
||||||
|
// Consider anyting lower than this % as no audio.
|
||||||
|
var threshhold = 7; |
||||||
|
// Starting from this value we are considered talking.
|
||||||
|
var activityThreshold = 85; |
||||||
|
var activityThresholdInactivity = 40; |
||||||
|
|
||||||
|
// Talking status history map.
|
||||||
|
var talkingStatus = {}; |
||||||
|
|
||||||
|
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { |
||||||
|
|
||||||
|
$scope.talking = false; |
||||||
|
this.active = false; |
||||||
|
|
||||||
|
// Own audio level indicator.
|
||||||
|
var element = $element[0]; |
||||||
|
this.update = _.bind(function() { |
||||||
|
if (this.active) { |
||||||
|
requestAnimationFrame(this.update); |
||||||
|
} |
||||||
|
var width = 0; |
||||||
|
if (webrtc.usermedia.audioLevel) { |
||||||
|
width = Math.round(100 * webrtc.usermedia.audioLevel); |
||||||
|
// Hide low volumes.
|
||||||
|
if (width<threshhold) { |
||||||
|
width = 0; |
||||||
|
} |
||||||
|
} |
||||||
|
element.style.width = width + '%'; |
||||||
|
}, this); |
||||||
|
this.update(); |
||||||
|
|
||||||
|
// Talking state.
|
||||||
|
this.audioActivityHistory = [0,0,0,0,0,0,0,0,0,0]; |
||||||
|
this.audioActivityMeter = 0; |
||||||
|
this.audioActivityCount = 0; |
||||||
|
this.meter = _.bind(function() { |
||||||
|
var talking; |
||||||
|
if (this.active) { |
||||||
|
var level = Math.round(100 * webrtc.usermedia.audioLevel); |
||||||
|
if (level < threshhold) { |
||||||
|
level = 0; |
||||||
|
} |
||||||
|
this.audioActivityMeter = this.audioActivityMeter - this.audioActivityHistory[this.audioActivityCount] + level; |
||||||
|
this.audioActivityHistory[this.audioActivityCount] = level; |
||||||
|
this.audioActivityCount += 1; |
||||||
|
this.audioActivityCount = this.audioActivityCount % 10; |
||||||
|
//console.log("audioActivityMeter", this.audioActivityMeter, $scope.talking);
|
||||||
|
if (!$scope.talking) { |
||||||
|
talking = this.audioActivityMeter > activityThreshold ? true : false; |
||||||
|
} else { |
||||||
|
talking = this.audioActivityMeter > activityThresholdInactivity ? true : false; |
||||||
|
} |
||||||
|
} else { |
||||||
|
// Clean up.
|
||||||
|
//console.log("cleaning up");
|
||||||
|
this.audioActivityHistory = [0,0,0,0,0,0,0,0,0,0]; |
||||||
|
this.audioActivityMeter = 0; |
||||||
|
this.audioActivityCount = 0; |
||||||
|
talking = false; |
||||||
|
} |
||||||
|
if (talking !== $scope.talking) { |
||||||
|
// Apply to scope.
|
||||||
|
safeApply($scope, function() { |
||||||
|
$scope.talking = talking; |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// Check peer changes and update state for peers and keep history.
|
||||||
|
var talkingStatusNew = {}; |
||||||
|
webrtc.callForEachCall(_.bind(function(peercall) { |
||||||
|
if (peercall.peerconnection && peercall.peerconnection.datachannelReady) { |
||||||
|
var send = false; |
||||||
|
if (talking) { |
||||||
|
if (!talkingStatus[peercall.id]) { |
||||||
|
send = true; |
||||||
|
} |
||||||
|
talkingStatusNew[peercall.id]=talking; |
||||||
|
} else if (!talking && talkingStatus[peercall.id]) { |
||||||
|
send = true; |
||||||
|
} |
||||||
|
if (send) { |
||||||
|
peercall.peerconnection.send({ |
||||||
|
Type: "Talking", |
||||||
|
Talking: talking |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}, this)); |
||||||
|
talkingStatus = talkingStatusNew; |
||||||
|
|
||||||
|
}, this); |
||||||
|
this.meter(); |
||||||
|
|
||||||
|
this.meterInterval = null; |
||||||
|
this.check = function() { |
||||||
|
if ($scope.peer && !$scope.microphoneMute && !this.active) { |
||||||
|
this.active = true; |
||||||
|
//console.log("activating");
|
||||||
|
_.defer(_.bind(function() { |
||||||
|
this.meter(); |
||||||
|
this.update(); |
||||||
|
this.meterInterval = $window.setInterval(this.meter, 150); |
||||||
|
}, this)); |
||||||
|
} else if ((!$scope.peer || $scope.microphoneMute) && this.active) { |
||||||
|
this.active = false; |
||||||
|
//console.log("deactivating");
|
||||||
|
_.defer(_.bind(function() { |
||||||
|
$window.clearInterval(this.meterInterval); |
||||||
|
this.meterInterval = null; |
||||||
|
this.meter(); // Run a last time, to clean up.
|
||||||
|
}, this)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Only enable updater when actually talking.
|
||||||
|
$scope.$watch("peer", _.bind(this.check, this)); |
||||||
|
$scope.$watch("microphoneMute", _.bind(this.check, this)); |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
return { |
||||||
|
restrict: 'CE', |
||||||
|
controller: controller |
||||||
|
} |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,412 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/audiovideopeer.html', 'bigscreen', 'injectCSS', 'webrtc.adapter', 'rAF'], function($, _, template, templatePeer, BigScreen) { |
||||||
|
|
||||||
|
return ["$window", "$compile", "$filter", "mediaStream", "safeApply", "desktopNotify", "buddyData", function($window, $compile, $filter, mediaStream, safeApply, desktopNotify, buddyData) { |
||||||
|
|
||||||
|
var requestAnimationFrame = $window.requestAnimationFrame; |
||||||
|
var peerTemplate = $compile(templatePeer); |
||||||
|
|
||||||
|
var waitForVideo = function(video, stream, cb, err_cb) { |
||||||
|
var Waiter = function() { |
||||||
|
this.stop = false; |
||||||
|
this.count = 0; |
||||||
|
this.retries = 100; |
||||||
|
_.defer(_.bind(this.start, this), this); |
||||||
|
}; |
||||||
|
Waiter.prototype.start = function() { |
||||||
|
if (this.stop) { |
||||||
|
if (err_cb) { |
||||||
|
err_cb(video, stream); |
||||||
|
} |
||||||
|
return; |
||||||
|
} |
||||||
|
var videoTracks = stream.getVideoTracks(); |
||||||
|
//console.log("wait for video", videoTracks.length, video.currentTime, video)
|
||||||
|
if (videoTracks.length === 0) { |
||||||
|
cb(false, video, stream); |
||||||
|
} else if (video.currentTime > 0 && video.videoHeight > 0) { |
||||||
|
cb(true, video, stream); |
||||||
|
} else { |
||||||
|
this.count++; |
||||||
|
if (this.count < this.retries) { |
||||||
|
$window.setTimeout(_.bind(this.start, this), 100); |
||||||
|
} else { |
||||||
|
if (err_cb) { |
||||||
|
err_cb(video, stream); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
Waiter.prototype.stop = function() { |
||||||
|
this.stop = true; |
||||||
|
}; |
||||||
|
return new Waiter(); |
||||||
|
}; |
||||||
|
|
||||||
|
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { |
||||||
|
|
||||||
|
var peers = {}; |
||||||
|
var events = $({}); |
||||||
|
|
||||||
|
$scope.card = $element; |
||||||
|
$scope.container = $element.parent().get(0); |
||||||
|
$scope.layoutparent = $element.parent().parent(); |
||||||
|
|
||||||
|
$scope.remoteVideos = $element.find("#remoteVideos").get(0); |
||||||
|
$scope.localVideo = $element.find("#localVideo").get(0); |
||||||
|
$scope.miniVideo = $element.find("#miniVideo").get(0); |
||||||
|
$scope.mini = $element.find("#mini"); |
||||||
|
|
||||||
|
$scope.hasUsermedia = false; |
||||||
|
$scope.isActive = false; |
||||||
|
//console.log("audiovideo", localVideo, miniVideo);
|
||||||
|
|
||||||
|
$scope.addRemoteStream = function(stream, currentcall) { |
||||||
|
|
||||||
|
//console.log("Add remote stream to scope", pc.id, stream);
|
||||||
|
var subscope = $scope.$new(true); |
||||||
|
var peerid = subscope.peerid = currentcall.id; |
||||||
|
buddyData.push(peerid); |
||||||
|
subscope.withvideo = false; |
||||||
|
subscope.onlyaudio = false; |
||||||
|
subscope.applyTalking = function(talking) { |
||||||
|
var element = subscope.element; |
||||||
|
var has = element.hasClass("talking"); |
||||||
|
if (talking && !has) { |
||||||
|
element.addClass("talking"); |
||||||
|
} else if (!talking && has) { |
||||||
|
element.removeClass("talking"); |
||||||
|
} |
||||||
|
}; |
||||||
|
subscope.$on("active", function() { |
||||||
|
console.log("Stream scope is now active", peerid); |
||||||
|
events.triggerHandler("active."+peerid, [subscope, currentcall, stream]); |
||||||
|
}); |
||||||
|
console.log("Created stream scope", peerid); |
||||||
|
|
||||||
|
peerTemplate(subscope, function(clonedElement, scope) { |
||||||
|
$($scope.remoteVideos).append(clonedElement); |
||||||
|
scope.element = clonedElement; |
||||||
|
var video = clonedElement.find("video").get(0); |
||||||
|
$window.attachMediaStream(video, stream); |
||||||
|
// Waiter callbacks also count as connected, as browser support (FireFox 25) is not setting state changes properly.
|
||||||
|
waitForVideo(video, stream, function(withvideo) { |
||||||
|
peers[peerid] = scope; |
||||||
|
if (withvideo) { |
||||||
|
scope.$apply(function($scope) { |
||||||
|
$scope.withvideo = true; |
||||||
|
}); |
||||||
|
} else { |
||||||
|
console.info("Incoming stream has no video tracks."); |
||||||
|
scope.$apply(function($scope) { |
||||||
|
$scope.onlyaudio = true; |
||||||
|
}); |
||||||
|
} |
||||||
|
scope.$emit("active", currentcall); |
||||||
|
$scope.resize(); |
||||||
|
}, function() { |
||||||
|
peers[peerid] = scope; |
||||||
|
console.warn("We did not receive video data for remote stream", currentcall, stream, video); |
||||||
|
scope.$emit("active", currentcall); |
||||||
|
$scope.resize(); |
||||||
|
}); |
||||||
|
scope.doChat = function() { |
||||||
|
$scope.$emit("startchat", currentcall.id, {autofocus: true, restore: true}); |
||||||
|
}; |
||||||
|
}); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.removeRemoteStream = function(stream, currentcall) { |
||||||
|
|
||||||
|
var subscope = peers[currentcall.id]; |
||||||
|
if (subscope) { |
||||||
|
buddyData.pop(currentcall.id); |
||||||
|
delete peers[currentcall.id]; |
||||||
|
//console.log("remove scope", subscope);
|
||||||
|
if (subscope.element) { |
||||||
|
subscope.element.remove(); |
||||||
|
} |
||||||
|
subscope.$destroy(); |
||||||
|
$scope.resize(); |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
// Talking updates receiver.
|
||||||
|
mediaStream.api.e.on("received.talking", function(event, id, from, talking) { |
||||||
|
var scope = peers[from]; |
||||||
|
//console.log("received.talking", talking, scope);
|
||||||
|
if (scope) { |
||||||
|
scope.applyTalking(talking); |
||||||
|
} else { |
||||||
|
console.log("Received talking state without scope -> adding event.", from, talking); |
||||||
|
events.one("active."+from, function(event, scope) { |
||||||
|
console.log("Applying previously received talking state", from, talking); |
||||||
|
scope.applyTalking(talking); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("active", function(currentcall) { |
||||||
|
|
||||||
|
//console.log("active 2");
|
||||||
|
if (!$scope.isActive) { |
||||||
|
$scope.isActive = true; |
||||||
|
$scope.remoteVideos.style.opacity = 1; |
||||||
|
$scope.card.addClass("active"); |
||||||
|
//console.log("active 3");
|
||||||
|
_.delay(function() { |
||||||
|
$scope.localVideo.style.opacity = 0; |
||||||
|
$scope.localVideo.src = ""; |
||||||
|
}, 500); |
||||||
|
_.delay(function() { |
||||||
|
//console.log("active 4", $scope.mini);
|
||||||
|
$scope.mini.addClass("visible"); //.style.opacity = 1;
|
||||||
|
}, 1000); |
||||||
|
} |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
$scope.toggleFullscreen = function() { |
||||||
|
if (BigScreen.enabled && ($scope.isActive || $scope.hasUsermedia)) { |
||||||
|
$scope.layoutparent.toggleClass("fullscreen"); |
||||||
|
BigScreen.toggle($scope.layoutparent.get(0)); |
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("usermedia", function(event, usermedia) { |
||||||
|
|
||||||
|
//console.log("XXXXXXXXXXXXXXXXXXXXXXXXX usermedia event", usermedia);
|
||||||
|
$scope.hasUsermedia = true; |
||||||
|
usermedia.attachMediaStream($scope.localVideo); |
||||||
|
var count = 0; |
||||||
|
var waitForLocalVideo = function() { |
||||||
|
if (!$scope.hasUsermedia) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if ($scope.localVideo.videoWidth > 0) { |
||||||
|
$scope.localVideo.style.opacity = 1; |
||||||
|
$scope.resize(); |
||||||
|
} else { |
||||||
|
count++; |
||||||
|
if (count < 100) { |
||||||
|
setTimeout(waitForLocalVideo, 100); |
||||||
|
} else { |
||||||
|
console.warn("Timeout while waiting for local video.") |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
waitForLocalVideo(); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("done", function() { |
||||||
|
|
||||||
|
$scope.hasUsermedia = false; |
||||||
|
$scope.isActive = false; |
||||||
|
if (BigScreen.enabled) { |
||||||
|
BigScreen.exit(); |
||||||
|
} |
||||||
|
_.delay(function() { |
||||||
|
if ($scope.isActive) { |
||||||
|
return; |
||||||
|
} |
||||||
|
$scope.localVideo.src = ''; |
||||||
|
$scope.miniVideo.src = ''; |
||||||
|
$($scope.remoteVideos).empty(); |
||||||
|
}, 1500); |
||||||
|
$scope.mini.removeClass("visible"); |
||||||
|
$scope.localVideo.style.opacity = 0; |
||||||
|
$scope.remoteVideos.style.opacity = 0; |
||||||
|
$scope.card.removeClass('active'); |
||||||
|
_.each(peers, function(scope, k) { |
||||||
|
scope.$destroy(); |
||||||
|
delete peers[k]; |
||||||
|
}); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("streamadded", function(event, stream, currentcall) { |
||||||
|
|
||||||
|
console.log("Remote stream added.", stream, currentcall); |
||||||
|
if (_.isEmpty(peers)) { |
||||||
|
//console.log("First stream");
|
||||||
|
$window.reattachMediaStream($scope.miniVideo, $scope.localVideo); |
||||||
|
} |
||||||
|
$scope.addRemoteStream(stream, currentcall); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.webrtc.e.on("streamremoved", function(event, stream, currentcall) { |
||||||
|
|
||||||
|
console.log("Remote stream removed.", stream, currentcall); |
||||||
|
$scope.removeRemoteStream(stream, currentcall); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
return { |
||||||
|
peers: peers |
||||||
|
}; |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
var compile = function(tElement, tAttr) { |
||||||
|
|
||||||
|
return function(scope, iElement, iAttrs, controller) { |
||||||
|
|
||||||
|
//console.log("compile", arguments)
|
||||||
|
|
||||||
|
$(scope.card).on("doubletap", function() { |
||||||
|
scope.toggleFullscreen(); |
||||||
|
}); |
||||||
|
|
||||||
|
var needsResize = false; |
||||||
|
scope.resize = function() { |
||||||
|
needsResize = true; |
||||||
|
}; |
||||||
|
|
||||||
|
var resize = function() { |
||||||
|
|
||||||
|
var videos = _.keys(controller.peers); |
||||||
|
|
||||||
|
var videoWidth; |
||||||
|
var videoHeight; |
||||||
|
|
||||||
|
if (videos.length) { |
||||||
|
if (videos.length === 1) { |
||||||
|
var remoteVideo = controller.peers[videos[0]].element.find("video").get(0); |
||||||
|
videoWidth = remoteVideo.videoWidth; |
||||||
|
videoHeight = remoteVideo.videoHeight; |
||||||
|
console.log("Remote video size: ", videoWidth, videoHeight); |
||||||
|
} else { |
||||||
|
videoWidth = 1920; |
||||||
|
videoHeight = 1080; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!videoWidth) { |
||||||
|
if (scope.localVideo.style.opacity === '1') { |
||||||
|
videoWidth = scope.localVideo.videoWidth; |
||||||
|
videoHeight = scope.localVideo.videoHeight; |
||||||
|
console.log("Local video size: ", videoWidth, videoHeight); |
||||||
|
videos = [null]; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (!videos.length) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
if (!videoWidth) { |
||||||
|
videoWidth = 640; |
||||||
|
} |
||||||
|
if (!videoHeight) { |
||||||
|
videoHeight = 360; |
||||||
|
} |
||||||
|
|
||||||
|
var aspectRatio = videoWidth/videoHeight; |
||||||
|
var innerHeight = scope.layoutparent.height(); |
||||||
|
var innerWidth = scope.layoutparent.width(); |
||||||
|
var container = scope.container; |
||||||
|
|
||||||
|
//console.log("resize", innerHeight, innerWidth);
|
||||||
|
//console.log("resize", container, videos.length, aspectRatio, innerHeight, innerWidth);
|
||||||
|
|
||||||
|
if (videos.length === 1) { |
||||||
|
var newVideoWidth = innerWidth < aspectRatio * innerHeight ? innerWidth : aspectRatio * innerHeight; |
||||||
|
var newVideoHeight = innerHeight < innerWidth / aspectRatio ? innerHeight : innerWidth / aspectRatio; |
||||||
|
container.style.width = newVideoWidth + 'px'; |
||||||
|
container.style.height = newVideoHeight + 'px'; |
||||||
|
container.style.left = ((innerWidth - newVideoWidth) / 2) + 'px'; |
||||||
|
var extraCSS = {}; |
||||||
|
} else { |
||||||
|
var space = innerHeight*innerWidth; // square pixels
|
||||||
|
var videoSpace = space/videos.length; |
||||||
|
var singleVideoWidthOptimal = Math.pow(videoSpace * aspectRatio, 0.5); |
||||||
|
var videosPerRow = Math.ceil(innerWidth/singleVideoWidthOptimal) |
||||||
|
var singleVideoWidth = Math.ceil(innerWidth/videosPerRow); |
||||||
|
var singleVideoHeight = Math.ceil(singleVideoWidth/aspectRatio); |
||||||
|
var newContainerWidth = (videosPerRow*singleVideoWidth); |
||||||
|
var newContainerHeight = Math.ceil(videos.length/videosPerRow)*singleVideoHeight; |
||||||
|
if (newContainerHeight*1.3 <= innerHeight) { |
||||||
|
newContainerHeight = newContainerHeight*1.3; |
||||||
|
} |
||||||
|
/* |
||||||
|
console.log("space", space); |
||||||
|
console.log("videospace", videoSpace); |
||||||
|
console.log("singleVideoWidthOptimal", singleVideoWidthOptimal); |
||||||
|
console.log("videosPerRow", videosPerRow); |
||||||
|
console.log("singleVideoWidth", singleVideoWidth); |
||||||
|
console.log("singleVideoHeight", singleVideoHeight); |
||||||
|
*/ |
||||||
|
container.style.width = newContainerWidth + "px"; |
||||||
|
container.style.height = newContainerHeight + "px"; |
||||||
|
container.style.left = ((innerWidth - newContainerWidth) / 2) + 'px'; |
||||||
|
extraCSS = { |
||||||
|
"#remoteVideos": { |
||||||
|
">div": { |
||||||
|
width: singleVideoWidth+"px", |
||||||
|
height: singleVideoHeight+"px" |
||||||
|
} |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
$.injectCSS(extraCSS, { |
||||||
|
truncateFirst: true, |
||||||
|
containerName: "audiovideo-dynamic" |
||||||
|
}); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
$($window).on("resize", scope.resize); |
||||||
|
scope.$on("mainresize", function() { |
||||||
|
console.log("mainResize called"); |
||||||
|
_.defer(scope.resize); |
||||||
|
}); |
||||||
|
scope.resize(); |
||||||
|
|
||||||
|
var update = function() { |
||||||
|
if (needsResize) { |
||||||
|
needsResize =false; |
||||||
|
resize(); |
||||||
|
} |
||||||
|
requestAnimationFrame(update); |
||||||
|
} |
||||||
|
update(); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
restrict: 'E', |
||||||
|
replace: true, |
||||||
|
scope: true, |
||||||
|
template: template, |
||||||
|
controller: controller, |
||||||
|
compile: compile |
||||||
|
} |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,104 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define(['underscore', 'text!partials/buddylist.html'], function(_, template) { |
||||||
|
|
||||||
|
// buddyList
|
||||||
|
return ["$compile", "buddyList", "mediaStream", function($compile, buddyList, mediaStream) { |
||||||
|
|
||||||
|
//console.log("buddyList directive");
|
||||||
|
|
||||||
|
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { |
||||||
|
|
||||||
|
//console.log("BuddylistController", $buddylist, $element, $scope);
|
||||||
|
|
||||||
|
$scope.doCall = function(id) { |
||||||
|
|
||||||
|
mediaStream.webrtc.doCall(id); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.doChat = function(id) { |
||||||
|
|
||||||
|
//console.log("doChat", id);
|
||||||
|
$scope.$emit("startchat", id, {autofocus: true, restore: true}); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.doAudioConference = function(id) { |
||||||
|
|
||||||
|
$scope.updateAutoAccept(id); |
||||||
|
mediaStream.api.sendChat(id, null, {type: "conference", id: mediaStream.connector.roomid}) |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
window.doAudioConference = $scope.doAudioConference; |
||||||
|
|
||||||
|
var buddylist = $scope.buddylist = buddyList.buddylist($element, $scope, {}); |
||||||
|
var onJoined = _.bind(buddylist.onJoined, buddylist); |
||||||
|
var onLeft = _.bind(buddylist.onLeft, buddylist); |
||||||
|
var onStatus = _.bind(buddylist.onStatus, buddylist); |
||||||
|
mediaStream.api.e.on("received.userleftorjoined", function(event, dataType, data) { |
||||||
|
if (dataType === "Left") { |
||||||
|
onLeft(data); |
||||||
|
} else { |
||||||
|
onJoined(data); |
||||||
|
} |
||||||
|
}); |
||||||
|
mediaStream.api.e.on("received.users", function(event, data) { |
||||||
|
var selfId = $scope.id; |
||||||
|
_.each(data, function(p) { |
||||||
|
if (p.Id !== selfId) { |
||||||
|
onJoined(p); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
mediaStream.api.e.on("received.status", function(event, data) { |
||||||
|
onStatus(data); |
||||||
|
}); |
||||||
|
mediaStream.connector.e.on("closed error", function() { |
||||||
|
buddylist.onClosed(); |
||||||
|
}); |
||||||
|
|
||||||
|
// Request user list whenever the connection comes ready.
|
||||||
|
mediaStream.connector.ready(function() { |
||||||
|
mediaStream.api.requestUsers(); |
||||||
|
}); |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
var link = function(scope, iElement, iAttrs, controller) { |
||||||
|
|
||||||
|
//console.log("buddyList directive link", arguments);
|
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
restrict: 'E', |
||||||
|
replace: true, |
||||||
|
scope: true, |
||||||
|
template: template, |
||||||
|
controller: controller, |
||||||
|
link: link |
||||||
|
} |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,331 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define(['underscore', 'text!partials/chat.html', 'text!partials/chatroom.html'], function(_, templateChat, templateChatroom) { |
||||||
|
|
||||||
|
return ["$compile", "safeDisplayName", "mediaStream", "safeApply", "desktopNotify", "translation", "playSound", "fileUpload", "randomGen", "buddyData", function($compile, safeDisplayName, mediaStream, safeApply, desktopNotify, translation, playSound, fileUpload, randomGen, buddyData) { |
||||||
|
|
||||||
|
var displayName = safeDisplayName; |
||||||
|
var group_chat_id = ""; |
||||||
|
|
||||||
|
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { |
||||||
|
|
||||||
|
var rooms = {}; |
||||||
|
|
||||||
|
mediaStream.api.e.on("received.chat", function(event, id, from, data, p2p) { |
||||||
|
|
||||||
|
//console.log("received", data, id, from);
|
||||||
|
|
||||||
|
var with_message = !!data.Message; |
||||||
|
|
||||||
|
if (!with_message && !rooms[from] && !rooms[id]) { |
||||||
|
// Ignore empty messages for non existing rooms.
|
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
var room = rooms[id]; |
||||||
|
if (!room) { |
||||||
|
// No room with this id, get one with the from id
|
||||||
|
$scope.$emit("startchat", from, {restore: with_message}); |
||||||
|
room = rooms[from]; |
||||||
|
} |
||||||
|
|
||||||
|
if (with_message && from !== $scope.$parent.id) { |
||||||
|
room.newmessage = true; |
||||||
|
room.peerIsTyping = "no"; |
||||||
|
room.p2p(!!p2p); |
||||||
|
} |
||||||
|
//console.log("room", room);
|
||||||
|
|
||||||
|
room.$broadcast("received", from, data); |
||||||
|
safeApply(room); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
mediaStream.api.e.on("received.userleftorjoined", function(event, dataType, data) { |
||||||
|
var room = rooms[data.Id]; |
||||||
|
if (room) { |
||||||
|
switch (dataType) { |
||||||
|
case "Left": |
||||||
|
if (data.Status !== "soft") { |
||||||
|
room.enabled = false; |
||||||
|
room.$broadcast("received", data.Id, {Type: "LeftOrJoined", "LeftOrJoined": "left"}); |
||||||
|
safeApply(room); |
||||||
|
} |
||||||
|
break; |
||||||
|
case "Joined": |
||||||
|
if (!room.enabled) { |
||||||
|
room.enabled = true; |
||||||
|
_.delay(function() { |
||||||
|
room.$broadcast("received", data.Id, {Type: "LeftOrJoined", "LeftOrJoined": "joined"}); |
||||||
|
safeApply(room); |
||||||
|
}, 1000); |
||||||
|
} |
||||||
|
break; |
||||||
|
default: |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$parent.$on("startchat", function(event, id, options) { |
||||||
|
|
||||||
|
//console.log("startchat requested", event, id);
|
||||||
|
$scope.showRoom(id, {title: translation._("Chat with")}, options); |
||||||
|
|
||||||
|
}); |
||||||
|
|
||||||
|
// Shared data;
|
||||||
|
return { |
||||||
|
rooms: rooms, |
||||||
|
visibleRooms: [] |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
var compile = function(tElement, tAttrs) { |
||||||
|
|
||||||
|
var chat = $compile(templateChatroom); |
||||||
|
return function(scope, iElement, iAttrs, controller) { |
||||||
|
scope.showRoom = function(id, settings, options) { |
||||||
|
var options = $.extend({}, options); |
||||||
|
var subscope = controller.rooms[id]; |
||||||
|
var index = controller.visibleRooms.length; |
||||||
|
if (!subscope) { |
||||||
|
console.log("Create new chatroom", id); |
||||||
|
controller.visibleRooms.push(id); |
||||||
|
subscope = controller.rooms[id] = scope.$new(true); |
||||||
|
translation.inject(subscope); |
||||||
|
subscope.id = id; |
||||||
|
subscope.isgroupchat = id === group_chat_id ? true : false; |
||||||
|
subscope.index = index; |
||||||
|
subscope.settings = settings; |
||||||
|
subscope.visible = false; |
||||||
|
subscope.newmessage = false; |
||||||
|
subscope.enabled = true; |
||||||
|
subscope.peerIsTyping = "no"; |
||||||
|
subscope.minimized = id === group_chat_id ? true : false; |
||||||
|
subscope.maximized = false; |
||||||
|
subscope.firstmessage = true; |
||||||
|
subscope.p2pstate = false; |
||||||
|
if (!subscope.isgroupchat) { |
||||||
|
buddyData.push(id); |
||||||
|
} |
||||||
|
subscope.hide = function() { |
||||||
|
scope.hideRoom(id); |
||||||
|
}; |
||||||
|
//TODO(longsleep): This is currently never called. Find a suitable way to clean up old chats.
|
||||||
|
subscope.kill = function() { |
||||||
|
if (!subscope.isgroupchat) { |
||||||
|
buddyData.pop(id); |
||||||
|
} |
||||||
|
scope.killRoom(id); |
||||||
|
}; |
||||||
|
subscope.toggleMin = function() { |
||||||
|
subscope.maximized = false; |
||||||
|
if (subscope.minimized) { |
||||||
|
subscope.minimized = false; |
||||||
|
} else { |
||||||
|
subscope.minimized = true; |
||||||
|
subscope.firstmessage = true; |
||||||
|
} |
||||||
|
}; |
||||||
|
subscope.toggleMax = function() { |
||||||
|
subscope.minimized = false; |
||||||
|
if (subscope.maximized) { |
||||||
|
subscope.maximized = false; |
||||||
|
} else { |
||||||
|
subscope.maximized = true; |
||||||
|
} |
||||||
|
}; |
||||||
|
subscope.seen = function() { |
||||||
|
if (subscope.newmessage) { |
||||||
|
subscope.newmessage = false; |
||||||
|
subscope.$broadcast("seen"); |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
subscope.sendChat = function(to, message, status, mid, noloop) { |
||||||
|
//console.log("send chat", to, scope.peer);
|
||||||
|
var peercall = mediaStream.webrtc.findTargetCall(to); |
||||||
|
if (message && !mid) { |
||||||
|
mid = randomGen.random({hex: true}); |
||||||
|
}; |
||||||
|
if (peercall && peercall.peerconnection.datachannelReady) { |
||||||
|
subscope.p2p(true); |
||||||
|
// Send out stuff through data channel.
|
||||||
|
mediaStream.api.apply("sendChat", { |
||||||
|
send: function(type, data) { |
||||||
|
// We also send to self, to display our own stuff.
|
||||||
|
if (!noloop) { |
||||||
|
mediaStream.api.received({Type: data.Type, Data: data, From: mediaStream.api.id, To: peercall.id}); |
||||||
|
} |
||||||
|
return peercall.peerconnection.send(data); |
||||||
|
} |
||||||
|
})(to, message, status, mid); |
||||||
|
|
||||||
|
} else { |
||||||
|
subscope.p2p(false); |
||||||
|
mediaStream.api.send2("sendChat", function(type, data) { |
||||||
|
if (!noloop) { |
||||||
|
//console.log("looped to self", type, data);
|
||||||
|
mediaStream.api.received({Type: data.Type, Data: data, From: mediaStream.api.id, To: to}); |
||||||
|
} |
||||||
|
})(to, message, status, mid); |
||||||
|
} |
||||||
|
return mid; |
||||||
|
}; |
||||||
|
subscope.p2p = function(state) { |
||||||
|
if (state !== subscope.p2pstate) { |
||||||
|
subscope.p2pstate = state; |
||||||
|
subscope.$broadcast("p2p", state); |
||||||
|
} |
||||||
|
}; |
||||||
|
//console.log("Creating new chat room", controller, subscope, index);
|
||||||
|
subscope.$on("submit", function(event, input) { |
||||||
|
subscope.seen(); |
||||||
|
var mid = subscope.sendChat(event.targetScope.id, input); |
||||||
|
event.targetScope.$broadcast("received", null, {Type: "Message", Status: {State: "sent", "Mid": mid}}); |
||||||
|
}); |
||||||
|
subscope.$on("submitseen", function(event, pending) { |
||||||
|
//console.log("submitseen", pending);
|
||||||
|
subscope.sendChat(event.targetScope.id, null, {SeenMids: pending}, null, true); |
||||||
|
}); |
||||||
|
subscope.$on("submitreceived", function(event, mid) { |
||||||
|
subscope.sendChat(event.targetScope.id, null, {State: "delivered", Mid: mid}, null, true); |
||||||
|
}); |
||||||
|
subscope.$on("typing", function(event, params) { |
||||||
|
if (params.who === "local") { |
||||||
|
var room = event.targetScope.id; |
||||||
|
subscope.seen(); |
||||||
|
//console.log("typing event", params.status);
|
||||||
|
if (!subscope.isgroupchat) { |
||||||
|
// Transmit typing events to private chats.
|
||||||
|
subscope.sendChat(event.targetScope.id, null, {Typing: params.status}); |
||||||
|
} |
||||||
|
} else { |
||||||
|
subscope.peerIsTyping = params.status; |
||||||
|
//console.log("peer typing event", params.status, subscope.peerIsTyping);
|
||||||
|
} |
||||||
|
safeApply(subscope); |
||||||
|
}); |
||||||
|
subscope.$on("incoming", function(event, message, from, userid) { |
||||||
|
if (subscope.firstmessage || !desktopNotify.windowHasFocus) { |
||||||
|
var room = event.targetScope.id; |
||||||
|
// Make sure we are not in group chat or the message is from ourselves
|
||||||
|
// before we beep and shout.
|
||||||
|
if (!subscope.isgroupchat && from !== userid) { |
||||||
|
playSound.play("message1"); |
||||||
|
desktopNotify.notify(translation._("Message from ")+displayName(from), message); |
||||||
|
} |
||||||
|
subscope.firstmessage = false; |
||||||
|
} |
||||||
|
}); |
||||||
|
chat(subscope, function(clonedElement, $scope) { |
||||||
|
|
||||||
|
iElement.append(clonedElement); |
||||||
|
$scope.element=clonedElement; |
||||||
|
$scope.visible = true; |
||||||
|
if (options.autofocus) { |
||||||
|
_.defer(function() { |
||||||
|
$scope.$broadcast("focus"); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
// Support drag and drop file uploads in Chat.
|
||||||
|
var namespace = "file_"+scope.id; |
||||||
|
var binder = fileUpload.bindDrop(namespace, clonedElement, _.bind(function(files) { |
||||||
|
console.log("File dragged", files); |
||||||
|
_.each(files, _.bind(function(f) { |
||||||
|
var info = $.extend({id: f.id}, f.info); |
||||||
|
console.log("Advertising file", f, info); |
||||||
|
$scope.sendChat(subscope.id, "File", {FileInfo: info}); |
||||||
|
}, this)); |
||||||
|
}, this)); |
||||||
|
binder.namespace = function() { |
||||||
|
// Inject own id into namespace.
|
||||||
|
return namespace+"_"+scope.myid; |
||||||
|
}; |
||||||
|
|
||||||
|
}); |
||||||
|
} else { |
||||||
|
if (options.restore) { |
||||||
|
if (!subscope.visible) { |
||||||
|
controller.visibleRooms.push(id); |
||||||
|
subscope.index = index; |
||||||
|
subscope.visible = true; |
||||||
|
subscope.minimized = false; |
||||||
|
} |
||||||
|
} |
||||||
|
if (options.autofocus && subscope.visible) { |
||||||
|
subscope.$broadcast("focus"); |
||||||
|
subscope.minimized = false; |
||||||
|
} |
||||||
|
} |
||||||
|
safeApply(subscope); |
||||||
|
return subscope; |
||||||
|
}; |
||||||
|
scope.hideRoom = function(id) { |
||||||
|
var subscope = controller.rooms[id]; |
||||||
|
if (!subscope) { |
||||||
|
console.log("hideRoom called for unknown room", id); |
||||||
|
return; |
||||||
|
} |
||||||
|
var element = subscope.element; |
||||||
|
var index = subscope.index; |
||||||
|
controller.visibleRooms.splice(index, 1); |
||||||
|
subscope.visible=false; |
||||||
|
subscope.maximized=false; |
||||||
|
subscope.firstmessage=true; |
||||||
|
// Refresh index of the rest of the rooms.
|
||||||
|
_.each(controller.visibleRooms, function(id, idx) { |
||||||
|
var s = controller.rooms[id]; |
||||||
|
//console.log("updated idx", idx, s.index);
|
||||||
|
s.index = idx; |
||||||
|
}); |
||||||
|
}; |
||||||
|
scope.killRoom = function(id) { |
||||||
|
scope.hideRoom(id); |
||||||
|
var subscope = controller.rooms[id]; |
||||||
|
if (!subscope) { |
||||||
|
return; |
||||||
|
} |
||||||
|
delete controller.rooms[id]; |
||||||
|
subscope.$destroy(); |
||||||
|
}; |
||||||
|
// Show default room.
|
||||||
|
scope.showRoom(group_chat_id, {title: translation._("Group chat")}); |
||||||
|
}; |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
restrict: 'E', |
||||||
|
replace: true, |
||||||
|
scope: true, |
||||||
|
template: templateChat, |
||||||
|
controller: controller, |
||||||
|
compile: compile |
||||||
|
} |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,63 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define([ |
||||||
|
'underscore', |
||||||
|
|
||||||
|
'directives/onenter', |
||||||
|
'directives/onescape', |
||||||
|
'directives/statusmessage', |
||||||
|
'directives/buddylist', |
||||||
|
'directives/settings', |
||||||
|
'directives/chat', |
||||||
|
'directives/audiovideo', |
||||||
|
'directives/usability', |
||||||
|
'directives/audiolevel', |
||||||
|
'directives/fileinfo', |
||||||
|
'directives/screenshare', |
||||||
|
'directives/roombar' |
||||||
|
], function(_, onEnter, onEscape, statusMessage, buddyList, settings, chat, audioVideo, usability, audioLevel, fileInfo, screenshare, roomBar) { |
||||||
|
|
||||||
|
var directives = { |
||||||
|
onEnter: onEnter, |
||||||
|
onEscape: onEscape, |
||||||
|
statusMessage: statusMessage, |
||||||
|
buddyList: buddyList, |
||||||
|
settings: settings, |
||||||
|
chat: chat, |
||||||
|
audioVideo: audioVideo, |
||||||
|
usability: usability, |
||||||
|
audioLevel: audioLevel, |
||||||
|
fileInfo: fileInfo, |
||||||
|
screenshare: screenshare, |
||||||
|
roomBar: roomBar |
||||||
|
}; |
||||||
|
|
||||||
|
var initialize = function (angModule) { |
||||||
|
_.each(directives, function(directive, name) { |
||||||
|
angModule.directive(name, directive); |
||||||
|
}) |
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
initialize: initialize |
||||||
|
}; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,250 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define(['jquery', 'underscore'], function($, _) { |
||||||
|
|
||||||
|
return ["fileData", "fileUpload", "fileDownload", "mediaStream", "$window", "alertify", "translation", function(fileData, fileUpload, fileDownload, mediaStream, $window, alertify, translation) { |
||||||
|
|
||||||
|
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) { |
||||||
|
|
||||||
|
var ctrl = this; |
||||||
|
|
||||||
|
console.log("file-info", $scope, $element); |
||||||
|
$scope.complete = false; |
||||||
|
$scope.downloader = false; |
||||||
|
$scope.downloadcomplete = false; |
||||||
|
$scope.downloading = false; |
||||||
|
$scope.downloadspeed = false; |
||||||
|
$scope.uploading = false; |
||||||
|
$scope.uploader = false; |
||||||
|
$scope.cancelled = false; |
||||||
|
$scope.error = false; |
||||||
|
$scope.progress = 0; |
||||||
|
$scope.progressDownload = 0; |
||||||
|
$scope.bytesPerSecond = 0; |
||||||
|
$scope.eta = ""; |
||||||
|
$scope.url = null; |
||||||
|
|
||||||
|
var progressBars = $element.find(".file-info-size > div"); |
||||||
|
var progressBar = progressBars[0]; |
||||||
|
var progressBarDownload = progressBars[1]; |
||||||
|
$scope.$watch("progress", function() { |
||||||
|
progressBar.style.width=($scope.progress)+"%"; |
||||||
|
}); |
||||||
|
$scope.$watch("progressDownload", function() { |
||||||
|
progressBarDownload.style.width=($scope.progressDownload)+"%"; |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$watch("error", function() { |
||||||
|
// TODO(longsleep): Show some feedback?
|
||||||
|
}); |
||||||
|
|
||||||
|
var chunk = 0; |
||||||
|
var handler = null; |
||||||
|
var token = $scope.info.id; |
||||||
|
var bytesIn = []; |
||||||
|
var bytesPerSecond = []; |
||||||
|
var bytesPerSecondInterval = null; |
||||||
|
|
||||||
|
ctrl.bytesPerSecond = function() { |
||||||
|
if ($scope.downloadcomplete || $scope.cancelled || $scope.error) { |
||||||
|
$window.clearInterval(bytesPerSecondInterval); |
||||||
|
$scope.$apply(function(scope) { |
||||||
|
$scope.downloadspeed = false; |
||||||
|
$scope.eta = ""; |
||||||
|
}); |
||||||
|
return; |
||||||
|
} |
||||||
|
var bpsIn = 0; |
||||||
|
if (bytesIn.length) { |
||||||
|
bpsIn = _.reduce(bytesIn, function(memo, num) { |
||||||
|
return memo + num; |
||||||
|
}, 0); |
||||||
|
bytesIn = []; |
||||||
|
} |
||||||
|
bytesPerSecond.push(bpsIn); |
||||||
|
if (bytesPerSecond.length > 3) { |
||||||
|
bytesPerSecond.shift(); |
||||||
|
} |
||||||
|
|
||||||
|
// Compute left bytes for eta.
|
||||||
|
var bytesLeft = $scope.info.size - ($scope.info.size * ($scope.progress/100)); |
||||||
|
|
||||||
|
$scope.$apply(function(scope) { |
||||||
|
scope.bytesPerSecond = _.reduce(bytesPerSecond, function(memo, num) { |
||||||
|
return memo + num; |
||||||
|
}, 0) / bytesPerSecond.length; |
||||||
|
if (scope.downloader && (scope.bytesPerSecond || scope.eta)) { |
||||||
|
if (scope.bytesPerSecond > 0) { |
||||||
|
var etaSeconds = bytesLeft / scope.bytesPerSecond; |
||||||
|
scope.eta = moment.duration(etaSeconds, "seconds").humanize(); |
||||||
|
} else { |
||||||
|
scope.eta = ""; |
||||||
|
} |
||||||
|
} |
||||||
|
if (!scope.downloadspeed && scope.bytesPerSecond > 0) { |
||||||
|
scope.downloadspeed = true; |
||||||
|
} else if (!scope.downloader && scope.bytesPerSecond === 0) { |
||||||
|
scope.downloadspeed = false; |
||||||
|
} |
||||||
|
}); |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.reset = function() { |
||||||
|
chunk = 0; |
||||||
|
bytesIn = []; |
||||||
|
bytesPerSecond = []; |
||||||
|
$window.clearInterval(bytesPerSecondInterval); |
||||||
|
bytesPerSecondInterval = null; |
||||||
|
$scope.complete = false; |
||||||
|
$scope.downloading = false; |
||||||
|
$scope.downloadcomplete = false; |
||||||
|
$scope.downloadspeed = false; |
||||||
|
$scope.progress = 0; |
||||||
|
$scope.progressDownload = 0; |
||||||
|
$scope.bytesPerSecond = 0; |
||||||
|
$scope.eta = ""; |
||||||
|
$scope.error = false; |
||||||
|
$scope.url = null; |
||||||
|
}; |
||||||
|
|
||||||
|
$scope.download = function() { |
||||||
|
|
||||||
|
if (!fileDownload.supported) { |
||||||
|
alertify.dialog.alert(translation._("Your browser does not support file transfer.")); |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
if ($scope.error && $scope.downloading) { |
||||||
|
// Crude retry support.
|
||||||
|
$scope.reset(); |
||||||
|
} |
||||||
|
|
||||||
|
console.log("Download", $scope.info, $scope); |
||||||
|
if (!$scope.complete && !$scope.downloading) { |
||||||
|
$scope.downloading = true; |
||||||
|
$scope.cancelled = false; |
||||||
|
bytesPerSecondInterval = $window.setInterval(ctrl.bytesPerSecond, 1000); |
||||||
|
$scope.$emit("download", $scope.from, $scope.info.id); |
||||||
|
} else { |
||||||
|
if ($scope.url) { |
||||||
|
$window.open($scope.url, "_blank"); |
||||||
|
} else { |
||||||
|
console.error("Download of already completed files not implemented yet."); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.cancel = function() { |
||||||
|
|
||||||
|
console.log("Download cancel", $scope.downloading, $scope); |
||||||
|
$scope.cancelled = true; |
||||||
|
if ($scope.downloading) { |
||||||
|
$scope.$emit("cancelDownload"); |
||||||
|
} |
||||||
|
if ($scope.uploader) { |
||||||
|
console.log("Removing upload handler"); |
||||||
|
if (handler) { |
||||||
|
mediaStream.tokens.off(token, handler); |
||||||
|
$scope.uploader = false; |
||||||
|
} |
||||||
|
$scope.$emit("cancelUpload"); |
||||||
|
} |
||||||
|
$scope.reset(); |
||||||
|
|
||||||
|
}; |
||||||
|
|
||||||
|
$scope.$on("downloadedWritten", function(event, written, queue) { |
||||||
|
event.stopPropagation(); |
||||||
|
if ($scope.cancelled) { |
||||||
|
return; |
||||||
|
} |
||||||
|
$scope.progress = Math.ceil((written / ($scope.info.chunks-1)) * 100); |
||||||
|
if (written >= $scope.info.chunks-1) { |
||||||
|
$scope.progress = 100; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("downloadedChunk", function(event, idx, bytesLength) { |
||||||
|
event.stopPropagation(); |
||||||
|
if ($scope.cancelled) { |
||||||
|
return; |
||||||
|
} |
||||||
|
bytesIn.push(bytesLength); |
||||||
|
$scope.progressDownload = Math.ceil((chunk / ($scope.info.chunks-1)) * 100); |
||||||
|
chunk++; |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("writeComplete", function(event, url) { |
||||||
|
event.stopPropagation(); |
||||||
|
$scope.complete = true; |
||||||
|
$scope.url = url; |
||||||
|
$scope.progress = 100; |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("downloadComplete", function(event) { |
||||||
|
event.stopPropagation(); |
||||||
|
$scope.downloadcomplete = true; |
||||||
|
$scope.progressDownload = 100; |
||||||
|
}); |
||||||
|
|
||||||
|
$scope.$on("uploadedChunk", function(event, idx, bytesLength) { |
||||||
|
event.stopPropagation(); |
||||||
|
//console.log("Uploaded chunk", idx, bytesLength);
|
||||||
|
if ($scope.cancelled) { |
||||||
|
return; |
||||||
|
} |
||||||
|
bytesIn.push(bytesLength); |
||||||
|
}); |
||||||
|
|
||||||
|
// Register as token handler when we are sending.
|
||||||
|
var file = fileData.getFile($scope.info.id); |
||||||
|
if (file) { |
||||||
|
$scope.uploader = true; |
||||||
|
console.log("File-info has file on create", file); |
||||||
|
var session = fileUpload.startUpload($scope, $scope.info.id); |
||||||
|
// This binds the token to transfer and ui.
|
||||||
|
handler = mediaStream.tokens.on(token, function(event, currenttoken, to, data, type, to2, from, xfer) { |
||||||
|
//console.log("File token request", currenttoken, data, type);
|
||||||
|
session.handleRequest($scope, xfer, data); |
||||||
|
}, "xfer"); |
||||||
|
bytesPerSecondInterval = $window.setInterval(ctrl.bytesPerSecond, 1000); |
||||||
|
} else { |
||||||
|
$scope.downloader = true; |
||||||
|
// This binds the token to transfer and ui.
|
||||||
|
handler = mediaStream.tokens.on(token, function(event, currenttoken, to, data, type, to2, from, xfer) { |
||||||
|
//console.log("File token request", currenttoken, data, type);
|
||||||
|
fileDownload.handleRequest($scope, xfer, data); |
||||||
|
}, "xfer"); |
||||||
|
} |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
return { |
||||||
|
scope: true, |
||||||
|
restrict: 'EAC', |
||||||
|
controller: controller, |
||||||
|
replace: false |
||||||
|
} |
||||||
|
|
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,41 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define([], function() { |
||||||
|
|
||||||
|
// onEnter
|
||||||
|
return [function() { |
||||||
|
return { |
||||||
|
restrict: "A", |
||||||
|
link: function(scope, element, attrs) { |
||||||
|
var c = attrs.onEnter; |
||||||
|
element.bind("keydown keypress", function(event) { |
||||||
|
if (event.which === 13 && !event.shiftKey && !event.ctrlKey) { |
||||||
|
// On enter whithout shift or ctrl.
|
||||||
|
event.preventDefault(); |
||||||
|
scope.$eval(c); |
||||||
|
scope.$apply(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
@ -0,0 +1,41 @@ |
|||||||
|
/* |
||||||
|
* Spreed Speak Freely. |
||||||
|
* Copyright (C) 2013-2014 struktur AG |
||||||
|
* |
||||||
|
* This file is part of Spreed Speak Freely. |
||||||
|
* |
||||||
|
* This program is free software: you can redistribute it and/or modify |
||||||
|
* it under the terms of the GNU Affero General Public License as published by |
||||||
|
* the Free Software Foundation, either version 3 of the License, or |
||||||
|
* (at your option) any later version. |
||||||
|
* |
||||||
|
* This program is distributed in the hope that it will be useful, |
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
* GNU Affero General Public License for more details. |
||||||
|
* |
||||||
|
* You should have received a copy of the GNU Affero General Public License |
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* |
||||||
|
*/ |
||||||
|
define([], function() { |
||||||
|
|
||||||
|
// onEscape
|
||||||
|
return [function() { |
||||||
|
return { |
||||||
|
restrict: "A", |
||||||
|
link: function(scope, element, attrs) { |
||||||
|
var c = attrs.onEscape; |
||||||
|
element.bind("keydown keypress", function(event) { |
||||||
|
if (event.which === 27) { |
||||||
|
// On escape.
|
||||||
|
event.preventDefault(); |
||||||
|
scope.$eval(c); |
||||||
|
scope.$apply(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
}]; |
||||||
|
|
||||||
|
}); |
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue